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
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
fixes #911
  • Loading branch information
07pepa committed Sep 14, 2024
commit 12d90e637233d1f4eb1fba76107c7f96316ac945
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,
@@ -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,
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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]
Loading