From 84e2f9739181eacc5bdf2406e5036512e408754a Mon Sep 17 00:00:00 2001 From: pyiron-runner Date: Mon, 18 Mar 2024 03:06:00 +0000 Subject: [PATCH] Format black --- pympipool/__init__.py | 2 +- pympipool/shared/backend.py | 12 +++++++++--- pympipool/shared/executorbase.py | 4 +++- pympipool/shared/interface.py | 4 ++-- pympipool/shell/interactive.py | 7 ++++++- pympipool/slurm/executor.py | 2 +- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/pympipool/__init__.py b/pympipool/__init__.py index 1cb02f5f..e6f9a995 100644 --- a/pympipool/__init__.py +++ b/pympipool/__init__.py @@ -77,7 +77,7 @@ def __init__( init_function: callable = None, cwd: str = None, executor=None, - hostname_localhost: bool =False, + hostname_localhost: bool = False, ): # Use __new__() instead of __init__(). This function is only implemented to enable auto-completion. pass diff --git a/pympipool/shared/backend.py b/pympipool/shared/backend.py index e8d00b07..c49e45eb 100644 --- a/pympipool/shared/backend.py +++ b/pympipool/shared/backend.py @@ -1,7 +1,9 @@ import inspect -def call_funct(input_dict: dict, funct: callable = None, memory: dict = None) -> callable: +def call_funct( + input_dict: dict, funct: callable = None, memory: dict = None +) -> callable: """ Call function from dictionary @@ -50,7 +52,9 @@ def parse_arguments(argument_lst: list[str]) -> dict: ) -def update_default_dict_from_arguments(argument_lst: list[str], argument_dict: dict, default_dict: dict) -> dict: +def update_default_dict_from_arguments( + argument_lst: list[str], argument_dict: dict, default_dict: dict +) -> dict: default_dict.update( { k: argument_lst[argument_lst.index(v) + 1] @@ -61,7 +65,9 @@ def update_default_dict_from_arguments(argument_lst: list[str], argument_dict: d return default_dict -def _update_dict_delta(dict_input: dict, dict_output: dict, keys_possible_lst: list) -> dict: +def _update_dict_delta( + dict_input: dict, dict_output: dict, keys_possible_lst: list +) -> dict: return { k: v for k, v in dict_input.items() diff --git a/pympipool/shared/executorbase.py b/pympipool/shared/executorbase.py index dda07152..d43a98e6 100644 --- a/pympipool/shared/executorbase.py +++ b/pympipool/shared/executorbase.py @@ -200,7 +200,9 @@ def execute_parallel_tasks( ) -def execute_parallel_tasks_loop(interface, future_queue: queue.Queue, init_function: callable = None): +def execute_parallel_tasks_loop( + interface, future_queue: queue.Queue, init_function: callable = None +): if init_function is not None: interface.send_dict( input_dict={"init": True, "fn": init_function, "args": (), "kwargs": {}} diff --git a/pympipool/shared/interface.py b/pympipool/shared/interface.py index c7cfe9d1..a7365524 100644 --- a/pympipool/shared/interface.py +++ b/pympipool/shared/interface.py @@ -76,7 +76,7 @@ def __init__( threads_per_core: int = 1, gpus_per_core: int = 0, oversubscribe: bool = False, - command_line_argument_lst: list[str] = [], + command_line_argument_lst: list[str] = [], ): super().__init__( cwd=cwd, @@ -101,7 +101,7 @@ def generate_command(self, command_lst: list[str]) -> list[str]: ) -def generate_mpiexec_command(cores: int, oversubscribe: bool=False) -> list[str]: +def generate_mpiexec_command(cores: int, oversubscribe: bool = False) -> list[str]: if cores == 1: return [] else: diff --git a/pympipool/shell/interactive.py b/pympipool/shell/interactive.py index e02fe6b8..7615ac18 100644 --- a/pympipool/shell/interactive.py +++ b/pympipool/shell/interactive.py @@ -119,7 +119,12 @@ def __init__(self, *args, **kwargs): ) self._future_queue.put({"init": True, "args": args, "kwargs": kwargs}) - def submit(self, string_input: str, lines_to_read: int = None, stop_read_pattern: str = None): + def submit( + self, + string_input: str, + lines_to_read: int = None, + stop_read_pattern: str = None, + ): """ Submit the input as a string to the executable. In addition to the input the ShellExecutor also needs a measure to identify the completion of the execution. This can either be provided based on the number of lines to read diff --git a/pympipool/slurm/executor.py b/pympipool/slurm/executor.py index e3ebf668..c28ecf4a 100644 --- a/pympipool/slurm/executor.py +++ b/pympipool/slurm/executor.py @@ -60,7 +60,7 @@ def __init__( init_function: callable = None, cwd: str = None, hostname_localhost: bool = False, - command_line_argument_lst: list[str] = [], + command_line_argument_lst: list[str] = [], ): super().__init__() self._set_process(