Skip to content

Commit

Permalink
Cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Mikulicic committed Jul 29, 2012
1 parent 688dc33 commit 699ffa3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions metacontext/__init__.py
Expand Up @@ -151,21 +151,21 @@ def expand(self, q, loc):
unquote_bind = UnquoteBindKeyword()
unquote_keywords = {'unquote_bind': unquote_bind}

qs = [SyntaxTransformer(unquote_keywords).visit(i) for i in q]
del q[0:len(q)]
for i in qs:
if isinstance(i, list):
q.extend(i)
else:
q.append(i)
def flatten(l):
res = []
for i in l:
if isinstance(i, list):
res.extend(i)
else:
res.append(i)
return res

qs = [TemplateExpander(loc, unquote_bind.bound_vars).visit(i) for i in q]
del q[0:len(q)]
for i in qs:
if isinstance(i, list):
q.extend(i)
else:
q.append(i)
def replace(q, l):
del q[0:len(q)]
q.extend(l)

replace(q, flatten([SyntaxTransformer(unquote_keywords).visit(i) for i in q]))
replace(q, flatten([TemplateExpander(loc, unquote_bind.bound_vars).visit(i) for i in q]))

line_fixer = LineFixer()
for i in q:
Expand Down

0 comments on commit 699ffa3

Please sign in to comment.