mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 22:56:38 +01:00
Fix DeepSource Issues (#3357)
This commit is contained in:
parent
1d1d774d9f
commit
e1d56178c8
16 changed files with 36 additions and 37 deletions
|
@ -175,7 +175,7 @@ __all__ = ( # Keep this alphabetically ordered
|
|||
)
|
||||
|
||||
|
||||
from . import _version
|
||||
from . import _version, constants, error, helpers, request, warnings
|
||||
from ._bot import Bot
|
||||
from ._botcommand import BotCommand
|
||||
from ._botcommandscope import (
|
||||
|
@ -312,6 +312,15 @@ from ._telegramobject import TelegramObject
|
|||
from ._update import Update
|
||||
from ._user import User
|
||||
from ._userprofilephotos import UserProfilePhotos
|
||||
from ._videochat import (
|
||||
VideoChatEnded,
|
||||
VideoChatParticipantsInvited,
|
||||
VideoChatScheduled,
|
||||
VideoChatStarted,
|
||||
)
|
||||
from ._webappdata import WebAppData
|
||||
from ._webappinfo import WebAppInfo
|
||||
from ._webhookinfo import WebhookInfo
|
||||
|
||||
#: :obj:`str`: The version of the `python-telegram-bot` library as string.
|
||||
#: To get detailed information about the version number, please use :data:`__version_info__`
|
||||
|
@ -335,13 +344,3 @@ __bot_api_version__ = _version.__bot_api_version__
|
|||
#:
|
||||
#: .. versionadded:: 20.0
|
||||
__bot_api_version_info__ = _version.__bot_api_version_info__
|
||||
|
||||
from ._videochat import (
|
||||
VideoChatEnded,
|
||||
VideoChatParticipantsInvited,
|
||||
VideoChatScheduled,
|
||||
VideoChatStarted,
|
||||
)
|
||||
from ._webappdata import WebAppData
|
||||
from ._webappinfo import WebAppInfo
|
||||
from ._webhookinfo import WebhookInfo
|
||||
|
|
|
@ -302,7 +302,7 @@ class Bot(TelegramObject, AbstractAsyncContextManager):
|
|||
@functools.wraps(func)
|
||||
async def decorator(*args, **kwargs): # type: ignore[no-untyped-def]
|
||||
logger.debug("Entering: %s", func.__name__)
|
||||
result = await func(*args, **kwargs)
|
||||
result = await func(*args, **kwargs) # skipcq: PYL-E1102
|
||||
logger.debug(result)
|
||||
logger.debug("Exiting: %s", func.__name__)
|
||||
return result
|
||||
|
|
|
@ -420,8 +420,8 @@ class _CredentialsBase(TelegramObject):
|
|||
__slots__ = ("hash", "secret", "file_hash", "data_hash")
|
||||
|
||||
def __init__(
|
||||
self, hash: str, secret: str, *, api_kwargs: JSONDict = None
|
||||
): # skipcq: PYL-W0622
|
||||
self, hash: str, secret: str, *, api_kwargs: JSONDict = None # skipcq: PYL-W0622
|
||||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
self.hash = hash
|
||||
self.secret = secret
|
||||
|
|
|
@ -217,7 +217,7 @@ class TelegramObject:
|
|||
value = getattr(self, key, None)
|
||||
if value is not None:
|
||||
if recursive and hasattr(value, "to_dict"):
|
||||
data[key] = value.to_dict(recursive=True) # pylint: disable=no-member
|
||||
data[key] = value.to_dict(recursive=True)
|
||||
else:
|
||||
data[key] = value
|
||||
elif not recursive:
|
||||
|
|
|
@ -27,7 +27,7 @@ Warning:
|
|||
user. Changes to this module are not considered breaking changes and may not be documented in
|
||||
the changelog.
|
||||
"""
|
||||
import datetime as dtm
|
||||
import datetime as dtm # skipcq: PYL-W0406
|
||||
import time
|
||||
from typing import Optional, Union
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ Warning:
|
|||
user. Changes to this module are not considered breaking changes and may not be documented in
|
||||
the changelog.
|
||||
"""
|
||||
import enum as _enum
|
||||
import enum as _enum # skipcq: PYL-R0201
|
||||
import sys
|
||||
from typing import Type, TypeVar, Union
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Warning:
|
|||
user. Changes to this module are not considered breaking changes and may not be documented in
|
||||
the changelog.
|
||||
"""
|
||||
import warnings
|
||||
import warnings # skipcq: PYL-R0201
|
||||
from typing import Type
|
||||
|
||||
from telegram.warnings import PTBUserWarning
|
||||
|
|
|
@ -152,8 +152,8 @@ class CallbackQueryHandler(BaseHandler[Update, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: Update,
|
||||
application: "Application",
|
||||
update: Update, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Union[bool, Match],
|
||||
) -> None:
|
||||
"""Add the result of ``re.match(pattern, update.callback_query.data)`` to
|
||||
|
|
|
@ -108,8 +108,8 @@ class ChosenInlineResultHandler(BaseHandler[Update, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: Update,
|
||||
application: "Application",
|
||||
update: Update, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Union[bool, Match],
|
||||
) -> None:
|
||||
"""This function adds the matched regex pattern result to
|
||||
|
|
|
@ -160,8 +160,8 @@ class CommandHandler(BaseHandler[Update, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: Update,
|
||||
application: "Application",
|
||||
update: Update, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Optional[Union[bool, Tuple[List[str], Optional[bool]]]],
|
||||
) -> None:
|
||||
"""Add text after the command to :attr:`CallbackContext.args` as list, split on single
|
||||
|
|
|
@ -125,8 +125,8 @@ class InlineQueryHandler(BaseHandler[Update, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: Update,
|
||||
application: "Application",
|
||||
update: Update, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Optional[Union[bool, Match]],
|
||||
) -> None:
|
||||
"""Add the result of ``re.match(pattern, update.inline_query.query)`` to
|
||||
|
|
|
@ -100,8 +100,8 @@ class MessageHandler(BaseHandler[Update, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: Update,
|
||||
application: "Application",
|
||||
update: Update, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Optional[Union[bool, Dict[str, object]]],
|
||||
) -> None:
|
||||
"""Adds possible output of data filters to the :class:`CallbackContext`."""
|
||||
|
|
|
@ -172,8 +172,8 @@ class PrefixHandler(BaseHandler[Update, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: Update,
|
||||
application: "Application",
|
||||
update: Update, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Optional[Union[bool, Tuple[List[str], Optional[bool]]]],
|
||||
) -> None:
|
||||
"""Add text after the command to :attr:`CallbackContext.args` as list, split on single
|
||||
|
|
|
@ -96,8 +96,8 @@ class StringCommandHandler(BaseHandler[str, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: str,
|
||||
application: "Application",
|
||||
update: str, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Optional[List[str]],
|
||||
) -> None:
|
||||
"""Add text after the command to :attr:`CallbackContext.args` as list, split on single
|
||||
|
|
|
@ -103,8 +103,8 @@ class StringRegexHandler(BaseHandler[str, CCT]):
|
|||
def collect_additional_context(
|
||||
self,
|
||||
context: CCT,
|
||||
update: str,
|
||||
application: "Application",
|
||||
update: str, # skipcq: BAN-B301
|
||||
application: "Application", # skipcq: BAN-B301
|
||||
check_result: Optional[Match],
|
||||
) -> None:
|
||||
"""Add the result of ``re.match(pattern, update)`` to :attr:`CallbackContext.matches` as
|
||||
|
|
|
@ -27,13 +27,13 @@ from pathlib import Path
|
|||
def test_public_submodules_dunder_all():
|
||||
modules_to_search = list(Path("telegram").rglob("*.py"))
|
||||
|
||||
if not modules_to_search:
|
||||
raise AssertionError("No modules found to search through, please modify this test.")
|
||||
|
||||
for mod_path in modules_to_search:
|
||||
path = str(mod_path)
|
||||
folder = mod_path.parent
|
||||
|
||||
if "vendor" in path: # skip anything vendor related
|
||||
continue
|
||||
|
||||
if mod_path.name == "__init__.py" and "_" not in path[:-11]: # init of public submodules
|
||||
mod = load_module(mod_path)
|
||||
assert hasattr(mod, "__all__"), f"{folder}'s __init__ does not have an __all__!"
|
||||
|
|
Loading…
Reference in a new issue