Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate Step.__call__ #204

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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