summaryrefslogtreecommitdiff
path: root/pylint/checkers/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r--pylint/checkers/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index 2cb01d5..716318a 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -515,6 +515,15 @@ def decorated_with_abc(func):
return True
+def decorated_with(func, qname):
+ """Determine if the `func` node has a decorator with the qualified name `qname`."""
+ decorators = func.decorators.nodes if func.decorators else []
+ for decorator_node in decorators:
+ dec = safe_infer(decorator_node)
+ if dec and dec.qname() == qname:
+ return True
+
+
def unimplemented_abstract_methods(node, is_abstract_cb=decorated_with_abc):
"""
Get the unimplemented abstract methods for the given *node*.