Last active
January 17, 2017 15:29
-
-
Save hansonkd/d076ccb72c7cdee6dc47dfaf2912db83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all_securities = Security.objects.filter(company=company).for_report().iterator() | |
def flatten(*args): | |
def transform_pipeline(mdl): | |
data = FlatData() | |
for fn in args: | |
fn(data, mdl) | |
return data | |
return transform_pipeline | |
def add_issue_date(flat, mdl): | |
flat.issue_date = mdl.get_issue_date() | |
def add_label(flat, mdl): | |
flat.label = mdl.get_label() | |
flat_securities = ( | |
conduit(all_securities) | |
... | |
.map( | |
flatten( | |
add_issue_date, | |
add_label | |
) | |
) | |
... | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment