def documents(self):
Load datasets and return a dict similar to model Document
suffixes = ("current-year", "last-year", "previous-years")
for url in map(self.get_url, suffixes):
print("Loading " + url)
with NamedTemporaryFile() as tmp:
urlretrieve(url, filename=tmp.name)
After Change
for index, row in enumerate(csv.DictReader(file_handler)):
row["source"] = suffix
row["line"] = index + 1
yield row
def selected_documents(self, start, limit):
documents = map(self.serialize, self.documents())
for count, document in enumerate(documents):