mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 06:25:12 +01:00
pre-commit
autoupdate (#4184)
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>
This commit is contained in:
parent
474f9c9693
commit
040cd2c2fc
6 changed files with 13 additions and 24 deletions
|
@ -6,7 +6,7 @@ ci:
|
|||
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: 'v0.2.1'
|
||||
rev: 'v0.3.5'
|
||||
hooks:
|
||||
- id: ruff
|
||||
name: ruff
|
||||
|
@ -17,7 +17,7 @@ repos:
|
|||
- cachetools~=5.3.3
|
||||
- aiolimiter~=1.1.0
|
||||
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||
rev: 24.1.1
|
||||
rev: 24.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
args:
|
||||
|
@ -28,7 +28,7 @@ repos:
|
|||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: v3.0.3
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: pylint
|
||||
files: ^(?!(tests|docs)).*\.py$
|
||||
|
@ -40,7 +40,7 @@ repos:
|
|||
- aiolimiter~=1.1.0
|
||||
- . # this basically does `pip install -e .`
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.8.0
|
||||
rev: v1.9.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
name: mypy-ptb
|
||||
|
@ -67,7 +67,7 @@ repos:
|
|||
- cachetools~=5.3.3
|
||||
- . # this basically does `pip install -e .`
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.15.0
|
||||
rev: v3.15.2
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args:
|
||||
|
|
|
@ -107,7 +107,5 @@ class ChatJoinRequestHandler(BaseHandler[Update, CCT]):
|
|||
return True
|
||||
if update.chat_join_request.chat.id in self._chat_ids:
|
||||
return True
|
||||
if update.chat_join_request.from_user.username in self._usernames:
|
||||
return True
|
||||
return False
|
||||
return update.chat_join_request.from_user.username in self._usernames
|
||||
return False
|
||||
|
|
|
@ -153,14 +153,12 @@ class CommandHandler(BaseHandler[Update, CCT]):
|
|||
:obj:`bool`: Whether the args are valid for this handler.
|
||||
"""
|
||||
# pylint: disable=too-many-boolean-expressions
|
||||
if (
|
||||
return bool(
|
||||
(self.has_args is None)
|
||||
or (self.has_args is True and args)
|
||||
or (self.has_args is False and not args)
|
||||
or (isinstance(self.has_args, int) and len(args) == self.has_args)
|
||||
):
|
||||
return True
|
||||
return False
|
||||
)
|
||||
|
||||
def check_update(
|
||||
self, update: object
|
||||
|
|
|
@ -281,14 +281,12 @@ class BaseFilter:
|
|||
:attr:`~telegram.Update.edited_channel_post` or
|
||||
:attr:`~telegram.Update.edited_message`, :obj:`False` otherwise.
|
||||
"""
|
||||
if ( # Only message updates should be handled.
|
||||
return bool( # Only message updates should be handled.
|
||||
update.channel_post
|
||||
or update.message
|
||||
or update.edited_channel_post
|
||||
or update.edited_message
|
||||
):
|
||||
return True
|
||||
return False
|
||||
)
|
||||
|
||||
|
||||
class MessageFilter(BaseFilter):
|
||||
|
|
|
@ -73,9 +73,7 @@ def no_rerun_after_xfail_or_flood(error, name, test: pytest.Function, plugin):
|
|||
if getattr(error[1], "msg", "") is None:
|
||||
raise error[1]
|
||||
did_we_flood = "flood" in getattr(error[1], "msg", "") # _pytest.outcomes.XFailed has 'msg'
|
||||
if xfail_present or did_we_flood:
|
||||
return False
|
||||
return True
|
||||
return not (xfail_present or did_we_flood)
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(items: List[pytest.Item]):
|
||||
|
|
|
@ -149,7 +149,7 @@ class TestConstantsWithoutRequest:
|
|||
|
||||
if any(re.match(pattern, name) for pattern in patters):
|
||||
return False
|
||||
if name in {
|
||||
return name not in {
|
||||
"author_signature",
|
||||
"api_kwargs",
|
||||
"caption",
|
||||
|
@ -176,10 +176,7 @@ class TestConstantsWithoutRequest:
|
|||
# attribute is deprecated, no need to add it to MessageType
|
||||
"user_shared",
|
||||
"via_bot",
|
||||
}:
|
||||
return False
|
||||
|
||||
return True
|
||||
}
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"attribute",
|
||||
|
|
Loading…
Reference in a new issue