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)