-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow the definition of
None
as default in process functions (#2582)
It was impossible to define a process function with a keyword argument that had `None` as default, because the dynamically created ports always only specified `orm.Data` as valid types. So the validation of the default value would fail during the spec definition. Here we detect if `None` is passed as the default in the function signature, in which case we define the tuple of `orm.Data` and `type(None)` to be a valid type. Note that we need to use `type(None)` because the port validation later on will call `isinstance(input, valid_types)` which will not work if one of the values in `valid_types` is simply `None`. The `Process._setup_inputs` had to be adjusted to skip values of `None` because they cannot be linked to obviously but they can now potentially be passed as inputs to a `Process`.
- Loading branch information
Showing
3 changed files
with
70 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters