forked from aiidateam/aiida-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process functions: Support class member functions as process functions
The `FunctionProcess` class that is generated dynamically from the process function signature used the function's `__name__` attribute to construct the new dynamic type. This prevented process functions from being defined as class member methods. By using `__qualname__` instead, this is now enabled and allows for example the following: class CalcFunctionWorkChain(WorkChain): @classmethod def define(cls, spec): super().define(spec) spec.input('x') spec.input('y') spec.output('sum') spec.outline( cls.run_compute_sum, ) @staticmethod @calcfunction def compute_sum(x, y): return x + y def run_compute_sum(self): self.out('sum', self.compute_sum(self.inputs.x, self.inputs.y)) The changes also allow these class member process functions to be valid cache sources.
- Loading branch information
Showing
3 changed files
with
22 additions
and
10 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