Skip to content

Commit

Permalink
add deprecated decorator (#2361)
Browse files Browse the repository at this point in the history
* add deprecated decorator

* blackify
  • Loading branch information
wkerzendorf authored Jul 18, 2023
1 parent 527e3e8 commit 1e651e9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tardis/util/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from IPython import get_ipython, display
import tqdm
import tqdm.notebook
import functools
import warnings

k_B_cgs = constants.k_B.cgs.value
c_cgs = constants.c.cgs.value
Expand Down Expand Up @@ -761,3 +763,21 @@ def fix_bar_layout(bar, no_of_packets=None, total_iterations=None):
bar.reset(total=total_iterations)
else:
pass


def deprecated(func):
"""
A decorator to add a deprecation warning to a function that is no longer used
Parameters
----------
func : function
"""

@functools.wraps(func)
def wrapper(*args, **kwargs):
warnings.warn("This function is deprecated.", DeprecationWarning)
return func(*args, **kwargs)

return wrapper

0 comments on commit 1e651e9

Please sign in to comment.