From 9f0955da21f5db0ddc69343da5310d4d655ab7c2 Mon Sep 17 00:00:00 2001 From: pyiron-runner Date: Mon, 29 Apr 2024 22:10:44 +0000 Subject: [PATCH] Format black --- pyiron_workflow/function.py | 6 +++--- pyiron_workflow/io_preview.py | 12 ++++++++++-- pyiron_workflow/macro.py | 9 ++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/pyiron_workflow/function.py b/pyiron_workflow/function.py index 6f749bb3..18cc5198 100644 --- a/pyiron_workflow/function.py +++ b/pyiron_workflow/function.py @@ -371,6 +371,7 @@ def decorator(node_function): factory_made._class_returns_from_decorated_function = node_function factory_made.preview_io() return factory_made + return decorator @@ -379,16 +380,15 @@ def function_node( *node_args, output_labels=None, validate_output_labels=True, - **node_kwargs + **node_kwargs, ): if output_labels is None: output_labels = () elif isinstance(output_labels, str): output_labels = (output_labels,) - function_node_factory.clear(node_function.__name__) # Force a fresh class + function_node_factory.clear(node_function.__name__) # Force a fresh class factory_made = function_node_factory( node_function, validate_output_labels, *output_labels ) factory_made.preview_io() return factory_made(*node_args, **node_kwargs) - diff --git a/pyiron_workflow/io_preview.py b/pyiron_workflow/io_preview.py index c6f21773..6f692077 100644 --- a/pyiron_workflow/io_preview.py +++ b/pyiron_workflow/io_preview.py @@ -19,7 +19,13 @@ from textwrap import dedent from types import FunctionType from typing import ( - Any, ClassVar, get_args, get_type_hints, Literal, Optional, TYPE_CHECKING + Any, + ClassVar, + get_args, + get_type_hints, + Literal, + Optional, + TYPE_CHECKING, ) from pyiron_workflow.channels import InputData, NOT_DATA @@ -134,7 +140,9 @@ def _io_defining_function(cls) -> callable: _output_labels: ClassVar[tuple[str] | None] = None # None: scrape them _validate_output_labels: ClassVar[bool] = True # True: validate against source code - _io_defining_function_uses_self: ClassVar[bool] = False # False: use entire signature + _io_defining_function_uses_self: ClassVar[bool] = ( + False # False: use entire signature + ) @classmethod def _build_inputs_preview(cls): diff --git a/pyiron_workflow/macro.py b/pyiron_workflow/macro.py index fbbdabfa..4c3727ba 100644 --- a/pyiron_workflow/macro.py +++ b/pyiron_workflow/macro.py @@ -472,7 +472,8 @@ def __setstate__(self, state): @classfactory -def macro_node_factory(graph_creator: callable, validate_output_labels: bool, /, *output_labels +def macro_node_factory( + graph_creator: callable, validate_output_labels: bool, /, *output_labels ): return ( graph_creator.__name__, @@ -496,6 +497,7 @@ def decorator(node_function): factory_made._class_returns_from_decorated_function = node_function factory_made.preview_io() return factory_made + return decorator @@ -504,19 +506,20 @@ def macro_node( *node_args, output_labels=None, validate_output_labels=True, - **node_kwargs + **node_kwargs, ): if output_labels is None: output_labels = () elif isinstance(output_labels, str): output_labels = (output_labels,) - macro_node_factory.clear(node_function.__name__) # Force a fresh class + macro_node_factory.clear(node_function.__name__) # Force a fresh class factory_made = macro_node_factory( node_function, validate_output_labels, *output_labels ) factory_made.preview_io() return factory_made(*node_args, **node_kwargs) + # as_macro_node = decorated_node_decorator_factory( # Macro, # Macro.graph_creator,