mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-28 03:34:59 +08:00
Fix function code.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import warnings
|
||||
import functools
|
||||
|
||||
from . import six
|
||||
|
||||
|
||||
__all__ = ['deprecated']
|
||||
|
||||
@@ -35,10 +37,11 @@ class deprecated(object):
|
||||
@functools.wraps(func)
|
||||
def wrapped(*args, **kwargs):
|
||||
if self.behavior == 'warn':
|
||||
func_code = six.get_function_code(func)
|
||||
warnings.warn_explicit(msg,
|
||||
category=DeprecationWarning,
|
||||
filename=func.func_code.co_filename,
|
||||
lineno=func.func_code.co_firstlineno + 1)
|
||||
filename=func_code.co_filename,
|
||||
lineno=func_code.co_firstlineno + 1)
|
||||
elif self.behavior == 'raise':
|
||||
raise DeprecationWarning(msg)
|
||||
return func(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user