From 1f63db82204b1a844ce7ae2d6695c8ce840d3487 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 6 Nov 2024 17:26:38 -0500 Subject: [PATCH 1/2] deprecate Step.__call__ --- src/stpipe/step.py | 9 ++++++++- tests/test_hooks.py | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/stpipe/step.py b/src/stpipe/step.py index f956c454..8776eb5f 100644 --- a/src/stpipe/step.py +++ b/src/stpipe/step.py @@ -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 @@ -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): """ diff --git a/tests/test_hooks.py b/tests/test_hooks.py index 15dc5623..3196f27a 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py @@ -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 From 45d4cde9c0427422c00c05146884b5dfd818bc35 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 7 Nov 2024 12:49:38 -0500 Subject: [PATCH 2/2] add changelog fragment --- changes/204.removal.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/204.removal.rst diff --git a/changes/204.removal.rst b/changes/204.removal.rst new file mode 100644 index 00000000..b46f1d6d --- /dev/null +++ b/changes/204.removal.rst @@ -0,0 +1 @@ +Deprecate Step.__call__. For users that do not want to use CRDS parameters please use Step.run.