summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryneeverett <ryneeverett@gmail.com>2015-08-14 10:52:21 -0400
committerryneeverett <ryneeverett@gmail.com>2015-08-14 10:52:21 -0400
commitec8dbbb30a2a5ad8a1522d5b474b942e1eef98c5 (patch)
treed0ff3b287f0b78399495b418fe8ad58bd01cf78e
parentc9bae487f8d65f13a545bc03c12cb60952d10936 (diff)
downloadpyflakes-ec8dbbb30a2a5ad8a1522d5b474b942e1eef98c5.tar.gz
Roll back changes, add comment, and skip the test.
-rw-r--r--pyflakes/checker.py8
-rw-r--r--pyflakes/test/test_other.py3
-rw-r--r--pyflakes/test/test_undefined_names.py5
3 files changed, 8 insertions, 8 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 088a7d4..abd7f50 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -96,11 +96,10 @@ class Binding(object):
line number that this binding was last used
"""
- def __init__(self, name, source, isglobal=False):
+ def __init__(self, name, source):
self.name = name
self.source = source
self.used = False
- self.isglobal = isglobal
def __str__(self):
return self.name
@@ -527,7 +526,8 @@ class Checker(object):
binding = ExportBinding(name, node.parent, self.scope)
else:
binding = Assignment(name, node)
- if name in self.scope and self.scope[name].isglobal:
+ if name in self.scope:
+ # then assume the rebound name is used as a global or within a loop
binding.used = self.scope[name].used
self.addBinding(node, binding)
@@ -688,7 +688,7 @@ class Checker(object):
# One 'global' statement can bind multiple (comma-delimited) names.
for node_name in node.names:
- node_value = Assignment(node_name, node, isglobal=True)
+ node_value = Assignment(node_name, node)
# Remove UndefinedName messages already reported for this name.
self.messages = [
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index 367c4b3..718d16f 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -523,6 +523,7 @@ class TestUnusedAssignment(TestCase):
return
''', m.UnusedVariable)
+ @skip("todo: Difficult because it does't apply in the context of a loop")
def test_unusedReassignedVariable(self):
"""
Shadowing a used variable can still raise an UnusedVariable warning.
@@ -627,7 +628,7 @@ class TestUnusedAssignment(TestCase):
if i > 2:
return x
x = i * 2
- ''', m.UnusedVariable)
+ ''')
def test_tupleUnpacking(self):
"""
diff --git a/pyflakes/test/test_undefined_names.py b/pyflakes/test/test_undefined_names.py
index 7285423..faaaf8c 100644
--- a/pyflakes/test/test_undefined_names.py
+++ b/pyflakes/test/test_undefined_names.py
@@ -193,7 +193,7 @@ class Test(TestCase):
while o is not True:
del o
o = False
- ''', m.UnusedVariable)
+ ''')
def test_delWhileNested(self):
"""
@@ -209,7 +209,7 @@ class Test(TestCase):
with context():
del o
o = False
- ''', m.UnusedVariable)
+ ''')
def test_globalFromNestedScope(self):
"""Global names are available from nested scopes."""
@@ -315,7 +315,6 @@ class Test(TestCase):
d += 4
e[any] = 5
''',
- m.UnusedVariable, # a
m.UndefinedName, # b
m.UndefinedName, # c
m.UndefinedName, m.UnusedVariable, # d