|
52 | 52 | from sqlalchemy.orm.instrumentation import is_instrumented |
53 | 53 | from sqlalchemy.sql.schema import MetaData |
54 | 54 | from sqlalchemy.sql.sqltypes import LargeBinary, Time, Uuid |
55 | | -from typing_extensions import Literal, deprecated, get_origin |
| 55 | +from typing_extensions import Literal, TypeAlias, deprecated, get_origin |
56 | 56 |
|
57 | 57 | from ._compat import ( # type: ignore[attr-defined] |
58 | 58 | IS_PYDANTIC_V2, |
|
90 | 90 |
|
91 | 91 | _T = TypeVar("_T") |
92 | 92 | NoArgAnyCallable = Callable[[], Any] |
93 | | -IncEx = Union[Set[int], Set[str], Dict[int, Any], Dict[str, Any], None] |
| 93 | +IncEx: TypeAlias = Union[ |
| 94 | + Set[int], |
| 95 | + Set[str], |
| 96 | + Mapping[int, Union["IncEx", Literal[True]]], |
| 97 | + Mapping[str, Union["IncEx", Literal[True]]], |
| 98 | +] |
94 | 99 | OnDeleteType = Literal["CASCADE", "SET NULL", "RESTRICT"] |
95 | 100 |
|
96 | 101 |
|
@@ -858,8 +863,8 @@ def model_dump( |
858 | 863 | self, |
859 | 864 | *, |
860 | 865 | mode: Union[Literal["json", "python"], str] = "python", |
861 | | - include: IncEx = None, |
862 | | - exclude: IncEx = None, |
| 866 | + include: Union[IncEx, None] = None, |
| 867 | + exclude: Union[IncEx, None] = None, |
863 | 868 | context: Union[Dict[str, Any], None] = None, |
864 | 869 | by_alias: bool = False, |
865 | 870 | exclude_unset: bool = False, |
@@ -908,8 +913,8 @@ def model_dump( |
908 | 913 | def dict( |
909 | 914 | self, |
910 | 915 | *, |
911 | | - include: IncEx = None, |
912 | | - exclude: IncEx = None, |
| 916 | + include: Union[IncEx, None] = None, |
| 917 | + exclude: Union[IncEx, None] = None, |
913 | 918 | by_alias: bool = False, |
914 | 919 | exclude_unset: bool = False, |
915 | 920 | exclude_defaults: bool = False, |
|
0 commit comments