diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a06e9dae..62ae9dde9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,4 +74,6 @@ repos: hooks: - id: isort name: isort - args: ["--diff"] # -diff will not apply the changes, just show them + args: + - --diff + - --check diff --git a/telegram/__init__.py b/telegram/__init__.py index 238e94f5f..adb167589 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -175,6 +175,7 @@ __all__ = ( # Keep this alphabetically ordered ) +from . import _version from ._bot import Bot from ._botcommand import BotCommand from ._botcommandscope import ( @@ -311,7 +312,6 @@ from ._telegramobject import TelegramObject from ._update import Update from ._user import User from ._userprofilephotos import UserProfilePhotos -from . import _version #: :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__` diff --git a/telegram/_utils/types.py b/telegram/_utils/types.py index aa93c3cc7..ebf91ee8b 100644 --- a/telegram/_utils/types.py +++ b/telegram/_utils/types.py @@ -24,11 +24,16 @@ Warning: the changelog. """ from pathlib import Path -from typing import IO, TYPE_CHECKING, Any, Dict, Optional, Tuple, TypeVar, Union, Collection +from typing import IO, TYPE_CHECKING, Any, Collection, Dict, Optional, Tuple, TypeVar, Union if TYPE_CHECKING: - from telegram import InputFile - from telegram import ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove + from telegram import ( + ForceReply, + InlineKeyboardMarkup, + InputFile, + ReplyKeyboardMarkup, + ReplyKeyboardRemove, + ) from telegram._utils.defaultvalue import DefaultValue FileLike = Union[IO[bytes], "InputFile"] diff --git a/telegram/ext/_applicationbuilder.py b/telegram/ext/_applicationbuilder.py index d389e8a46..aaccb4766 100644 --- a/telegram/ext/_applicationbuilder.py +++ b/telegram/ext/_applicationbuilder.py @@ -34,7 +34,7 @@ from telegram.request import BaseRequest from telegram.request._httpxrequest import HTTPXRequest if TYPE_CHECKING: - from telegram.ext import BasePersistence, Defaults, CallbackContext + from telegram.ext import BasePersistence, CallbackContext, Defaults # Type hinting is a bit complicated here because we try to get to a sane level of # leveraging generics and therefore need a number of type variables. diff --git a/telegram/ext/_contexttypes.py b/telegram/ext/_contexttypes.py index 147559278..30f306951 100644 --- a/telegram/ext/_contexttypes.py +++ b/telegram/ext/_contexttypes.py @@ -24,6 +24,7 @@ from telegram.ext._utils.types import BD, CCT, CD, UD if TYPE_CHECKING: from typing import Dict + from telegram.ext._extbot import ExtBot diff --git a/tests/test_application.py b/tests/test_application.py index dfc9635d0..ce7f48c13 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -40,11 +40,11 @@ from telegram.ext import ( Application, ApplicationBuilder, ApplicationHandlerStop, + BaseHandler, CallbackContext, CommandHandler, ContextTypes, Defaults, - BaseHandler, JobQueue, MessageHandler, PicklePersistence, diff --git a/tests/test_basepersistence.py b/tests/test_basepersistence.py index f21ef4851..9882066a3 100644 --- a/tests/test_basepersistence.py +++ b/tests/test_basepersistence.py @@ -34,10 +34,10 @@ from telegram.ext import ( Application, ApplicationBuilder, ApplicationHandlerStop, + BaseHandler, BasePersistence, CallbackContext, ConversationHandler, - BaseHandler, MessageHandler, PersistenceInput, filters, diff --git a/tests/test_version.py b/tests/test_version.py index 766b3083f..6d145333d 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -19,10 +19,10 @@ import pytest from telegram import ( - __version_info__, - __version__, - __bot_api_version_info__, __bot_api_version__, + __bot_api_version_info__, + __version__, + __version_info__, constants, ) from telegram._version import Version