mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-10 14:54:17 +00:00
cleanup
This commit is contained in:
parent
fde77e2168
commit
cf16bf82b9
2 changed files with 5 additions and 10 deletions
|
|
@ -46,7 +46,7 @@ class ASTVisitor:
|
||||||
"""Do preorder walk of tree using visitor"""
|
"""Do preorder walk of tree using visitor"""
|
||||||
self.visitor = visitor
|
self.visitor = visitor
|
||||||
visitor.visit = self.dispatch
|
visitor.visit = self.dispatch
|
||||||
self.dispatch(tree, *args) # XXX *args make sense?
|
self.dispatch(tree, *args) # XXX *args make sense?
|
||||||
|
|
||||||
|
|
||||||
class PathNode:
|
class PathNode:
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,12 @@
|
||||||
# See LICENSE file for details
|
# See LICENSE file for details
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import __builtin__
|
import __builtin__ # NOQA
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import builtins as __builtin__
|
import builtins as __builtin__
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import _ast
|
import _ast
|
||||||
import sys
|
|
||||||
|
|
||||||
from flake8 import messages
|
from flake8 import messages
|
||||||
from flake8.util import skip_warning
|
from flake8.util import skip_warning
|
||||||
|
|
@ -568,14 +567,10 @@ class Checker(object):
|
||||||
Check to see if any assignments have not been used.
|
Check to see if any assignments have not been used.
|
||||||
"""
|
"""
|
||||||
for name, binding in self.scope.items():
|
for name, binding in self.scope.items():
|
||||||
try:
|
if (not binding.used and not name in self.scope.globals
|
||||||
if (not binding.used and not name in self.scope.globals
|
|
||||||
and isinstance(binding, Assignment)):
|
and isinstance(binding, Assignment)):
|
||||||
self.report(messages.UnusedVariable,
|
self.report(messages.UnusedVariable,
|
||||||
binding.source.lineno, name)
|
binding.source.lineno, name)
|
||||||
except:
|
|
||||||
raise Exception(binding)
|
|
||||||
import pdb; pdb.set_trace()
|
|
||||||
|
|
||||||
self.deferAssignment(checkUnusedAssignments)
|
self.deferAssignment(checkUnusedAssignments)
|
||||||
self.popScope()
|
self.popScope()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue