From 83a164e5ef5215187daf8f336f20f66add1af9e5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 5 Apr 2023 20:52:52 +0200 Subject: [PATCH] `pre-commit` autoupdate (#3646) Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Co-authored-by: Dmitry Kolomatskiy <58207913+lemontree210@users.noreply.github.com> Co-authored-by: Harshil Mehta <37377066+harshil21@users.noreply.github.com> --- .pre-commit-config.yaml | 8 ++++---- pyproject.toml | 3 +++ telegram/_utils/types.py | 2 +- telegram/ext/_conversationhandler.py | 4 ++-- tests/test_bot.py | 2 +- tests/test_forum.py | 4 +--- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index adc50c281..3c352a2b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ ci: repos: - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.3.0 hooks: - id: black args: @@ -20,7 +20,7 @@ repos: hooks: - id: flake8 - repo: https://github.com/PyCQA/pylint - rev: v2.16.4 + rev: v3.0.0a6 hooks: - id: pylint files: ^(telegram|examples)/.*\.py$ @@ -38,7 +38,7 @@ repos: - aiolimiter~=1.0.0 - . # this basically does `pip install -e .` - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.0.1 + rev: v1.1.1 hooks: - id: mypy name: mypy-ptb @@ -80,7 +80,7 @@ repos: - --diff - --check - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.259' + rev: 'v0.0.261' hooks: - id: ruff name: ruff diff --git a/pyproject.toml b/pyproject.toml index 8460ae00f..c9b968f59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,3 +13,6 @@ show-fixes = true ignore = ["PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915"] select = ["E", "F", "I", "PL", "UP", "RUF", "PTH", "C4", "B", "PIE", "SIM", "RET", "RSE", "G", "ISC", "PT"] + +[tool.ruff.per-file-ignores] +"tests/*.py" = ["B018"] diff --git a/telegram/_utils/types.py b/telegram/_utils/types.py index d7310fd77..e3e598540 100644 --- a/telegram/_utils/types.py +++ b/telegram/_utils/types.py @@ -60,7 +60,7 @@ DVInput = Union["DefaultValue[DVValueType]", DVValueType, "DefaultValue[None]"] as ``Union[DefaultValue[type], type, DefaultValue[None]]``.""" RT = TypeVar("RT") -SCT = Union[RT, Collection[RT]] +SCT = Union[RT, Collection[RT]] # pylint: disable=invalid-name """Single instance or collection of instances.""" ReplyMarkup = Union[ diff --git a/telegram/ext/_conversationhandler.py b/telegram/ext/_conversationhandler.py index 884b38728..a7ff749ce 100644 --- a/telegram/ext/_conversationhandler.py +++ b/telegram/ext/_conversationhandler.py @@ -846,9 +846,9 @@ class ConversationHandler(BaseHandler[Update, CCT]): "Ignoring `conversation_timeout` because the Applications JobQueue is " "not running.", ) - # Add the new timeout job - # checking if the new state is self.END is done in _schedule_job elif isinstance(new_state, asyncio.Task): + # Add the new timeout job + # checking if the new state is self.END is done in _schedule_job application.create_task( self._schedule_job_delayed( new_state, application, update, context, conversation_key diff --git a/tests/test_bot.py b/tests/test_bot.py index 50398fdfd..5e14707e4 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -2824,7 +2824,7 @@ class TestBotWithRequest: assert len(messages) == 3 # Check if we sent 3 messages # Check if we pinned 3 messages - assert all([await i for i in pinned_messages_tasks]) # noqa: PIE802 + assert all([await i for i in pinned_messages_tasks]) assert all(i.done() for i in pinned_messages_tasks) # Check if all tasks are done chat = await bot.get_chat(super_group_id) # get the chat to check the pinned message diff --git a/tests/test_forum.py b/tests/test_forum.py index c8e3dec89..961a7eb90 100644 --- a/tests/test_forum.py +++ b/tests/test_forum.py @@ -247,9 +247,7 @@ class TestForumMethodsWithRequest: msg = await coro pin_msg_tasks.add(asyncio.create_task(msg.pin())) - assert ( - all([await task for task in pin_msg_tasks]) is True # noqa: PIE802 - ), "Message(s) were not pinned" + assert all([await task for task in pin_msg_tasks]) is True, "Message(s) were not pinned" # We need 2 or more pinned msgs for this to work, else we get Chat_not_modified error result = await bot.unpin_all_forum_topic_messages(forum_group_id, message_thread_id)