def __call__(self, obj, *args, **kwargs):
@wraps(obj)
def new_func(*args, **kwargs):
msg = "Call to deprecated function or class {0} ({1})".format(obj.__name__,
self.reason)
if inspect.isfunction(obj):
_code = self._wrap_function(obj)
elif inspect.isclass(obj):
_code = self._wrap_class(obj)
warnings.warn_explicit(
'{0}.'.format(msg),
category=UserWarning,
filename=_code.co_filename,
lineno=_code.co_firstlineno + 1
)
return obj(*args, **kwargs)
return new_func
__init__.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录