mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-01-04 18:12:12 +01:00
remove type checking protocol from runtime
This commit is contained in:
parent
56cbe650af
commit
7c00b03b60
1 changed files with 20 additions and 16 deletions
|
@ -31,6 +31,8 @@ from telegram._telegramobject import TelegramObject
|
||||||
from telegram._utils.types import JSONDict, ODVInput
|
from telegram._utils.types import JSONDict, ODVInput
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from typing import type_check_only
|
||||||
|
|
||||||
from telegram import Bot, FileCredentials
|
from telegram import Bot, FileCredentials
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
@ -69,25 +71,27 @@ def parse_lpo_and_dwpp(
|
||||||
Tele_co = TypeVar("Tele_co", bound=TelegramObject, covariant=True)
|
Tele_co = TypeVar("Tele_co", bound=TelegramObject, covariant=True)
|
||||||
TeleCrypto_co = TypeVar("TeleCrypto_co", bound="HasDecryptMethod", covariant=True)
|
TeleCrypto_co = TypeVar("TeleCrypto_co", bound="HasDecryptMethod", covariant=True)
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
|
||||||
class HasDecryptMethod(Protocol):
|
@type_check_only
|
||||||
__slots__ = ()
|
class HasDecryptMethod(Protocol):
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def de_json_decrypted(
|
def de_json_decrypted(
|
||||||
cls: type[TeleCrypto_co],
|
cls: type[TeleCrypto_co],
|
||||||
data: JSONDict,
|
data: JSONDict,
|
||||||
bot: Optional["Bot"],
|
bot: Optional["Bot"],
|
||||||
credentials: list["FileCredentials"],
|
credentials: list["FileCredentials"],
|
||||||
) -> TeleCrypto_co: ...
|
) -> TeleCrypto_co: ...
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def de_list_decrypted(
|
def de_list_decrypted(
|
||||||
cls: type[TeleCrypto_co],
|
cls: type[TeleCrypto_co],
|
||||||
data: list[JSONDict],
|
data: list[JSONDict],
|
||||||
bot: Optional["Bot"],
|
bot: Optional["Bot"],
|
||||||
credentials: list["FileCredentials"],
|
credentials: list["FileCredentials"],
|
||||||
) -> tuple[TeleCrypto_co, ...]: ...
|
) -> tuple[TeleCrypto_co, ...]: ...
|
||||||
|
|
||||||
|
|
||||||
def de_json_wo(
|
def de_json_wo(
|
||||||
|
|
Loading…
Reference in a new issue