Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sequence instead of list in init_beanie #1015

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions beanie/odm/utils/init.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import asyncio
import sys

from typing_extensions import Sequence, get_args, get_origin

07pepa marked this conversation as resolved.
Show resolved Hide resolved
from beanie.odm.utils.pydantic import (
IS_PYDANTIC_V2,
get_extra_field_info,
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading