From 6e4a1f0a21c3a3293ace7fe709618af9b778e11b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 11:28:47 +0100 Subject: [PATCH] `pre-commit` autoupdate (#3409) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com> --- .pre-commit-config.yaml | 8 ++++---- setup.cfg | 1 + telegram/_utils/files.py | 4 ++-- telegram/ext/_extbot.py | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30dc3954e..d7c7c00f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,11 +16,11 @@ repos: - --diff - --check - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 - repo: https://github.com/PyCQA/pylint - rev: v2.15.5 + rev: v2.15.8 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: v0.982 + rev: v0.991 hooks: - id: mypy name: mypy-ptb @@ -65,7 +65,7 @@ repos: - cachetools~=5.2.0 - . # this basically does `pip install -e .` - repo: https://github.com/asottile/pyupgrade - rev: v3.2.0 + rev: v3.3.0 hooks: - id: pyupgrade files: ^(telegram|examples|tests)/.*\.py$ diff --git a/setup.cfg b/setup.cfg index 7e74d0fa2..cac0ea41b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -60,6 +60,7 @@ disallow_untyped_defs = True disallow_incomplete_defs = True disallow_untyped_decorators = True show_error_codes = True +implicit_optional = True # For some files, it's easier to just disable strict-optional all together instead of # cluttering the code with `# type: ignore`s or stuff like diff --git a/telegram/_utils/files.py b/telegram/_utils/files.py index 3e13c3832..3e457116d 100644 --- a/telegram/_utils/files.py +++ b/telegram/_utils/files.py @@ -63,8 +63,8 @@ def load_file( except AttributeError: return None, cast(Union[bytes, "InputFile", str, Path], obj) - if hasattr(obj, "name") and not isinstance(obj.name, int): # type: ignore[union-attr] - filename = Path(obj.name).name # type: ignore[union-attr] + if hasattr(obj, "name") and not isinstance(obj.name, int): + filename = Path(obj.name).name else: filename = None diff --git a/telegram/ext/_extbot.py b/telegram/ext/_extbot.py index f77272341..5af53d805 100644 --- a/telegram/ext/_extbot.py +++ b/telegram/ext/_extbot.py @@ -563,7 +563,7 @@ class ExtBot(Bot, Generic[RLARGS]): # We build a new result in case the user wants to use the same object in # different places new_result = copy(result) - markup = self._replace_keyboard(result.reply_markup) # type: ignore[attr-defined] + markup = self._replace_keyboard(result.reply_markup) new_result.reply_markup = markup # type: ignore[attr-defined] results.append(new_result)