From 84274b98f994fdf31b41a6db1538d65c40ccd8ef Mon Sep 17 00:00:00 2001 From: Jon Clucas Date: Wed, 17 Jul 2024 16:20:19 -0400 Subject: [PATCH] :recycle: Move `_config_lookup` method into `ResourcePool` --- CPAC/pipeline/engine/resource.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CPAC/pipeline/engine/resource.py b/CPAC/pipeline/engine/resource.py index cb3166a3cd..f0b291644d 100644 --- a/CPAC/pipeline/engine/resource.py +++ b/CPAC/pipeline/engine/resource.py @@ -406,13 +406,6 @@ def json_outdir_ingress( return json_info, pipe_idx, node_name, data_label - def _config_lookup(self, keylist, fallback_type: type = NoneType) -> Any: - """Lookup a config key, return None if not found.""" - try: - return self.cfg[keylist] - except (AttributeError, KeyError): - return fallback_type() - @staticmethod def generate_prov_string(prov: LIST_OF_LIST_OF_STR | tuple) -> tuple[str, str]: """Generate a string from a SINGLE RESOURCE'S dictionary of MULTIPLE PRECEDING RESOURCES (or single, if just one). @@ -2962,6 +2955,15 @@ def get_resource_strats_from_prov(prov: list | str) -> dict[str, list | str]: strat_resource[resource] = entry return strat_resource + def _config_lookup( + self, keylist: str | list[str], fallback_type: type = NoneType + ) -> Any: + """Lookup a config key, return None if not found.""" + try: + return self.cfg[keylist] + except (AttributeError, KeyError): + return fallback_type() + def _get_pipe_number(self, pipe_idx: str | tuple) -> int: """Return the index of a strategy in ``self.pipe_list``.""" return self.pipe_list.index(pipe_idx)