Fix Configuration of Black Formatter (#2158)

* Fix Black in pre-commit

* Fix black some more
This commit is contained in:
Bibo-Joshi 2020-10-23 13:40:02 +02:00 committed by GitHub
parent 165a24e13d
commit 02cd7b642f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 8 deletions

View file

@ -5,6 +5,7 @@ repos:
- id: black - id: black
args: args:
- --diff - --diff
- --check
- repo: https://gitlab.com/pycqa/flake8 - repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1 rev: 3.8.1
hooks: hooks:

View file

@ -1,6 +1,11 @@
[tool.black] [tool.black]
line-length = 99 line-length = 99
target-version = ['py36'] 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$' include = '(telegram|examples|tests)/.*\.py$'
exclude = 'telegram/vendor' exclude = 'telegram/vendor'
skip-string-normalization = true

View file

@ -154,14 +154,14 @@ class Chat(TelegramObject):
def is_anonymous_admin(self) -> bool: def is_anonymous_admin(self) -> bool:
""":obj:`bool`: Convenience property. Returns :obj:`True`, if this chat is with is the bot """: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 representing anonymous admins. This behaviour is undocumented and might be changed
by Telegram. """ by Telegram."""
return self.id == constants.ANONYMOUS_ADMIN_ID return self.id == constants.ANONYMOUS_ADMIN_ID
@property @property
def is_service_chat(self) -> bool: def is_service_chat(self) -> bool:
""":obj:`bool`: Convenience property. Returns :obj:`True`, if this chat is the Telegram """: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 return self.id == constants.SERVICE_CHAT_ID

View file

@ -111,6 +111,7 @@ class ChatMember(TelegramObject):
may add web page previews to his messages. may add web page previews to his messages.
""" """
ADMINISTRATOR: ClassVar[str] = constants.CHATMEMBER_ADMINISTRATOR ADMINISTRATOR: ClassVar[str] = constants.CHATMEMBER_ADMINISTRATOR
""":const:`telegram.constants.CHATMEMBER_ADMINISTRATOR`""" """:const:`telegram.constants.CHATMEMBER_ADMINISTRATOR`"""
CREATOR: ClassVar[str] = constants.CHATMEMBER_CREATOR CREATOR: ClassVar[str] = constants.CHATMEMBER_CREATOR

View file

@ -1579,7 +1579,8 @@ class Message(TelegramObject):
markdown_text += message_text[last_offset:] markdown_text += message_text[last_offset:]
else: else:
markdown_text += message_text[last_offset * 2 :].decode( # type: ignore markdown_text += message_text[last_offset * 2 :].decode( # type: ignore
'utf-16-le') 'utf-16-le'
)
return markdown_text return markdown_text

View file

@ -568,7 +568,9 @@ class TestConversationHandler:
assert len(handler.conversations) == 0 assert len(handler.conversations) == 0
def test_end_on_first_message_async(self, dp, bot, user1): 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( handler = ConversationHandler(
entry_points=[CommandHandler('start', start_end_async)], states={}, fallbacks=[] entry_points=[CommandHandler('start', start_end_async)], states={}, fallbacks=[]
@ -645,7 +647,9 @@ class TestConversationHandler:
assert len(handler.conversations) == 0 assert len(handler.conversations) == 0
def test_none_on_first_message_async(self, dp, bot, user1): 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( handler = ConversationHandler(
entry_points=[CommandHandler('start', start_none_async)], states={}, fallbacks=[] entry_points=[CommandHandler('start', start_none_async)], states={}, fallbacks=[]