From 967e8c04aa675502f74aa87e6fe3454dc0a18467 Mon Sep 17 00:00:00 2001 From: znerol Date: Mon, 6 May 2024 16:24:27 +0200 Subject: [PATCH] Replace list comprehension with portable and readable loop --- spreadflow_mongodb/proc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spreadflow_mongodb/proc.py b/spreadflow_mongodb/proc.py index 2a7d225..7a41da4 100644 --- a/spreadflow_mongodb/proc.py +++ b/spreadflow_mongodb/proc.py @@ -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)