Skip to content

Commit

Permalink
Merge pull request #170 from dimagi/sk/use-generator
Browse files Browse the repository at this point in the history
don't evaluate the generator
  • Loading branch information
snopoke authored Dec 11, 2020
2 parents 9e6be92 + 27751f9 commit 5f54ab9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion commcare_export/minilinq.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def eval(self, env):
env.emit_table(TableSpec(
name=self.table,
headings=[heading.eval(env) for heading in self.headings],
rows=list(map(self.coerce_row, rows)),
rows=map(self.coerce_row, rows),
data_types=[lit.v for lit in self.data_types]
))

Expand Down
2 changes: 0 additions & 2 deletions commcare_export/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ def __eq__(self, other):
isinstance(other, TableSpec)
and other.name == self.name
and other.headings == self.headings
and other.rows == self.rows
and other.data_types == self.data_types
)

def toJSON(self):
return {
'name': self.name,
'headings': self.headings,
'rows': self.rows,
'data_types': self.data_types,
}
4 changes: 2 additions & 2 deletions commcare_export/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ def write_table(self, table):
else:
assert self.tables[table.name].headings == list(table.headings)

self.tables[table.name].rows.extend(
self.tables[table.name].rows = list(self.tables[table.name].rows) + [
[to_jvalue(v) for v in row] for row in table.rows
)
]


class StreamingMarkdownTableWriter(TableWriter):
Expand Down

0 comments on commit 5f54ab9

Please sign in to comment.