Skip to content

Commit

Permalink
deprecate deprecate_class (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram authored Mar 6, 2024
1 parent 60c02ce commit 8e551d3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
- Provide existing ``AsdfFile`` instance to ``validate`` to
speed up assignment validation ``check_value``. [#276]

- Deprecate ``deprecate_class`` unused by downstream. [#274]


1.10.0 (2024-02-29)
===================

Expand Down
13 changes: 10 additions & 3 deletions src/stdatamodels/jwst/datamodels/ramp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import warnings

from .model_base import JwstDataModel
from stdatamodels.jwst.library.basic_utils import deprecate_class


__all__ = ['RampModel', 'MIRIRampModel']

Expand Down Expand Up @@ -43,9 +45,14 @@ def __init__(self, init=None, **kwargs):
self.err = self.err


@deprecate_class(RampModel)
class MIRIRampModel:
class MIRIRampModel(RampModel):
"""A data model for 4D MIRI ramps.
This model has been deprecated. Please use `RampModel` instead.
"""
def __init__(self, *args, **kwargs):
warnings.warn(
'"MIRIRampModel" is deprecated and will be removed. Use RampModel',
category=DeprecationWarning,
)
return super(MIRIRampModel, self).__init__(*args, **kwargs)
4 changes: 4 additions & 0 deletions src/stdatamodels/jwst/library/basic_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""General utility objects"""

import warnings


def deprecate_class(new_class,
message='"{old_class}" is deprecated and will be removed. Use {new_class}'):
Expand All @@ -14,6 +16,8 @@ def deprecate_class(new_class,
The deprecation warning message
"""

warnings.warn("deprecate_class is deprecated and will be removed", DeprecationWarning)

# Implement the inner decorator
def _decorator(old_class):

Expand Down

0 comments on commit 8e551d3

Please sign in to comment.