if sex_place:
q.put(csv_line_as_string(sex_place))
write_queue = Queue()
place_search = Process(target=make_queue, args=(write_queue, companies))
place_search.start()
with lzma.open(OUTPUT, "at") as output:
while place_search.is_alive() or not write_queue.empty():
try:
After Change
dicts = map(lambda x: dict(x._asdict()), companies.itertuples(index=True))
with Pool(processes=4) as pool:
for place in pool.imap(sex_place_nearby, tuple(dicts)):
if place:
yield csv_line_as_string(place)
def csv_line_as_string(company=None, **kwargs):
Receives a given company (dict) and returns a string representnig this
company data in a CSV format. CSV headers are defined in `fieldnames`.