mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add support of Bot API 4.7. Bump version
This commit is contained in:
parent
4cb9697cb4
commit
33003f2026
167 changed files with 996 additions and 504 deletions
|
|
@ -14,15 +14,7 @@ Example:
|
|||
<<< ['barItem', 'bazItem', 'fooItem', 'lorem']
|
||||
"""
|
||||
import inspect
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Iterable,
|
||||
List,
|
||||
Optional,
|
||||
Union,
|
||||
cast,
|
||||
)
|
||||
from typing import Any, Callable, Iterable, List, Optional, Union, cast
|
||||
|
||||
PROPS_KEYS_ATTR_NAME = "_props_keys"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,12 @@
|
|||
from __future__ import annotations
|
||||
import contextvars
|
||||
from typing import (
|
||||
Any,
|
||||
ClassVar,
|
||||
Generic,
|
||||
Optional,
|
||||
TypeVar,
|
||||
cast,
|
||||
overload,
|
||||
Dict,
|
||||
)
|
||||
|
||||
__all__ = ("ContextInstanceMixin", "DataMixin")
|
||||
import contextvars
|
||||
from typing import Any, ClassVar, Dict, Generic, Optional, TypeVar, cast, overload
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
__all__ = ("ContextInstanceMixin", "DataMixin")
|
||||
|
||||
|
||||
class DataMixin:
|
||||
@property
|
||||
|
|
@ -56,18 +48,24 @@ class ContextInstanceMixin(Generic[ContextInstance]):
|
|||
def get_current(cls) -> Optional[ContextInstance]: # pragma: no cover
|
||||
...
|
||||
|
||||
@overload # noqa: F811, it's overload, not redefinition
|
||||
@overload
|
||||
@classmethod
|
||||
def get_current(cls, no_error: Literal[True]) -> Optional[ContextInstance]: # pragma: no cover # noqa: F811
|
||||
def get_current( # noqa: F811
|
||||
cls, no_error: Literal[True]
|
||||
) -> Optional[ContextInstance]: # pragma: no cover
|
||||
...
|
||||
|
||||
@overload # noqa: F811, it's overload, not redefinition
|
||||
@overload
|
||||
@classmethod
|
||||
def get_current(cls, no_error: Literal[False]) -> ContextInstance: # pragma: no cover # noqa: F811
|
||||
def get_current( # noqa: F811
|
||||
cls, no_error: Literal[False]
|
||||
) -> ContextInstance: # pragma: no cover
|
||||
...
|
||||
|
||||
@classmethod # noqa: F811, it's overload, not redefinition
|
||||
def get_current(cls, no_error: bool = True) -> Optional[ContextInstance]: # pragma: no cover # noqa: F811
|
||||
@classmethod
|
||||
def get_current( # noqa: F811
|
||||
cls, no_error: bool = True
|
||||
) -> Optional[ContextInstance]: # pragma: no cover
|
||||
# on mypy 0.770 I catch that contextvars.ContextVar always contextvars.ContextVar[Any]
|
||||
cls.__context_instance = cast(
|
||||
contextvars.ContextVar[ContextInstance], cls.__context_instance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue