mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
#1579 Fixed Default object annotation resolution in pydantic models. Reformat code.
This commit is contained in:
parent
a76fb42ba0
commit
fd991c0710
4 changed files with 8 additions and 4 deletions
1
CHANGES/1579.bugfix.rst
Normal file
1
CHANGES/1579.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fixed `Default` object annotation resolution using `pydantic`
|
||||
|
|
@ -162,6 +162,7 @@ from .paid_media import PaidMedia
|
|||
from .paid_media_info import PaidMediaInfo
|
||||
from .paid_media_photo import PaidMediaPhoto
|
||||
from .paid_media_preview import PaidMediaPreview
|
||||
from .paid_media_purchased import PaidMediaPurchased
|
||||
from .paid_media_video import PaidMediaVideo
|
||||
from .passport_data import PassportData
|
||||
from .passport_element_error import PassportElementError
|
||||
|
|
@ -233,7 +234,6 @@ from .web_app_data import WebAppData
|
|||
from .web_app_info import WebAppInfo
|
||||
from .webhook_info import WebhookInfo
|
||||
from .write_access_allowed import WriteAccessAllowed
|
||||
from .paid_media_purchased import PaidMediaPurchased
|
||||
|
||||
__all__ = (
|
||||
"Animation",
|
||||
|
|
@ -473,6 +473,8 @@ __all__ = (
|
|||
"WriteAccessAllowed",
|
||||
)
|
||||
|
||||
from ..client.default import Default as _Default
|
||||
|
||||
# Load typing forward refs for every TelegramObject
|
||||
for _entity_name in __all__:
|
||||
_entity = globals()[_entity_name]
|
||||
|
|
@ -484,6 +486,7 @@ for _entity_name in __all__:
|
|||
"Optional": Optional,
|
||||
"Union": Union,
|
||||
"Literal": Literal,
|
||||
"Default": _Default,
|
||||
**{k: v for k, v in globals().items() if k in __all__},
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING, Any, Optional, cast
|
||||
|
||||
from .base import TelegramObject
|
||||
from ..utils.mypy_hacks import lru_cache
|
||||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .business_connection import BusinessConnection
|
||||
|
|
@ -18,11 +18,11 @@ if TYPE_CHECKING:
|
|||
from .message import Message
|
||||
from .message_reaction_count_updated import MessageReactionCountUpdated
|
||||
from .message_reaction_updated import MessageReactionUpdated
|
||||
from .paid_media_purchased import PaidMediaPurchased
|
||||
from .poll import Poll
|
||||
from .poll_answer import PollAnswer
|
||||
from .pre_checkout_query import PreCheckoutQuery
|
||||
from .shipping_query import ShippingQuery
|
||||
from .paid_media_purchased import PaidMediaPurchased
|
||||
|
||||
|
||||
class Update(TelegramObject):
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ from aiogram.types import (
|
|||
Message,
|
||||
MessageReactionCountUpdated,
|
||||
MessageReactionUpdated,
|
||||
PaidMediaPurchased,
|
||||
Poll,
|
||||
PollAnswer,
|
||||
PollOption,
|
||||
|
|
@ -42,7 +43,6 @@ from aiogram.types import (
|
|||
ShippingQuery,
|
||||
Update,
|
||||
User,
|
||||
PaidMediaPurchased,
|
||||
)
|
||||
from aiogram.types.error_event import ErrorEvent
|
||||
from tests.mocked_bot import MockedBot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue