diff --git a/beanie/odm/utils/init.py b/beanie/odm/utils/init.py index c64cc9a0..4586f881 100644 --- a/beanie/odm/utils/init.py +++ b/beanie/odm/utils/init.py @@ -1,6 +1,8 @@ import asyncio import sys +from typing_extensions import Sequence, get_args, get_origin + from beanie.odm.utils.pydantic import ( IS_PYDANTIC_V2, get_extra_field_info, @@ -9,11 +11,6 @@ ) from beanie.odm.utils.typing import get_index_attributes -if sys.version_info >= (3, 8): - from typing import get_args, get_origin -else: - from typing_extensions import get_args, get_origin - if sys.version_info >= (3, 10): from types import UnionType as TypesUnionType else: @@ -65,7 +62,7 @@ def __init__( database: AsyncIOMotorDatabase = None, connection_string: Optional[str] = None, document_models: Optional[ - List[ + Sequence[ Union[Type["DocType"], Type["UnionDocType"], Type["View"], str] ] ] = None, @@ -761,7 +758,7 @@ async def init_beanie( database: AsyncIOMotorDatabase = None, connection_string: Optional[str] = None, document_models: Optional[ - List[Union[Type[Document], Type[UnionDoc], Type["View"], str]] + Sequence[Union[Type[Document], Type[UnionDoc], Type["View"], str]] ] = None, allow_index_dropping: bool = False, recreate_views: bool = False, diff --git a/pyproject.toml b/pyproject.toml index fed8fb1d..e2c59385 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dependencies = [ "click>=7", "toml", "lazy-model==0.2.0", - "typing-extensions>=4.7; python_version < '3.11'", + "typing-extensions>=4.7", ] [project.optional-dependencies]