diff --git a/src/python_workflow_definition/_version.py b/src/python_workflow_definition/_version.py index 0e58bba..1a870a8 100644 --- a/src/python_workflow_definition/_version.py +++ b/src/python_workflow_definition/_version.py @@ -5,8 +5,7 @@ TYPE_CHECKING = False if TYPE_CHECKING: - from typing import Tuple - from typing import Union + from typing import Tuple, Union VERSION_TUPLE = Tuple[Union[int, str], ...] else: diff --git a/src/python_workflow_definition/aiida.py b/src/python_workflow_definition/aiida.py index 680b71b..8146f16 100644 --- a/src/python_workflow_definition/aiida.py +++ b/src/python_workflow_definition/aiida.py @@ -1,25 +1,26 @@ -from importlib import import_module import traceback +from dataclasses import replace +from importlib import import_module from aiida import orm from aiida_pythonjob.data.serializer import general_serializer -from aiida_workgraph import WorkGraph, task, Task, namespace +from aiida_workgraph import Task, WorkGraph, namespace, task from aiida_workgraph.socket import TaskSocketNamespace -from dataclasses import replace from node_graph.task_spec import SchemaSource + from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow from python_workflow_definition.shared import ( - convert_nodes_list_to_dict, - update_node_names, - set_result_node, - NODES_LABEL, EDGES_LABEL, + NODES_LABEL, SOURCE_LABEL, SOURCE_PORT_LABEL, TARGET_LABEL, TARGET_PORT_LABEL, - VERSION_NUMBER, VERSION_LABEL, + VERSION_NUMBER, + convert_nodes_list_to_dict, + set_result_node, + update_node_names, ) diff --git a/src/python_workflow_definition/cwl/__init__.py b/src/python_workflow_definition/cwl/__init__.py index eafa1af..6bc8d32 100644 --- a/src/python_workflow_definition/cwl/__init__.py +++ b/src/python_workflow_definition/cwl/__init__.py @@ -1,21 +1,19 @@ import json import pickle -from yaml import CDumper as Dumper, dump +from yaml import CDumper as Dumper +from yaml import dump -from python_workflow_definition.purepython import ( - group_edges, - resort_total_lst, -) +from python_workflow_definition.purepython import group_edges, resort_total_lst from python_workflow_definition.shared import ( - convert_nodes_list_to_dict, - remove_result, EDGES_LABEL, NODES_LABEL, - TARGET_LABEL, - TARGET_PORT_LABEL, SOURCE_LABEL, SOURCE_PORT_LABEL, + TARGET_LABEL, + TARGET_PORT_LABEL, + convert_nodes_list_to_dict, + remove_result, ) diff --git a/src/python_workflow_definition/cwl/__main__.py b/src/python_workflow_definition/cwl/__main__.py index ec1c6c4..f9b7651 100644 --- a/src/python_workflow_definition/cwl/__main__.py +++ b/src/python_workflow_definition/cwl/__main__.py @@ -1,7 +1,7 @@ -import sys +import importlib.util import pickle +import sys from ast import literal_eval -import importlib.util def load_function(file_name, funct): diff --git a/src/python_workflow_definition/executorlib.py b/src/python_workflow_definition/executorlib.py index b082b75..99ab921 100644 --- a/src/python_workflow_definition/executorlib.py +++ b/src/python_workflow_definition/executorlib.py @@ -2,21 +2,20 @@ from importlib import import_module from inspect import isfunction - from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow +from python_workflow_definition.purepython import group_edges, resort_total_lst from python_workflow_definition.shared import ( + EDGES_LABEL, + NODES_LABEL, + SOURCE_LABEL, + SOURCE_PORT_LABEL, + convert_nodes_list_to_dict, get_dict, - get_list, get_kwargs, + get_list, get_source_handles, - convert_nodes_list_to_dict, remove_result, - NODES_LABEL, - EDGES_LABEL, - SOURCE_LABEL, - SOURCE_PORT_LABEL, ) -from python_workflow_definition.purepython import resort_total_lst, group_edges def get_item(obj, key): diff --git a/src/python_workflow_definition/jobflow.py b/src/python_workflow_definition/jobflow.py index 4a39490..057762d 100644 --- a/src/python_workflow_definition/jobflow.py +++ b/src/python_workflow_definition/jobflow.py @@ -2,26 +2,26 @@ from inspect import isfunction import numpy as np -from jobflow import job, Flow +from jobflow import Flow, job from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow from python_workflow_definition.shared import ( - get_dict, - get_list, - get_kwargs, - get_source_handles, - update_node_names, - convert_nodes_list_to_dict, - remove_result, - set_result_node, - NODES_LABEL, EDGES_LABEL, + NODES_LABEL, SOURCE_LABEL, SOURCE_PORT_LABEL, TARGET_LABEL, TARGET_PORT_LABEL, - VERSION_NUMBER, VERSION_LABEL, + VERSION_NUMBER, + convert_nodes_list_to_dict, + get_dict, + get_kwargs, + get_list, + get_source_handles, + remove_result, + set_result_node, + update_node_names, ) diff --git a/src/python_workflow_definition/models.py b/src/python_workflow_definition/models.py index 8b25be8..6ddb583 100644 --- a/src/python_workflow_definition/models.py +++ b/src/python_workflow_definition/models.py @@ -1,19 +1,16 @@ +import json +import logging from pathlib import Path -from typing import ( - List, - Union, - Optional, - Literal, - Any, - Annotated, - Type, - TypeVar, +from typing import Annotated, Any, List, Literal, Optional, Type, TypeVar, Union + +from pydantic import ( + BaseModel, + Field, + ValidationError, + field_serializer, + field_validator, ) from typing_extensions import TypeAliasType -from pydantic import BaseModel, Field, field_validator, field_serializer -from pydantic import ValidationError -import json -import logging logger = logging.getLogger(__name__) diff --git a/src/python_workflow_definition/plot.py b/src/python_workflow_definition/plot.py index b3d4953..afb8990 100644 --- a/src/python_workflow_definition/plot.py +++ b/src/python_workflow_definition/plot.py @@ -1,16 +1,15 @@ -from IPython.display import SVG, display import networkx as nx - +from IPython.display import SVG, display from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow from python_workflow_definition.purepython import group_edges from python_workflow_definition.shared import ( - get_kwargs, - convert_nodes_list_to_dict, - NODES_LABEL, EDGES_LABEL, + NODES_LABEL, SOURCE_LABEL, SOURCE_PORT_LABEL, + convert_nodes_list_to_dict, + get_kwargs, ) diff --git a/src/python_workflow_definition/purepython.py b/src/python_workflow_definition/purepython.py index d8af187..0741e6f 100644 --- a/src/python_workflow_definition/purepython.py +++ b/src/python_workflow_definition/purepython.py @@ -1,21 +1,20 @@ from importlib import import_module from inspect import isfunction - from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow from python_workflow_definition.shared import ( - get_dict, - get_list, - get_kwargs, - get_source_handles, - convert_nodes_list_to_dict, - remove_result, - NODES_LABEL, EDGES_LABEL, + NODES_LABEL, SOURCE_LABEL, SOURCE_PORT_LABEL, TARGET_LABEL, TARGET_PORT_LABEL, + convert_nodes_list_to_dict, + get_dict, + get_kwargs, + get_list, + get_source_handles, + remove_result, ) diff --git a/src/python_workflow_definition/pyiron_base.py b/src/python_workflow_definition/pyiron_base.py index 00cc2b1..324e348 100644 --- a/src/python_workflow_definition/pyiron_base.py +++ b/src/python_workflow_definition/pyiron_base.py @@ -3,25 +3,25 @@ from typing import Optional import numpy as np -from pyiron_base import job, Project +from pyiron_base import Project, job from pyiron_base.project.delayed import DelayedObject from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow from python_workflow_definition.shared import ( - get_kwargs, - get_source_handles, - convert_nodes_list_to_dict, - update_node_names, - remove_result, - set_result_node, - NODES_LABEL, EDGES_LABEL, + NODES_LABEL, SOURCE_LABEL, SOURCE_PORT_LABEL, TARGET_LABEL, TARGET_PORT_LABEL, - VERSION_NUMBER, VERSION_LABEL, + VERSION_NUMBER, + convert_nodes_list_to_dict, + get_kwargs, + get_source_handles, + remove_result, + set_result_node, + update_node_names, ) diff --git a/src/python_workflow_definition/pyiron_workflow.py b/src/python_workflow_definition/pyiron_workflow.py index b2f36b6..516f1ff 100644 --- a/src/python_workflow_definition/pyiron_workflow.py +++ b/src/python_workflow_definition/pyiron_workflow.py @@ -1,26 +1,26 @@ from collections import Counter -from inspect import isfunction from importlib import import_module +from inspect import isfunction from typing import Any import numpy as np -from pyiron_workflow import as_function_node, function_node, Workflow +from pyiron_workflow import Workflow, as_function_node, function_node from pyiron_workflow.api import Function from python_workflow_definition.models import PythonWorkflowDefinitionWorkflow from python_workflow_definition.shared import ( - get_dict, - update_node_names, - set_result_node, - remove_result, - NODES_LABEL, EDGES_LABEL, + NODES_LABEL, SOURCE_LABEL, SOURCE_PORT_LABEL, TARGET_LABEL, TARGET_PORT_LABEL, - VERSION_NUMBER, VERSION_LABEL, + VERSION_NUMBER, + get_dict, + remove_result, + set_result_node, + update_node_names, )