Skip to content

Commit

Permalink
Replace list comprehension with portable and readable loop
Browse files Browse the repository at this point in the history
  • Loading branch information
znerol committed May 6, 2024
1 parent cadf2ca commit 967e8c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spreadflow_mongodb/proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ def __call__(self, item, send):
send(cmd, self)

if len(item['inserts']):
docs = [dict(item['data'][oid].items() + [('_id', oid)]) for oid in item['inserts']]
docs = []
for oid in item['inserts']:
doc = item['data'][oid].copy()
doc['_id'] = oid
docs.append(doc)
cmd = self._format_cmd('insert_many', docs)
send(cmd, self)

Expand Down

0 comments on commit 967e8c0

Please # to comment.