Skip to content

Commit

Permalink
Add deprecation date
Browse files Browse the repository at this point in the history
  • Loading branch information
Zack Singer committed Jul 2, 2024
1 parent c51dc68 commit 0e57e2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion hexrd/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class DeprecatedFunctionError(Exception):
pass


def deprecated(new_func: str = None):
def deprecated(new_func: str = None, deprecation_date: str = None):
"""
Decorator to mark functions as deprecated. Raises an error if
the 'ACK_DEPRECATED' environment variable is not set. Alerts the
Expand All @@ -21,6 +21,7 @@ def wrapper(*args, **kwargs):
print(
f"Warning: {func.__name__} is deprecated and is marked for"
f" removal. Please use {new_func} instead."
f" Deprecation date: {deprecation_date}"
)
if os.getenv('ACK_DEPRECATED') != 'true':
raise DeprecatedFunctionError(
Expand Down
4 changes: 2 additions & 2 deletions hexrd/xrdutil/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def validateAngleRanges(
return reflInRange


@deprecated
@deprecated(deprecation_date='2025-01-01')
def simulateOmeEtaMaps(
omeEdges,
etaEdges,
Expand Down Expand Up @@ -1137,7 +1137,7 @@ def simulateGVecs(
return valid_ids, valid_hkl, valid_ang, valid_xy, ang_ps


@deprecated(new_func=simlp)
@deprecated(new_func=simlp, deprecation_date='2025-01-01')
def simulateLauePattern(
hkls,
bMat,
Expand Down

0 comments on commit 0e57e2e

Please sign in to comment.