Commit 8e5cfb5f authored by Jose Borreguero's avatar Jose Borreguero
Browse files

remove the algorithm deprecation decorator

Signed-off-by: default avatarJose Borreguero <>
parent 0b6a0845
......@@ -37,40 +37,3 @@ def deprecated_alias(deprecation_date): # decorator factory
return cls
return decorator_instance
def deprecated_algorithm(new_name, deprecation_date): # decorator factory
:brief: Class decorator marking the algorithm as deprecated
:param str new_name: Algorithm's name that should be used in place of this algorithm
:param str deprecation_date: date of deprecation for this algorithm, in ISO8601 format
except ValueError:
logger.error(f'Algorithm deprecation date {deprecation_date} must be in ISO8601 format')
def decorator_instance(cls):
depr_msg = f'Algorithm "{cls.__name__}" is deprecated since {deprecation_date}. Use "{new_name}" instead'
raise_msg = f'Configuration "algorithms.deprecated" set to raise upon use of deprecated algorithms'
cls_init = cls.__init__
def new_init(self, *args, **kwargs):
r"""decorate __init__ to possibly raise"""
if ConfigService.Instance()['algorithms.deprecated'] == 'Raise':
raise RuntimeError(raise_msg)
cls_init(self, *args, **kwargs)
cls.__init__ = new_init
cls_PyExec = cls.PyExec
def new_PyExec(self):
r"""decorate PyExec to throw an error message"""
logger.error(depr_msg) # show error after execution
cls.PyExec = new_PyExec
return cls
return decorator_instance
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment