[Python-modules-commits] [python-pyld] 55/276: Back to the initial algorithm to merge dicts.
Wolfgang Borgert
debacle at moszumanska.debian.org
Wed Oct 8 23:47:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch master
in repository python-pyld.
commit 54bdab32530654c5620ac1e83cf1f6ea46277ad3
Author: Françoise Conil <fcodvpt at gmail.com>
Date: Fri Feb 10 13:36:39 2012 +0100
Back to the initial algorithm to merge dicts.
---
lib/pyld/jsonld.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index aec3b74..919b0b9 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -1912,15 +1912,20 @@ def mergeDicts(merged, dict):
:return: the merged dictionary.
"""
+ # if the new context contains any IRIs that are in the merged context,
+ # remove them from the merged context, they will be overwritten
for key in dict:
# ignore special keys starting with '@'
if key.find('@') != 0:
- # If key exists, value is replaced
- # Otherwise, value is created
+ for mkey in merged:
+ if merged[mkey] == dict[key]:
+ # FIXME: update related coerce rules
+ del merged[mkey]
+ break
- # Following comment was in main PyLD branch
- # FIXME: update related coerce rules
- merged[key] = dict[key]
+ # merge contexts
+ for key in dict:
+ merged[key] = dict[key]
return merged
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git
More information about the Python-modules-commits
mailing list