Skip to content

Commit

Permalink
convert string Nones to Nonetype
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeMoussalli committed Oct 16, 2023
1 parent 3c6fef4 commit 1586d2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/fondant/component_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,22 @@ def outputs_additional_subsets(self) -> bool:

@property
def args(self) -> t.Mapping[str, Argument]:
def _get_default(argument_info):
if "default" in argument_info:
if argument_info["default"] == "None":
return None
return argument_info["default"]

return None

args = self.default_arguments
args.update(
{
name: Argument(
name=name,
description=arg_info["description"],
type=arg_info["type"],
default=arg_info["default"] if "default" in arg_info else None,
default=_get_default(arg_info),
optional=arg_info.get("default") == "None",
)
for name, arg_info in self._specification.get("args", {}).items()
Expand Down
2 changes: 1 addition & 1 deletion src/fondant/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _add_and_parse_args(cls, spec: ComponentSpec):
elif arg.default is not None and arg.optional is False:
input_required = False
default = arg.default
elif arg.default is not None and arg.optional is True:
elif arg.default is None and arg.optional is True:
input_required = False
default = None
else:
Expand Down

0 comments on commit 1586d2e

Please sign in to comment.