summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Pribysh <dmand@yandex.ru>2015-11-03 18:24:16 +0300
committerDmitry Pribysh <dmand@yandex.ru>2015-11-03 18:24:16 +0300
commitfabcc0526fb1d6b1a876c76f47f54f70d51023c7 (patch)
tree63900c0a6b3e779e7d06b480e33df13680dcf946
parent2d184274baf961869c13f9ef687a112411589ed4 (diff)
downloadpylint-fabcc0526fb1d6b1a876c76f47f54f70d51023c7.tar.gz
Fix pylint warning by rewriting part of BasicChecker
-rw-r--r--pylint/checkers/base.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py
index 8f4eca5..8d860ac 100644
--- a/pylint/checkers/base.py
+++ b/pylint/checkers/base.py
@@ -1095,9 +1095,8 @@ functions, methods
# in PY3K a "with" statement with multiple managers coresponds
# to one AST "With" node with multiple items
pairs = node.items
- prev_pair = None
- for pair in pairs:
- if prev_pair is not None:
+ if pairs:
+ for prev_pair, pair in zip(pairs, pairs[1:]):
if (isinstance(prev_pair[1], astroid.AssignName) and
(pair[1] is None and not isinstance(pair[0], astroid.Call))):
# don't emit a message if the second is a function call
@@ -1106,7 +1105,6 @@ functions, methods
# if the line number doesn't match
# we assume it's a nested "with"
self.add_message('confusing-with-statement', node=node)
- prev_pair = pair
_NAME_TYPES = {