aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-06-03 21:39:25 +0300
committerzsloan2021-06-18 22:08:04 +0000
commitd769bfcc38a14720fa888e2b7c0ff874cc91f6a2 (patch)
tree1ae551238f58c901e72a379f9d0f1906e7174a36
parent4c9bbe6d4229b79a1bc62cf2f641fbc4c4f00abc (diff)
downloadgenenetwork3-d769bfcc38a14720fa888e2b7c0ff874cc91f6a2.tar.gz
gn3: db: Replace items() with keys()
* gn3/db/__init__.py (diff_from_dict): We only use the keys of the dict!
-rw-r--r--gn3/db/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py
index ce92a7d..d62b575 100644
--- a/gn3/db/__init__.py
+++ b/gn3/db/__init__.py
@@ -93,6 +93,7 @@ def insert(conn: Any,
conn.commit()
return cursor.rowcount
+
def diff_from_dict(old: Dict, new: Dict) -> Dict:
"""Construct a new dict with a specific structure that contains the difference
between the 2 dicts in the structure:
@@ -104,6 +105,6 @@ Should return:
{"id": {"old": 1, "new": 2}, "data": {"old": "a", "new": "b"}}
"""
dict_ = {}
- for key, value in old.items():
+ for key in old.keys():
dict_[key] = {"old": old[key], "new": new[key]}
return dict_