Skip to content

Instantly share code, notes, and snippets.

@hansonkd
Last active January 17, 2017 15:29
Show Gist options
  • Save hansonkd/ad180c813ae5beafbef0cc6d4f652594 to your computer and use it in GitHub Desktop.
Save hansonkd/ad180c813ae5beafbef0cc6d4f652594 to your computer and use it in GitHub Desktop.
all_securities = Security.objects.filter(company=company).for_report().iterator()
class FlatData(object):
pass
def add_issue_date((flat, mdl)):
flat.issue_date = mdl.get_issue_date()
return (flat, mdl)
def add_label((flat, mdl)):
flat.name = mdl.get_label()
return (flat, mdl)
flat_securities = (
conduit(all_securities)
...
.map(lambda security: (FlatData(), security))
.map(
compose(
add_issue_date,
add_label,
)
)
.map(lambda (flat, security): flat)
...
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment