mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fixed pydantic.errors.ConfigError due to unresolved LazyProxy type
This commit is contained in:
parent
76ae5c4415
commit
81b0fe5404
1 changed files with 11 additions and 2 deletions
|
|
@ -5,8 +5,17 @@ from pydantic import root_validator
|
|||
from aiogram.dispatcher.filters import BaseFilter
|
||||
from aiogram.types import CallbackQuery, InlineQuery, Message, Poll
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from aiogram.utils.i18n.lazy_proxy import LazyProxy
|
||||
try:
|
||||
from babel.support import LazyProxy
|
||||
except ImportError: # pragma: no cover
|
||||
|
||||
class LazyProxy: # type: ignore
|
||||
def __init__(self, func: Any, *args: Any, **kwargs: Any) -> None:
|
||||
raise RuntimeError(
|
||||
"LazyProxy can be used only when Babel installed\n"
|
||||
"Just install Babel (`pip install Babel`) "
|
||||
"or aiogram with i18n support (`pip install aiogram[i18n]`)"
|
||||
)
|
||||
|
||||
TextType = Union[str, "LazyProxy"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue