Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 10, 2024
1 parent 640271b commit dc3a336
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/stpipe/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ def __init__(self, *args, **kwargs):
Step.__init__(self, *args, **kwargs)

# Configure all of the steps
step_parameters = kwargs.get('steps', {})
step_parameters = kwargs.get("steps", {})
for key, val in self.step_defs.items():
cfg = self.steps.get(key)
if cfg is not None:
new_step = val.from_config_section(
cfg,
parent=self,
name=key,
config_file=self.config_file
cfg, parent=self, name=key, config_file=self.config_file
)
else:
new_step = val(
Expand Down
5 changes: 3 additions & 2 deletions src/stpipe/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def run(self, *args, **kwargs):
self.log.info("Step %s running with args %s.", self.name, args)

# Check for explicit disable for CRDS parameters
disable_crds_steppars = kwargs.pop('disable_crds_steppars', None)
disable_crds_steppars = kwargs.pop("disable_crds_steppars", None)

# Get parameters from user
parameters = None
Expand All @@ -486,7 +486,8 @@ def run(self, *args, **kwargs):
# Build config from CRDS + user keywords
try:
parameters, _ = self.build_config(
filename, disable=disable_crds_steppars, **kwargs)
filename, disable=disable_crds_steppars, **kwargs
)
except (NotImplementedError, FileNotFoundError):
# Catch steps that cannot build a config
# (e.g. post hooks created from local functions,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def test_step_run_disable_crds_via_environment(monkeypatch, step_class):
assert step.str1 == "default"
assert step._initialized["str1"] is False

monkeypatch.setenv('STPIPE_DISABLE_CRDS_STEPPARS', 'True')
monkeypatch.setenv("STPIPE_DISABLE_CRDS_STEPPARS", "True")

step.run("science.fits")
assert step.str1 == "default"
Expand Down Expand Up @@ -516,7 +516,7 @@ def test_step_run_initialized_values(step_class):
@pytest.mark.parametrize("step_class", [SimplePipe, SimpleStep])
def test_step_run_initialized_values_on_instantiation(step_class):
"""Test that parameters pre-set are not overridden when run is called."""
step = step_class(str1='on instantiation')
step = step_class(str1="on instantiation")
step.process = lambda *args: None

assert step.str1 == "on instantiation"
Expand Down Expand Up @@ -640,7 +640,7 @@ def test_pipe_run_step_values_skip_initialized():
@pytest.mark.usefixtures("_mock_crds_reffile")
def test_pipe_run_step_values_skip_initialized():
"""Test that initialized parameters are not overridden."""
pipe = SimplePipe(steps={'step1': {'str1': 'on instantiation'}})
pipe = SimplePipe(steps={"step1": {"str1": "on instantiation"}})
pipe.process = lambda *args: None

assert pipe.step1.str1 == "on instantiation"
Expand Down

0 comments on commit dc3a336

Please sign in to comment.