报告标记为已弃用并引发 DeprecationWarning 或 PendingDeprecationWarning 警告的 Python 函数或方法的用法。
此外,该检查还高亮显示 abc.abstractstaticmethod、abc.abstractproperty 和 abc.abstractclassmethod 装饰器的用法。
示例:
class Foo:
@property
def bar(self):
import warnings
warnings.warn("this is deprecated", DeprecationWarning, 2)
return 5
foo = Foo()
print(foo.bar)