aiogram/aiogram/types/base.py
Alex Root Junior 4008a3114d
Upgrade architecture + 5.0 Bot API (#469)
Upgrade architecture + 5.0 Bot API (#469)
* Moved `methods`, `types` and `client` to root package
* Removed update handler from routers to dispatcher
* Reworked events propagation mechanism to handlers
* Reworked inner middlewares logic (very small change)
* Updated to Bot API 5.0
* Initial migration from MkDocs to Sphinx + config for readthedocs
2021-01-26 21:20:52 +02:00

28 lines
750 B
Python

import datetime
from typing import Any
from unittest.mock import sentinel
from pydantic import BaseModel, Extra
from aiogram.utils.mixins import ContextInstanceMixin
class TelegramObject(ContextInstanceMixin["TelegramObject"], BaseModel):
class Config:
use_enum_values = True
orm_mode = True
extra = Extra.allow
validate_assignment = True
allow_mutation = False
allow_population_by_field_name = True
json_encoders = {datetime.datetime: lambda dt: int(dt.timestamp())}
class MutableTelegramObject(TelegramObject):
class Config:
allow_mutation = True
UNSET: Any = (
sentinel.UNSET
) # special sentinel object which used in sutuation when None might be a useful value