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