[Python-modules-commits] [python-pyld] 53/276: Remove duplicate objects when normalizing.
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 a0b45ed6a90874beec12e77dc20520f066e8bc37
Author: Dave Longley <dlongley at digitalbazaar.com>
Date: Mon Jan 16 15:53:59 2012 -0500
Remove duplicate objects when normalizing.
---
lib/pyld/jsonld.py | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index 76d750c..f7d0518 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -509,14 +509,10 @@ def _flatten(parent, parentProperty, value, subjects):
# add flattened value to parent
if flattened is not None and parent is not None:
if isinstance(parent, list):
- # do not add duplicate IRIs for the same property
- duplicate = False
- if isinstance(flattened, dict) and '@id' in flattened:
- def parentFilter(e):
- return (isinstance(e, dict) and '@id' in e and
- e['@id'] == flattened['@id'])
-
- duplicate = len(filter(parentFilter, parent)) > 0
+ # do not add duplicates for the same property
+ def parentFilter(e):
+ return (_compareObjects(e, flattened) == 0)
+ duplicate = len(filter(parentFilter, parent)) > 0
if not duplicate:
parent.append(flattened)
else:
--
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