mirror of
https://github.com/PaiGramTeam/sqlmodel.git
synced 2024-11-21 22:58:22 +00:00
add type hints for func is_optional_or_union
This commit is contained in:
parent
a0b84c574d
commit
fa8902c778
@ -442,7 +442,7 @@ def get_sqlalchemy_type(field: FieldInfo) -> Any:
|
||||
type_: Optional[type] = field.annotation
|
||||
|
||||
# Resolve Optional/Union fields
|
||||
def is_optional_or_union(type_):
|
||||
def is_optional_or_union(type_: Optional[type]) -> bool:
|
||||
if sys.version_info >= (3, 10):
|
||||
return get_origin(type_) in (types.UnionType, Union)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user