We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When passing parameters to the decorator, we define some nonlocal variables, this make the codes not clean. e.g., task_type.
task_type
class TaskDecoratorCollection: """Collection of task decorators.""" # decorator with arguments indentifier, args, kwargs, properties, inputs, outputs, executor @staticmethod @nonfunctional_usage def decorator_task( identifier: Optional[str] = None, task_type: str = "Normal", properties: Optional[List[Tuple[str, str]]] = None, inputs: Optional[List[Tuple[str, str]]] = None, outputs: Optional[List[Tuple[str, str]]] = None, catalog: str = "Others", ) -> Callable: """Generate a decorator that register a function as a task. Attributes: indentifier (str): task identifier catalog (str): task catalog args (list): task args kwargs (dict): task kwargs properties (list): task properties inputs (list): task inputs outputs (list): task outputs """ def decorator(func): nonlocal identifier, task_type if identifier is None: identifier = func.__name__ # Determine task_type based on AiiDA's node classes task_type = task_type if hasattr(func, "node_class"): task_type = task_types.get(func.node_class, task_type)```
use another name.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When passing parameters to the decorator, we define some nonlocal variables, this make the codes not clean.
e.g.,
task_type
.Simple solution
use another name.
The text was updated successfully, but these errors were encountered: