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 a8ab054
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rdfproxy/utils/mapper_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ 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:
"""Todo: this is clearly buggy. fix for actual implemenation."""
if obj is None:
return True
elif _is_list_type(obj):
return False
elif args := get_args(obj):
return all(_is_scalar_type(o) for o in args)
else:
return not issubclass(obj, BaseModel)


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

0 comments on commit a8ab054

Please sign in to comment.