Skip to content

Commit 1c6bcda

Browse files
committed
change function to build_deprecation_message
1 parent 28b6074 commit 1c6bcda

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

news/dep-msg-helper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
**Added:**
22

3-
* Add ``deprecation_message`` helper for printing consistent deprecation messages.
3+
* Add ``build_deprecation_message`` helper for printing consistent deprecation messages.
44

55
**Changed:**
66

src/diffpy/utils/_deprecator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def deprecated(message, *, category=DeprecationWarning, stacklevel=1):
2020
2121
.. code-block:: python
2222
23-
from diffpy.utils._deprecator import deprecated, deprecation_message
23+
from diffpy.utils._deprecator import (
24+
deprecated, build_deprecation_message
25+
)
2426
2527
deprecation_warning = build_deprecation_message("diffpy.utils",
2628
"old_function",
@@ -44,8 +46,9 @@ def new_function(x, y):
4446
4547
.. code-block:: python
4648
47-
from diffpy.utils._deprecator import deprecated, deprecation_message
48-
49+
from diffpy.utils._deprecator import (
50+
deprecated, build_deprecation_message
51+
)
4952
deprecation_warning = build_deprecation_message("diffpy.utils",
5053
"OldAtom",
5154
"NewAtom",
@@ -96,7 +99,7 @@ def wrapper(*args, **kwargs):
9699
return decorator
97100

98101

99-
def deprecation_message(
102+
def build_deprecation_message(
100103
old_base, old_name, new_name, removal_version, new_base=None
101104
):
102105
"""Generate a deprecation message.

src/diffpy/utils/parsers/loaddata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
import numpy
1919

2020
from diffpy.utils import validators
21-
from diffpy.utils._deprecator import deprecated, deprecation_message
21+
from diffpy.utils._deprecator import build_deprecation_message, deprecated
2222

2323
base = "diffpy.utils.parsers.loaddata"
2424
removal_version = "4.0.0"
2525

26-
loaddata_deprecation_msg = deprecation_message(
26+
loaddata_deprecation_msg = build_deprecation_message(
2727
base,
2828
"loadData",
2929
"load_data",

tests/test_deprecator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import pytest
22

3-
from diffpy.utils._deprecator import deprecated, deprecation_message
3+
from diffpy.utils._deprecator import build_deprecation_message, deprecated
44

55
old_base = "diffpy.utils"
66
old_name = "oldFunction"
77
new_name = "new_function"
88
removal_version = "4.0.0"
99

10-
dep_msg = deprecation_message(old_base, old_name, new_name, removal_version)
10+
dep_msg = build_deprecation_message(
11+
old_base, old_name, new_name, removal_version
12+
)
1113

1214

1315
@deprecated(dep_msg)

0 commit comments

Comments
 (0)