Skip to content

Commit

Permalink
fix: use Annotated from typing_extensions for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Dec 11, 2023
1 parent bb2b6ec commit f6689da
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/img/internals.excalidraw
Original file line number Diff line number Diff line change
Expand Up @@ -4157,4 +4157,4 @@
"viewBackgroundColor": "#ffffff"
},
"files": {}
}
}
4 changes: 2 additions & 2 deletions odmantic/bson.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Annotated, Any, Callable, Pattern, Sequence, Tuple, Type, Union
from typing import Any, Callable, Pattern, Sequence, Tuple, Type, Union

import bson
import bson.binary
Expand All @@ -15,7 +15,7 @@
from pydantic.main import BaseModel
from pydantic_core import core_schema

from odmantic.typing import get_args, get_origin, lenient_issubclass
from odmantic.typing import Annotated, get_args, get_origin


@dataclass(frozen=True)
Expand Down
2 changes: 1 addition & 1 deletion odmantic/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
_eval_type,
)

from typing_extensions import TypeAlias
from typing_extensions import Annotated, TypeAlias

if TYPE_CHECKING:
NoArgAnyCallable: TypeAlias = TypingCallable[[], Any]
Expand Down
14 changes: 2 additions & 12 deletions tests/integration/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@
import re
from datetime import datetime
from decimal import Decimal
from typing import (
Annotated,
Any,
Dict,
Generic,
List,
Pattern,
Tuple,
Type,
TypeVar,
Union,
)
from typing import Any, Dict, Generic, List, Pattern, Tuple, Type, TypeVar, Union

import pytest
from bson import Binary, Decimal128, Int64, ObjectId, Regex
Expand All @@ -23,6 +12,7 @@
from odmantic.bson import WithBsonSerializer
from odmantic.engine import AIOEngine, SyncEngine
from odmantic.model import Model
from odmantic.typing import Annotated

pytestmark = pytest.mark.asyncio

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_bson_fields.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
from datetime import datetime
from decimal import Decimal
from typing import Annotated, Pattern
from typing import Pattern

import pytest
import pytz
Expand All @@ -13,6 +13,7 @@
from odmantic.bson import WithBsonSerializer
from odmantic.field import Field
from odmantic.model import Model
from odmantic.typing import Annotated

pytestmark = pytest.mark.asyncio

Expand Down

0 comments on commit f6689da

Please sign in to comment.