Files
pyfa/utils/deprecated.py
blitzmann d5aeb0913d Start refactoring the refactor that was started with command pattern refactoring.
Instead of attempting to keep all the Fit service functionality, move these into specific "Fitting Commands" that are designed to define a unit of work and it's undo. Then, we will have "GUI Commands" which are defined as actions taken by the user themselves - these will usually use one or more "Fitting Commands".
2018-07-24 01:29:57 -04:00

17 lines
655 B
Python

import warnings
import functools
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used."""
@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning) # turn off filter
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning,
stacklevel=2)
warnings.simplefilter('default', DeprecationWarning) # reset filter
return func(*args, **kwargs)
return new_func