mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-24 08:06:26 +01:00
pre-commit
autoupdate (#3876)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
This commit is contained in:
parent
82c98b64a7
commit
f77f4b0cf7
37 changed files with 46 additions and 49 deletions
|
@ -17,7 +17,7 @@ repos:
|
|||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: v3.0.0a6
|
||||
rev: v3.0.0a7
|
||||
hooks:
|
||||
- id: pylint
|
||||
files: ^(telegram|examples)/.*\.py$
|
||||
|
@ -35,7 +35,7 @@ repos:
|
|||
- aiolimiter~=1.1.0
|
||||
- . # this basically does `pip install -e .`
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.4.1
|
||||
rev: v1.5.1
|
||||
hooks:
|
||||
- id: mypy
|
||||
name: mypy-ptb
|
||||
|
@ -77,7 +77,7 @@ repos:
|
|||
- --diff
|
||||
- --check
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: 'v0.0.281'
|
||||
rev: 'v0.0.287'
|
||||
hooks:
|
||||
- id: ruff
|
||||
name: ruff
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""This example showcases how PTBs "arbitrary callback data" feature can be used.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""Bot that explains Telegram's "Deep Linking Parameters" functionality.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""This is a very simple example on how one could implement a custom error handler."""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""Simple inline keyboard bot with multiple CallbackQueryHandlers.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""Basic example for a bot that can receive payment from user."""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=import-error
|
||||
"""Simple Bot to reply to Telegram messages.
|
||||
|
||||
This is built on the API wrapper, see echobot.py to see the same example built
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument, import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# pylint: disable=unused-argument,import-error
|
||||
# pylint: disable=unused-argument
|
||||
# This program is dedicated to the public domain under the CC0 license.
|
||||
|
||||
"""
|
||||
|
|
|
@ -19,7 +19,7 @@ exclude = setup.py, setup-raw.py docs/source/conf.py
|
|||
disable = duplicate-code,too-many-arguments,too-many-public-methods,too-few-public-methods,
|
||||
broad-except,too-many-instance-attributes,fixme,missing-function-docstring,
|
||||
missing-class-docstring,too-many-locals,too-many-lines,too-many-branches,
|
||||
too-many-statements
|
||||
too-many-statements, cyclic-import
|
||||
enable=useless-suppression ; Warns about unused pylint ignores
|
||||
exclude-protected=_unfrozen
|
||||
|
||||
|
|
|
@ -668,7 +668,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
return self._bot_user
|
||||
|
||||
@property
|
||||
def id(self) -> int: # pylint: disable=invalid-name
|
||||
def id(self) -> int:
|
||||
""":obj:`int`: Unique identifier for this bot. Shortcut for the corresponding attribute of
|
||||
:attr:`bot`.
|
||||
"""
|
||||
|
@ -4317,7 +4317,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
)
|
||||
|
||||
@_log
|
||||
async def answer_shipping_query( # pylint: disable=invalid-name
|
||||
async def answer_shipping_query(
|
||||
self,
|
||||
shipping_query_id: str,
|
||||
ok: bool,
|
||||
|
@ -4376,7 +4376,7 @@ class Bot(TelegramObject, AsyncContextManager["Bot"]):
|
|||
)
|
||||
|
||||
@_log
|
||||
async def answer_pre_checkout_query( # pylint: disable=invalid-name
|
||||
async def answer_pre_checkout_query(
|
||||
self,
|
||||
pre_checkout_query_id: str,
|
||||
ok: bool,
|
||||
|
|
|
@ -127,7 +127,7 @@ class CallbackQuery(TelegramObject):
|
|||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
# Required
|
||||
self.id: str = id # pylint: disable=invalid-name
|
||||
self.id: str = id
|
||||
self.from_user: User = from_user
|
||||
self.chat_instance: str = chat_instance
|
||||
# Optionals
|
||||
|
|
|
@ -374,7 +374,7 @@ class Chat(TelegramObject):
|
|||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
# Required
|
||||
self.id: int = id # pylint: disable=invalid-name
|
||||
self.id: int = id
|
||||
self.type: str = enum.get_member(constants.ChatType, type, type)
|
||||
# Optionals
|
||||
self.title: Optional[str] = title
|
||||
|
|
|
@ -111,7 +111,7 @@ class InlineQuery(TelegramObject):
|
|||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
# Required
|
||||
self.id: str = id # pylint: disable=invalid-name
|
||||
self.id: str = id
|
||||
self.from_user: User = from_user
|
||||
self.query: str = query
|
||||
self.offset: str = offset
|
||||
|
|
|
@ -60,7 +60,7 @@ class InlineQueryResult(TelegramObject):
|
|||
|
||||
# Required
|
||||
self.type: str = type
|
||||
self.id: str = str(id) # pylint: disable=invalid-name
|
||||
self.id: str = str(id)
|
||||
|
||||
self._id_attrs = (self.id,)
|
||||
|
||||
|
|
|
@ -854,7 +854,7 @@ class Message(TelegramObject):
|
|||
return self.chat.id
|
||||
|
||||
@property
|
||||
def id(self) -> int: # pylint: disable=invalid-name
|
||||
def id(self) -> int:
|
||||
"""
|
||||
:obj:`int`: Shortcut for :attr:`message_id`.
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class PreCheckoutQuery(TelegramObject):
|
|||
api_kwargs: Optional[JSONDict] = None,
|
||||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
self.id: str = id # pylint: disable=invalid-name
|
||||
self.id: str = id
|
||||
self.from_user: User = from_user
|
||||
self.currency: str = currency
|
||||
self.total_amount: int = total_amount
|
||||
|
@ -120,7 +120,7 @@ class PreCheckoutQuery(TelegramObject):
|
|||
|
||||
return super().de_json(data=data, bot=bot)
|
||||
|
||||
async def answer( # pylint: disable=invalid-name
|
||||
async def answer(
|
||||
self,
|
||||
ok: bool,
|
||||
error_message: Optional[str] = None,
|
||||
|
|
|
@ -66,7 +66,7 @@ class ShippingOption(TelegramObject):
|
|||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
|
||||
self.id: str = id # pylint: disable=invalid-name
|
||||
self.id: str = id
|
||||
self.title: str = title
|
||||
self.prices: Tuple[LabeledPrice, ...] = parse_sequence_arg(prices)
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class ShippingQuery(TelegramObject):
|
|||
api_kwargs: Optional[JSONDict] = None,
|
||||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
self.id: str = id # pylint: disable=invalid-name
|
||||
self.id: str = id
|
||||
self.from_user: User = from_user
|
||||
self.invoice_payload: str = invoice_payload
|
||||
self.shipping_address: ShippingAddress = shipping_address
|
||||
|
@ -89,7 +89,7 @@ class ShippingQuery(TelegramObject):
|
|||
|
||||
return super().de_json(data=data, bot=bot)
|
||||
|
||||
async def answer( # pylint: disable=invalid-name
|
||||
async def answer(
|
||||
self,
|
||||
ok: bool,
|
||||
shipping_options: Optional[Sequence[ShippingOption]] = None,
|
||||
|
|
|
@ -302,7 +302,7 @@ class Poll(TelegramObject):
|
|||
api_kwargs: Optional[JSONDict] = None,
|
||||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
self.id: str = id # pylint: disable=invalid-name
|
||||
self.id: str = id
|
||||
self.question: str = question
|
||||
self.options: Tuple[PollOption, ...] = parse_sequence_arg(options)
|
||||
self.total_voter_count: int = total_voter_count
|
||||
|
|
|
@ -153,7 +153,7 @@ class User(TelegramObject):
|
|||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
# Required
|
||||
self.id: int = id # pylint: disable=invalid-name
|
||||
self.id: int = id
|
||||
self.first_name: str = first_name
|
||||
self.is_bot: bool = is_bot
|
||||
# Optionals
|
||||
|
|
|
@ -53,7 +53,7 @@ def _localize(datetime: dtm.datetime, tzinfo: dtm.tzinfo) -> dtm.datetime:
|
|||
|
||||
|
||||
def to_float_timestamp(
|
||||
time_object: Union[int, float, dtm.timedelta, dtm.datetime, dtm.time],
|
||||
time_object: Union[float, dtm.timedelta, dtm.datetime, dtm.time],
|
||||
reference_timestamp: Optional[float] = None,
|
||||
tzinfo: Optional[dtm.tzinfo] = None,
|
||||
) -> float:
|
||||
|
@ -65,12 +65,11 @@ def to_float_timestamp(
|
|||
to be in UTC, if ``bot`` is not passed or ``bot.defaults`` is :obj:`None`.
|
||||
|
||||
Args:
|
||||
time_object (:obj:`int` | :obj:`float` | :obj:`datetime.timedelta` | \
|
||||
time_object (:obj:`float` | :obj:`datetime.timedelta` | \
|
||||
:obj:`datetime.datetime` | :obj:`datetime.time`):
|
||||
Time value to convert. The semantics of this parameter will depend on its type:
|
||||
|
||||
* :obj:`int` or :obj:`float` will be interpreted as "seconds from
|
||||
:paramref:`reference_t`"
|
||||
* :obj:`float` will be interpreted as "seconds from :paramref:`reference_t`"
|
||||
* :obj:`datetime.timedelta` will be interpreted as
|
||||
"time increment from :paramref:`reference_timestamp`"
|
||||
* :obj:`datetime.datetime` will be interpreted as an absolute date/time value
|
||||
|
@ -148,7 +147,7 @@ def to_float_timestamp(
|
|||
|
||||
|
||||
def to_timestamp(
|
||||
dt_obj: Union[int, float, dtm.timedelta, dtm.datetime, dtm.time, None],
|
||||
dt_obj: Union[float, dtm.timedelta, dtm.datetime, dtm.time, None],
|
||||
reference_timestamp: Optional[float] = None,
|
||||
tzinfo: Optional[dtm.tzinfo] = None,
|
||||
) -> Optional[int]:
|
||||
|
|
|
@ -486,7 +486,7 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica
|
|||
|
||||
self._initialized = False
|
||||
|
||||
async def __aenter__(self: _AppType) -> _AppType:
|
||||
async def __aenter__(self: _AppType) -> _AppType: # noqa: PYI019
|
||||
"""Simple context manager which initializes the App."""
|
||||
try:
|
||||
await self.initialize()
|
||||
|
|
|
@ -107,14 +107,14 @@ class JobQueue(Generic[CCT]):
|
|||
@overload
|
||||
def _parse_time_input(
|
||||
self,
|
||||
time: Union[float, int, datetime.timedelta, datetime.datetime, datetime.time],
|
||||
time: Union[float, datetime.timedelta, datetime.datetime, datetime.time],
|
||||
shift_day: bool = False,
|
||||
) -> datetime.datetime:
|
||||
...
|
||||
|
||||
def _parse_time_input(
|
||||
self,
|
||||
time: Union[float, int, datetime.timedelta, datetime.datetime, datetime.time, None],
|
||||
time: Union[float, datetime.timedelta, datetime.datetime, datetime.time, None],
|
||||
shift_day: bool = False,
|
||||
) -> Optional[datetime.datetime]:
|
||||
if time is None:
|
||||
|
|
|
@ -163,7 +163,7 @@ class Updater(AsyncContextManager["Updater"]):
|
|||
self._initialized = False
|
||||
_LOGGER.debug("Shut down of Updater complete")
|
||||
|
||||
async def __aenter__(self: _UpdaterType) -> _UpdaterType:
|
||||
async def __aenter__(self: _UpdaterType) -> _UpdaterType: # noqa: PYI019
|
||||
"""Simple context manager which initializes the Updater."""
|
||||
try:
|
||||
await self.initialize()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
#! /usr/bin/env python
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2023
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
|
|
Loading…
Reference in a new issue