Skip to content

Commit

Permalink
Allow null default values, and unify dtype storage
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-shunned committed Sep 16, 2024
1 parent 8a22c48 commit f011ba7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions aiod_registry/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ def extract_arg_type(self):
self._dtype = type(self.value[0])
else:
self._dtype = type(self.value)
# If None, we need a dtype to poss cast to when dealing with GUIs
if self.value is None:
if self.dtype is None:
raise ValueError(
f"Parameter {self.name} needs a dtype if default value is None!"
)
else:
if getattr(builtins, self.dtype, None) is None:
raise ValueError(
f"Parameter {self.name} has an invalid dtype ({self.dtype})!"
)
else:
self.dtype = self._dtype
return self


Expand Down

0 comments on commit f011ba7

Please sign in to comment.