Fix deprecated decorator function that didn't work in Python 3
@@ -10,13 +10,11 @@ def deprecated(func):
@functools.wraps(func)
def new_func(*args, **kwargs):
- warnings.warn_explicit(
- "Call to deprecated function {}.".format(func.__name__),
- category=DeprecationWarning,
- filename=func.func_code.co_filename,
- lineno=func.func_code.co_firstlineno + 1
- )
+ warnings.simplefilter('always', DeprecationWarning)
+ warnings.warn("Call to deprecated function {}.".format(func.__name__), category=DeprecationWarning, stacklevel=2)
+ warnings.simplefilter('default', DeprecationWarning)
return func(*args, **kwargs)
+
return new_func
