From 41f3d30123b9025af23b216b8e8a6184d5e69c13 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 6 Nov 2024 17:26:38 -0500 Subject: [PATCH] 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