Wed, 03 Oct 2012 12:18:51 +0200
Added code to handle unknown node types to the pyflakes checker.
Utilities/py3flakes/checker.py | file | annotate | diff | comparison | revisions | |
UtilitiesPython2/py2flakes/checker.py | file | annotate | diff | comparison | revisions |
--- a/Utilities/py3flakes/checker.py Tue Oct 02 19:53:31 2012 +0200 +++ b/Utilities/py3flakes/checker.py Wed Oct 03 12:18:51 2012 +0200 @@ -283,6 +283,8 @@ try: handler = getattr(self, nodeType) handler(node) + except AttributeError: + print(nodeType, "not supported yet. Please report this.") finally: self.nodeDepth -= 1 if self.traceTree:
--- a/UtilitiesPython2/py2flakes/checker.py Tue Oct 02 19:53:31 2012 +0200 +++ b/UtilitiesPython2/py2flakes/checker.py Wed Oct 03 12:18:51 2012 +0200 @@ -285,21 +285,24 @@ isinstance(node.value, _ast.Str)) def handleNode(self, node, parent): - node.parent = parent - if self.traceTree: - print ' ' * self.nodeDepth + node.__class__.__name__ - self.nodeDepth += 1 - if self.futuresAllowed and not \ - (isinstance(node, _ast.ImportFrom) or self.isDocstring(node)): - self.futuresAllowed = False - nodeType = node.__class__.__name__.upper() - try: - handler = getattr(self, nodeType) - handler(node) - finally: - self.nodeDepth -= 1 - if self.traceTree: - print ' ' * self.nodeDepth + 'end ' + node.__class__.__name__ + if node: + node.parent = parent + if self.traceTree: + print ' ' * self.nodeDepth + node.__class__.__name__ + self.nodeDepth += 1 + if self.futuresAllowed and not \ + (isinstance(node, _ast.ImportFrom) or self.isDocstring(node)): + self.futuresAllowed = False + nodeType = node.__class__.__name__.upper() + try: + handler = getattr(self, nodeType) + handler(node) + except AttributeError: + print nodeType, "not supported yet. Please report this." + finally: + self.nodeDepth -= 1 + if self.traceTree: + print ' ' * self.nodeDepth + 'end ' + node.__class__.__name__ def ignore(self, node): pass