summaryrefslogtreecommitdiff
path: root/checkers/utils.py
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2013-12-22 23:41:57 +0100
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2013-12-22 23:41:57 +0100
commitd8895fcb65ecd958b627298b32b0592565ef137e (patch)
tree57cdbc1a28493d1f131fa2b4a8a3ff6611c7fa2b /checkers/utils.py
parentd3f5227f8903cf72d7de78d0c2a9fc2948b19ca9 (diff)
downloadpylint-d8895fcb65ecd958b627298b32b0592565ef137e.tar.gz
various pylint fixes
Diffstat (limited to 'checkers/utils.py')
-rw-r--r--checkers/utils.py57
1 files changed, 29 insertions, 28 deletions
diff --git a/checkers/utils.py b/checkers/utils.py
index 72a9733..53b40a6 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -69,8 +69,9 @@ def clobber_in_except(node):
scope, stmts = node.lookup(name)
if (stmts and
not isinstance(stmts[0].ass_type(),
- (astroid.Assign, astroid.AugAssign, astroid.ExceptHandler))):
- return (True, (name, 'outer scope (line %s)' % (stmts[0].fromlineno,)))
+ (astroid.Assign, astroid.AugAssign,
+ astroid.ExceptHandler))):
+ return (True, (name, 'outer scope (line %s)' % stmts[0].fromlineno))
return (False, None)
@@ -164,7 +165,7 @@ def is_defined_before(var_node):
break
elif isinstance(_node, astroid.ExceptHandler):
if isinstance(_node.name, astroid.AssName):
- ass_node=_node.name
+ ass_node = _node.name
if ass_node.name == varname:
return True
_node = _node.parent
@@ -176,7 +177,7 @@ def is_defined_before(var_node):
for ass_node in _node.nodes_of_class(astroid.AssName):
if ass_node.name == varname:
return True
- for imp_node in _node.nodes_of_class( (astroid.From, astroid.Import)):
+ for imp_node in _node.nodes_of_class((astroid.From, astroid.Import)):
if varname in [name[1] or name[0] for name in imp_node.names]:
return True
_node = _node.previous_sibling()
@@ -301,52 +302,52 @@ def parse_format_string(format_string):
return (i, format_string[i])
i = 0
while i < len(format_string):
- c = format_string[i]
- if c == '%':
- i, c = next_char(i)
+ char = format_string[i]
+ if char == '%':
+ i, char = next_char(i)
# Parse the mapping key (optional).
key = None
- if c == '(':
+ if char == '(':
depth = 1
- i, c = next_char(i)
+ i, char = next_char(i)
key_start = i
while depth != 0:
- if c == '(':
+ if char == '(':
depth += 1
- elif c == ')':
+ elif char == ')':
depth -= 1
- i, c = next_char(i)
+ i, char = next_char(i)
key_end = i - 1
key = format_string[key_start:key_end]
# Parse the conversion flags (optional).
- while c in '#0- +':
- i, c = next_char(i)
+ while char in '#0- +':
+ i, char = next_char(i)
# Parse the minimum field width (optional).
- if c == '*':
+ if char == '*':
num_args += 1
- i, c = next_char(i)
+ i, char = next_char(i)
else:
- while c in string.digits:
- i, c = next_char(i)
+ while char in string.digits:
+ i, char = next_char(i)
# Parse the precision (optional).
- if c == '.':
- i, c = next_char(i)
- if c == '*':
+ if char == '.':
+ i, char = next_char(i)
+ if char == '*':
num_args += 1
- i, c = next_char(i)
+ i, char = next_char(i)
else:
- while c in string.digits:
- i, c = next_char(i)
+ while char in string.digits:
+ i, char = next_char(i)
# Parse the length modifier (optional).
- if c in 'hlL':
- i, c = next_char(i)
+ if char in 'hlL':
+ i, char = next_char(i)
# Parse the conversion type (mandatory).
- if c not in 'diouxXeEfFgGcrs%':
+ if char not in 'diouxXeEfFgGcrs%':
raise UnsupportedFormatCharacter(i)
if key:
keys.add(key)
- elif c != '%':
+ elif char != '%':
num_args += 1
i += 1
return keys, num_args