Skip to content

Commit

Permalink
deprecate Step.__call__
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Nov 6, 2024
1 parent cf69143 commit 41f3d30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/stpipe/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import gc
import os
import sys
import warnings
from collections.abc import Sequence
from contextlib import contextmanager, suppress
from functools import partial
Expand Down Expand Up @@ -593,7 +594,13 @@ def run(self, *args):

return step_result

__call__ = run
def __call__(self, *args):
warnings.warn(

Check warning on line 598 in src/stpipe/step.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/step.py#L598

Added line #L598 was not covered by tests
"Step.__call__ is deprecated. It is equivalent to Step.run "
"and is not recommended.",
UserWarning,
)
return self.run(*args)

Check warning on line 603 in src/stpipe/step.py

View check run for this annotation

Codecov / codecov/patch

src/stpipe/step.py#L603

Added line #L603 was not covered by tests

def finalize_result(self, result, reference_files_used):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def _datamodels_open(cls, init, **kwargs):
return init

def process(self, input_data):
result = self.shovelpixels(input_data)
result = self.cancelnoise(result)
result = self.shovelpixels.run(input_data)
result = self.cancelnoise.run(result)

return result # noqa: RET504

Expand Down

0 comments on commit 41f3d30

Please sign in to comment.