mirror of https://github.com/MISP/PyMISP
parent
6b530db32d
commit
142566df4d
|
@ -49,12 +49,20 @@ def deprecated(func):
|
||||||
|
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def new_func(*args, **kwargs):
|
def new_func(*args, **kwargs):
|
||||||
warnings.warn_explicit(
|
if sys.version_info < (3, 0):
|
||||||
"Call to deprecated function {}.".format(func.__name__),
|
warnings.warn_explicit(
|
||||||
category=DeprecationWarning,
|
"Call to deprecated function {}.".format(func.__name__),
|
||||||
filename=func.func_code.co_filename,
|
category=DeprecationWarning,
|
||||||
lineno=func.func_code.co_firstlineno + 1
|
filename=func.func_code.co_filename,
|
||||||
)
|
lineno=func.func_code.co_firstlineno + 1
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
warnings.warn_explicit(
|
||||||
|
"Call to deprecated function {}.".format(func.__name__),
|
||||||
|
category=DeprecationWarning,
|
||||||
|
filename=func.__code__.co_filename,
|
||||||
|
lineno=func.__code__.co_firstlineno + 1
|
||||||
|
)
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
return new_func
|
return new_func
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue