Skip to content
15 changes: 15 additions & 0 deletions src/diffpy/utils/scattering_objects/diffraction_objects.py
Copy link
Contributor Author

@bobleesj bobleesj Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two deprecation messages written 1) docstring level 2) class level

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import warnings
from copy import deepcopy

import numpy as np
Expand All @@ -18,6 +19,20 @@


class Diffraction_object:
"""FIXME: Add class docstring.
.. deprecated:: 3.5.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the numpy deprecation standards:

Screenshot 2024-11-09 at 12 28 11 PM

Ref: https://numpydoc.readthedocs.io/en/latest/format.html#deprecation-warning

`Diffraction_object` will be removed in diffpy.utils 3.6.0, it is replaced by
`DiffractionObject` to follow the class naming convention.
"""

warnings.warn(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning produced at the run-time level:

Screenshot 2024-11-09 at 12 29 11 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Here I would maybe begin with the words "Diffraction_object is deprecated and will be removed....."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

"Diffraction_object` will be removed in diffpy.utils 3.6.0, it is replaced by "
"DiffractionObject` to follow the class naming convention.",
DeprecationWarning,
stacklevel=2,
)

def __init__(self, name="", wavelength=None):
self.name = name
self.wavelength = wavelength
Expand Down
Loading