Move some stuff around to make it more flexible.

This commit is contained in:
Dave Halter
2017-07-08 19:00:03 +02:00
parent b1f9e17c5f
commit 968ce4759a
3 changed files with 13 additions and 13 deletions

View File

@@ -7,6 +7,15 @@ class Normalizer(object):
self._config = config
self.issues = []
def visit(self, node):
try:
children = node.children
except AttributeError:
return self.visit_leaf(node)
else:
with self.visit_node(node):
return ''.join(self.visit(child) for child in children)
@contextmanager
def visit_node(self):
yield