diff --git a/src/stpipe/cli/__init__.py b/src/stpipe/cli/__init__.py index e200cf1d..41af4544 100644 --- a/src/stpipe/cli/__init__.py +++ b/src/stpipe/cli/__init__.py @@ -2,6 +2,7 @@ Support for the new 'stpipe' CLI (see stpipe.cmdline for the implementation of 'strun'). """ + from .main import handle_args __all__ = ["handle_args"] diff --git a/src/stpipe/cli/list.py b/src/stpipe/cli/list.py index 43616c60..64c57cbd 100644 --- a/src/stpipe/cli/list.py +++ b/src/stpipe/cli/list.py @@ -2,6 +2,7 @@ Implements the 'stpipe list' command, which lists available Step subclasses. """ + import argparse import re import sys diff --git a/src/stpipe/cli/main.py b/src/stpipe/cli/main.py index 290503e0..1790dd09 100644 --- a/src/stpipe/cli/main.py +++ b/src/stpipe/cli/main.py @@ -1,6 +1,7 @@ """ Main function and argument parser for stpipe. """ + import argparse import sys import traceback diff --git a/src/stpipe/cmdline.py b/src/stpipe/cmdline.py index ce90af4c..27359517 100644 --- a/src/stpipe/cmdline.py +++ b/src/stpipe/cmdline.py @@ -1,6 +1,7 @@ """ Various utilities to handle running Steps from the commandline. """ + import io import os import os.path diff --git a/src/stpipe/config.py b/src/stpipe/config.py index 15d24031..43a77de2 100644 --- a/src/stpipe/config.py +++ b/src/stpipe/config.py @@ -3,6 +3,7 @@ will eventually fully replace config_parser.py, but we'll need to maintain both until we replace configobj with traitlets. """ + from copy import deepcopy from datetime import datetime, timezone diff --git a/src/stpipe/config_parser.py b/src/stpipe/config_parser.py index 0218edac..cb1af2a1 100644 --- a/src/stpipe/config_parser.py +++ b/src/stpipe/config_parser.py @@ -1,6 +1,7 @@ """ Our configuration files are ConfigObj/INI files. """ + import logging import os import os.path diff --git a/src/stpipe/crds_client.py b/src/stpipe/crds_client.py index 2e48b517..5ef1e9c7 100644 --- a/src/stpipe/crds_client.py +++ b/src/stpipe/crds_client.py @@ -7,6 +7,7 @@ directly in modules other than this crds_client so that dependency order and general integration can be managed here. """ + import re import crds diff --git a/src/stpipe/format_template.py b/src/stpipe/format_template.py index 2c016c4e..b7b6de54 100644 --- a/src/stpipe/format_template.py +++ b/src/stpipe/format_template.py @@ -2,6 +2,7 @@ Format template string allowing partial formatting. """ + from collections import defaultdict from string import Formatter diff --git a/src/stpipe/function_wrapper.py b/src/stpipe/function_wrapper.py index 00d79273..9aeecd93 100644 --- a/src/stpipe/function_wrapper.py +++ b/src/stpipe/function_wrapper.py @@ -1,6 +1,7 @@ """ A Step whose only purpose is to wrap an ordinary function. """ + from .step import Step diff --git a/src/stpipe/hooks.py b/src/stpipe/hooks.py index 820f68bf..4c9f892e 100644 --- a/src/stpipe/hooks.py +++ b/src/stpipe/hooks.py @@ -1,6 +1,7 @@ """ Pre- and post-hooks """ + import ast import inspect diff --git a/src/stpipe/integration.py b/src/stpipe/integration.py index f825a6f4..984e7d87 100644 --- a/src/stpipe/integration.py +++ b/src/stpipe/integration.py @@ -1,6 +1,7 @@ """ Entry point implementations. """ + import os from asdf.resource import DirectoryResourceMapping diff --git a/src/stpipe/log.py b/src/stpipe/log.py index d7e85bff..b3fc93b7 100644 --- a/src/stpipe/log.py +++ b/src/stpipe/log.py @@ -1,6 +1,7 @@ """ Logging setup etc. """ + import fnmatch import io import logging diff --git a/src/stpipe/pipeline.py b/src/stpipe/pipeline.py index bd5a25ea..6e35f711 100644 --- a/src/stpipe/pipeline.py +++ b/src/stpipe/pipeline.py @@ -1,6 +1,7 @@ """ Pipeline """ + from collections.abc import Sequence from os.path import dirname, join from typing import ClassVar diff --git a/src/stpipe/step.py b/src/stpipe/step.py index fff9aea6..32ac56eb 100644 --- a/src/stpipe/step.py +++ b/src/stpipe/step.py @@ -1,6 +1,7 @@ """ Step """ + import gc import os import sys @@ -103,9 +104,9 @@ def load_spec_file(cls, preserve_comments=_not_set): for reference_file_type in cls.reference_file_types: override_name = crds_client.get_override_name(reference_file_type) spec[override_name] = "is_string_or_datamodel(default=None)" - spec.inline_comments[ - override_name - ] = f"# Override the {reference_file_type} reference file" + spec.inline_comments[override_name] = ( + f"# Override the {reference_file_type} reference file" + ) return spec @classmethod @@ -481,9 +482,9 @@ def run(self, *args): if isinstance(args[0], Sequence): for model in args[0]: try: - model[ - f"meta.cal_step.{self.class_alias}" - ] = "SKIPPED" + model[f"meta.cal_step.{self.class_alias}"] = ( + "SKIPPED" + ) except AttributeError as e: # noqa: PERF203 self.log.info( "Could not record skip into DataModel " @@ -492,9 +493,9 @@ def run(self, *args): ) elif isinstance(args[0], AbstractDataModel): try: - args[0][ - f"meta.cal_step.{self.class_alias}" - ] = "SKIPPED" + args[0][f"meta.cal_step.{self.class_alias}"] = ( + "SKIPPED" + ) except AttributeError as e: self.log.info( "Could not record skip into DataModel" diff --git a/src/stpipe/utilities.py b/src/stpipe/utilities.py index c2a14ba7..1a069c0b 100644 --- a/src/stpipe/utilities.py +++ b/src/stpipe/utilities.py @@ -1,6 +1,7 @@ """ Utilities """ + import inspect import os import sys diff --git a/tests/test_format_template.py b/tests/test_format_template.py index 106ffaa1..ff62a97d 100644 --- a/tests/test_format_template.py +++ b/tests/test_format_template.py @@ -1,4 +1,5 @@ """FormatTemplate tests""" + from functools import partial import pytest diff --git a/tests/test_step.py b/tests/test_step.py index d4bfe9f3..f271a999 100644 --- a/tests/test_step.py +++ b/tests/test_step.py @@ -1,4 +1,5 @@ """Test step.Step""" + import logging import re from typing import ClassVar