Skip to content

Commit

Permalink
fix: add additional case to _is_scalar_type
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-pl committed Feb 10, 2025
1 parent bfa4c8b commit 63ec35f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rdfproxy/utils/mapper_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ def _is_list_type(obj: type | None) -> bool:
return _is_type(obj, list)


def _is_scalar_type(t) -> bool:
return (not _is_list_type(t)) and (not issubclass(t, BaseModel))
def _is_scalar_type(obj) -> bool:
if obj is None:
return True
elif args := get_args(obj):
return all(_is_scalar_type(o) for o in args)
else:
return (not _is_list_type(obj)) and (not issubclass(obj, BaseModel))


def _is_list_basemodel_type(obj: type | None) -> bool:
Expand Down

0 comments on commit 63ec35f

Please sign in to comment.