diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2016-12-04 11:35:23 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-12-04 11:40:37 +0200 |
commit | 0b58de8f6e923a6331aa227f70867b0276a32ff0 (patch) | |
tree | 8fa6cdbe27a159a18341067dea539c5e701026ec /pylint/checkers/variables.py | |
parent | 5b6d225789b7abdbe7a9156bf7c4bf019783a271 (diff) | |
download | pylint-git-0b58de8f6e923a6331aa227f70867b0276a32ff0.tar.gz |
Skip checking only of arguments when in a singledispatched function.
Diffstat (limited to 'pylint/checkers/variables.py')
-rw-r--r-- | pylint/checkers/variables.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index c8b49f7b6..e3257de6e 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -662,6 +662,9 @@ class VariablesChecker(BaseChecker): if any(node.name.startswith(cb) or node.name.endswith(cb) for cb in self.config.callbacks): return + # Don't check arguments of singledispatch.register function. + if utils.is_registered_in_singledispatch_function(node): + return self.add_message('unused-argument', args=name, node=stmt, confidence=confidence) else: @@ -692,13 +695,8 @@ class VariablesChecker(BaseChecker): if is_method and node.is_abstract(): return - # Don't check arguments of singledispatch.register function. - if utils.is_registered_in_singledispatch_function(node): - return - global_names = _flattened_scope_names(node.nodes_of_class(astroid.Global)) nonlocal_names = _flattened_scope_names(node.nodes_of_class(astroid.Nonlocal)) - for name, stmts in six.iteritems(not_consumed): self._check_is_unused(name, node, stmts[0], global_names, nonlocal_names) |