summaryrefslogtreecommitdiff
path: root/pylint/checkers/utils.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2016-12-04 11:39:25 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2016-12-04 11:40:37 +0200
commit3fedf6c65dbae82b11b9493645dfea9b171ba85d (patch)
tree63b501eeb0de166aa07a561bb78f8e059619a369 /pylint/checkers/utils.py
parent0b58de8f6e923a6331aa227f70867b0276a32ff0 (diff)
downloadpylint-git-3fedf6c65dbae82b11b9493645dfea9b171ba85d.tar.gz
Add docstring and move up the variable at the top of function.
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r--pylint/checkers/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index e3f0e2f94..9028c8417 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -809,6 +809,13 @@ def node_type(node):
def is_registered_in_singledispatch_function(node):
+ """Check if the given function node is a singledispatch function."""
+
+ singledispatch_qnames = (
+ 'functools.singledispatch',
+ 'singledispatch.singledispatch'
+ )
+
if not isinstance(node, astroid.FunctionDef):
return False
@@ -827,7 +834,6 @@ def is_registered_in_singledispatch_function(node):
except astroid.InferenceError:
continue
- singledispatch_qnames = ('functools.singledispatch', 'singledispatch.singledispatch')
if isinstance(func_def, astroid.FunctionDef):
return decorated_with(func_def, singledispatch_qnames)