Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
comment
  • Loading branch information
cadenmyers13 committed Nov 24, 2025
commit 1d936d77fc0ccb3acea09ac9047de94f0df75132
6 changes: 0 additions & 6 deletions src/diffpy/utils/_deprecator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,18 @@ def deprecated(message, *, category=DeprecationWarning, stacklevel=1):

Matches the Python 3.13 warnings.deprecated API exactly.
"""
# If Python 3.13 implementation exists, delegate to it
if _builtin_deprecated is not None:
return _builtin_deprecated(
message, category=category, stacklevel=stacklevel
)

# Validate message type like Python 3.13 does
if not isinstance(message, str):
raise TypeError(
f"Expected an object of type str for 'message', not "
f"{type(message).__name__!r}"
)

def decorator(obj):
# Set __deprecated__ attribute (required by PEP 702)
setattr(obj, "__deprecated__", message)

# Must support functions AND classes
if callable(obj):

@functools.wraps(obj)
Expand Down