diff options
author | cpopa <devnull@localhost> | 2013-12-19 01:16:28 +0200 |
---|---|---|
committer | cpopa <devnull@localhost> | 2013-12-19 01:16:28 +0200 |
commit | 39bd8d2d2b86e4325b2e80b66451ac5413c7341c (patch) | |
tree | bedcbde2cb9986f33f4619e7836e756b2e8811f6 /checkers/utils.py | |
parent | e7991c5ba0903137308cfa91092e9296e2b7d7ab (diff) | |
parent | 0cd8a82285cd3900a77622ecbb62a3f5993af181 (diff) | |
download | pylint-39bd8d2d2b86e4325b2e80b66451ac5413c7341c.tar.gz |
merge with default
Diffstat (limited to 'checkers/utils.py')
-rw-r--r-- | checkers/utils.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/checkers/utils.py b/checkers/utils.py index 4a39119..6af45a6 100644 --- a/checkers/utils.py +++ b/checkers/utils.py @@ -59,7 +59,7 @@ def clobber_in_except(node): (False, None) otherwise. """ if isinstance(node, astroid.AssAttr): - return (True, (node.attrname, 'object %r' % (node.expr.name,))) + return (True, (node.attrname, 'object %r' % (node.expr.as_string(),))) elif isinstance(node, astroid.AssName): name = node.name if is_builtin(name): @@ -161,6 +161,11 @@ def is_defined_before(var_node): if getattr(_node, 'name', None) == varname: return True break + elif isinstance(_node, astroid.ExceptHandler): + if isinstance(_node.name, astroid.AssName): + ass_node=_node.name + if ass_node.name == varname: + return True _node = _node.parent # possibly multiple statements on the same line using semi colon separator stmt = var_node.statement() @@ -394,10 +399,10 @@ def get_argument_from_call(callfunc_node, position=None, keyword=None): :raises NoSuchArgumentError: if no argument at the provided position or with the provided keyword. """ - if not position and not keyword: + if position is None and keyword is None: raise ValueError('Must specify at least one of: position or keyword.') try: - if position and not isinstance(callfunc_node.args[position], astroid.Keyword): + if position is not None and not isinstance(callfunc_node.args[position], astroid.Keyword): return callfunc_node.args[position] except IndexError as error: raise NoSuchArgumentError(error) |