-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process functions: Add serialization for Python base type defaults
As of 0680209, process functions will automatically add the `to_aiida_type` serializer for arguments such that Python base types are automatically converted to the corresponding AiiDA data type if not already a `Data` instance. The same was not added for defaults however, so if a user defined a calcfunction with a Python base type default, an exception would be raised once the dynamic `FunctionProcess` would be constructed. The default would be passed to the `InputPort` constructor as is and so would not validate against the type check. Here we update the dynamic process spec generation to detect if a default is provided for an argument and if so serialize it to the node equivalent. Note that this is done indirectly through a lambda as using constructed node instances as defaults in process specs can cause issues for example when the spec is exposed into another process spec, the ports are deep copied, including the defaults of the ports and deep copying of data nodes is not supported.
- Loading branch information
Showing
3 changed files
with
74 additions
and
3 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