diff --git a/telegram/__init__.py b/telegram/__init__.py index adb167589..11b5e9b72 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -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 diff --git a/telegram/_bot.py b/telegram/_bot.py index f52610116..ec2b7a14b 100644 --- a/telegram/_bot.py +++ b/telegram/_bot.py @@ -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 diff --git a/telegram/_passport/credentials.py b/telegram/_passport/credentials.py index f7432ec19..0d3e5244c 100644 --- a/telegram/_passport/credentials.py +++ b/telegram/_passport/credentials.py @@ -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 diff --git a/telegram/_telegramobject.py b/telegram/_telegramobject.py index a9e583492..40a408be4 100644 --- a/telegram/_telegramobject.py +++ b/telegram/_telegramobject.py @@ -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: diff --git a/telegram/_utils/datetime.py b/telegram/_utils/datetime.py index db90ab92c..11596a3f7 100644 --- a/telegram/_utils/datetime.py +++ b/telegram/_utils/datetime.py @@ -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 diff --git a/telegram/_utils/enum.py b/telegram/_utils/enum.py index 36183d0f5..df362c501 100644 --- a/telegram/_utils/enum.py +++ b/telegram/_utils/enum.py @@ -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 diff --git a/telegram/_utils/warnings.py b/telegram/_utils/warnings.py index 82c5a3aff..bc18e0952 100644 --- a/telegram/_utils/warnings.py +++ b/telegram/_utils/warnings.py @@ -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 diff --git a/telegram/ext/_callbackqueryhandler.py b/telegram/ext/_callbackqueryhandler.py index 16ce6b17d..847f7ea07 100644 --- a/telegram/ext/_callbackqueryhandler.py +++ b/telegram/ext/_callbackqueryhandler.py @@ -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 diff --git a/telegram/ext/_choseninlineresulthandler.py b/telegram/ext/_choseninlineresulthandler.py index 3aa596e51..8adb1167e 100644 --- a/telegram/ext/_choseninlineresulthandler.py +++ b/telegram/ext/_choseninlineresulthandler.py @@ -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 diff --git a/telegram/ext/_commandhandler.py b/telegram/ext/_commandhandler.py index 1c8d656b9..955b9c0b2 100644 --- a/telegram/ext/_commandhandler.py +++ b/telegram/ext/_commandhandler.py @@ -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 diff --git a/telegram/ext/_inlinequeryhandler.py b/telegram/ext/_inlinequeryhandler.py index 891cca13f..d006fa159 100644 --- a/telegram/ext/_inlinequeryhandler.py +++ b/telegram/ext/_inlinequeryhandler.py @@ -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 diff --git a/telegram/ext/_messagehandler.py b/telegram/ext/_messagehandler.py index c6483f663..e62472ffc 100644 --- a/telegram/ext/_messagehandler.py +++ b/telegram/ext/_messagehandler.py @@ -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`.""" diff --git a/telegram/ext/_prefixhandler.py b/telegram/ext/_prefixhandler.py index 38a35e522..87e442a7e 100644 --- a/telegram/ext/_prefixhandler.py +++ b/telegram/ext/_prefixhandler.py @@ -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 diff --git a/telegram/ext/_stringcommandhandler.py b/telegram/ext/_stringcommandhandler.py index 2b93a10bf..10787d3ef 100644 --- a/telegram/ext/_stringcommandhandler.py +++ b/telegram/ext/_stringcommandhandler.py @@ -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 diff --git a/telegram/ext/_stringregexhandler.py b/telegram/ext/_stringregexhandler.py index 4e1b62767..e6b219a7d 100644 --- a/telegram/ext/_stringregexhandler.py +++ b/telegram/ext/_stringregexhandler.py @@ -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 diff --git a/tests/test_modules.py b/tests/test_modules.py index f9813307b..9079d56d8 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -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__!"