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".
This commit is contained in:
blitzmann
2018-07-24 01:29:57 -04:00
parent 2ccad2a358
commit d5aeb0913d
15 changed files with 272 additions and 57 deletions

16
utils/deprecated.py Normal file
View File

@@ -0,0 +1,16 @@
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