报告标记为已弃用并引发 DeprecationWarningPendingDeprecationWarning 警告的 Python 函数或方法的用法。

此外,该检查还高亮显示 abc.abstractstaticmethodabc.abstractpropertyabc.abstractclassmethod 装饰器的用法。

示例:

class Foo:
    @property
    def bar(self):
        import warnings
        warnings.warn("this is deprecated", DeprecationWarning, 2)
        return 5


foo = Foo()
print(foo.bar)