Skip to content

Commit 14ab9dc

Browse files
committed
Refactor type resolution logic for vector fields to improve Pythonic style
1 parent 0d25c17 commit 14ab9dc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

aredis_om/model/model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,10 +2162,11 @@ def schema_for_type(
21622162
# a proper type, we can pull the type information from the origin of the first argument.
21632163
if not isinstance(typ, type):
21642164
type_args = typing_get_args(field_info.annotation)
2165-
if type_args and hasattr(type_args[0], "__origin__"):
2166-
typ = type_args[0].__origin__
2167-
else:
2168-
typ = type_args[0] if type_args else typ
2165+
typ = (
2166+
getattr(type_args[0], "__origin__", type_args[0])
2167+
if type_args
2168+
else typ
2169+
)
21692170

21702171
# TODO: GEO field
21712172
if is_vector and vector_options:

0 commit comments

Comments
 (0)