mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-28 23:38:31 +01:00
Fix Configuration of Black Formatter (#2158)
* Fix Black in pre-commit * Fix black some more
This commit is contained in:
parent
165a24e13d
commit
02cd7b642f
7 changed files with 20 additions and 8 deletions
|
@ -5,6 +5,7 @@ repos:
|
|||
- id: black
|
||||
args:
|
||||
- --diff
|
||||
- --check
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.8.1
|
||||
hooks:
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
[tool.black]
|
||||
line-length = 99
|
||||
target-version = ['py36']
|
||||
skip-string-normalization = true
|
||||
|
||||
# We need to force-exclude the negated include pattern so
|
||||
# so that pre-commit run --all-files does the correct thing
|
||||
# see https://github.com/psf/black/issues/1778
|
||||
force-exclude = '^(?!(telegram|examples|tests)/).*\.py$'
|
||||
include = '(telegram|examples|tests)/.*\.py$'
|
||||
exclude = 'telegram/vendor'
|
||||
skip-string-normalization = true
|
||||
exclude = 'telegram/vendor'
|
|
@ -154,14 +154,14 @@ class Chat(TelegramObject):
|
|||
def is_anonymous_admin(self) -> bool:
|
||||
""":obj:`bool`: Convenience property. Returns :obj:`True`, if this chat is with is the bot
|
||||
representing anonymous admins. This behaviour is undocumented and might be changed
|
||||
by Telegram. """
|
||||
by Telegram."""
|
||||
|
||||
return self.id == constants.ANONYMOUS_ADMIN_ID
|
||||
|
||||
@property
|
||||
def is_service_chat(self) -> bool:
|
||||
""":obj:`bool`: Convenience property. Returns :obj:`True`, if this chat is the Telegram
|
||||
service chat. This behaviour is undocumented and might be changed by Telegram. """
|
||||
service chat. This behaviour is undocumented and might be changed by Telegram."""
|
||||
|
||||
return self.id == constants.SERVICE_CHAT_ID
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ class ChatMember(TelegramObject):
|
|||
may add web page previews to his messages.
|
||||
|
||||
"""
|
||||
|
||||
ADMINISTRATOR: ClassVar[str] = constants.CHATMEMBER_ADMINISTRATOR
|
||||
""":const:`telegram.constants.CHATMEMBER_ADMINISTRATOR`"""
|
||||
CREATOR: ClassVar[str] = constants.CHATMEMBER_CREATOR
|
||||
|
|
|
@ -305,7 +305,7 @@ def queuedmessage(method: Callable) -> Callable:
|
|||
@functools.wraps(method)
|
||||
def wrapped(self: 'Bot', *args: Any, **kwargs: Any) -> Any:
|
||||
queued = kwargs.pop(
|
||||
'queued', self._is_messages_queued_default # type: ignore[attr-defined]
|
||||
'queued', self._is_messages_queued_default # type: ignore[attr-defined]
|
||||
)
|
||||
isgroup = kwargs.pop('isgroup', False)
|
||||
if queued:
|
||||
|
|
|
@ -1579,7 +1579,8 @@ class Message(TelegramObject):
|
|||
markdown_text += message_text[last_offset:]
|
||||
else:
|
||||
markdown_text += message_text[last_offset * 2 :].decode( # type: ignore
|
||||
'utf-16-le')
|
||||
'utf-16-le'
|
||||
)
|
||||
|
||||
return markdown_text
|
||||
|
||||
|
|
|
@ -568,7 +568,9 @@ class TestConversationHandler:
|
|||
assert len(handler.conversations) == 0
|
||||
|
||||
def test_end_on_first_message_async(self, dp, bot, user1):
|
||||
start_end_async = (lambda bot, update: dp.run_async(self.start_end, bot, update))
|
||||
start_end_async = lambda bot, update: dp.run_async( # noqa: E731
|
||||
self.start_end, bot, update
|
||||
)
|
||||
|
||||
handler = ConversationHandler(
|
||||
entry_points=[CommandHandler('start', start_end_async)], states={}, fallbacks=[]
|
||||
|
@ -645,7 +647,9 @@ class TestConversationHandler:
|
|||
assert len(handler.conversations) == 0
|
||||
|
||||
def test_none_on_first_message_async(self, dp, bot, user1):
|
||||
start_none_async = (lambda bot, update: dp.run_async(self.start_none, bot, update))
|
||||
start_none_async = lambda bot, update: dp.run_async( # noqa: E731
|
||||
self.start_none, bot, update
|
||||
)
|
||||
|
||||
handler = ConversationHandler(
|
||||
entry_points=[CommandHandler('start', start_none_async)], states={}, fallbacks=[]
|
||||
|
|
Loading…
Reference in a new issue