aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-06-03 21:39:25 +0300
committerBonfaceKilz2021-06-03 21:58:31 +0300
commit9a07a39e943a406152b10eda984d5949223cef47 (patch)
treed3e5ef2020fedd8723eac880a10146c265955931
parentd0042a3cd95d164468a69ab17ee0c3adba5ea296 (diff)
downloadgenenetwork3-9a07a39e943a406152b10eda984d5949223cef47.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_