Skip to content

Commit

Permalink
deprecate Step.__call__ (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Nov 20, 2024
2 parents 677f6a4 + 45d4cde commit 511ec29
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions changes/204.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate Step.__call__. For users that do not want to use CRDS parameters please use Step.run.
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(
"Step.__call__ is deprecated. It is equivalent to Step.run "
"and is not recommended.",
UserWarning,
)
return self.run(*args)

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 511ec29

Please sign in to comment.