Skip to content

Commit

Permalink
algorithm.{Visitor,Transformer}: don't die on lists of strings.
Browse files Browse the repository at this point in the history
whitequark committed Jun 6, 2015
1 parent a21205a commit 2167c88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pythonparser/algorithm.py
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ def visit(self, obj):
"""Visit a node or a list of nodes. Other values are ignored"""
if isinstance(obj, list):
for elt in obj:
self._visit_one(elt)
self.visit(elt)
elif isinstance(obj, ast.AST):
self._visit_one(obj)

@@ -79,7 +79,7 @@ def _visit_one(self, node):
def visit(self, obj):
"""Visit a node or a list of nodes. Other values are ignored"""
if isinstance(obj, list):
return list(filter(lambda x: x is not None, map(self._visit_one, obj)))
return list(filter(lambda x: x is not None, map(self.visit, obj)))
elif isinstance(obj, ast.AST):
return self._visit_one(obj)

0 comments on commit 2167c88

Please sign in to comment.