[Python-modules-commits] [python-pyld] 58/276: Sort all properties except @id in normalization, fix sort bug.

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 a2c77fa28effb4b07cbbeb111a3d2a645b1045cd
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Sun Mar 4 15:39:37 2012 -0500

    Sort all properties except @id in normalization, fix sort bug.
---
 lib/pyld/jsonld.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index f7d0518..34b5d30 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -308,7 +308,7 @@ def _compareObjects(o1, o2):
     rval = 0
 
     if isinstance(o1, basestring):
-        if isinstance(o2, basestring):
+        if not isinstance(o2, basestring):
             rval = -1
         else:
             rval = _compare(o1, o2)
@@ -1048,11 +1048,10 @@ class Processor:
 
         # sort property lists that now have canonically named bnodes
         for key in edges['props']:
-            if len(edges['props'][key]['bnodes']) > 0:
-                bnode = subjects[key]
-                for p in bnode:
-                    if p.find('@') != 0 and isinstance(bnode[p], list):
-                        bnode[p].sort(_compareObjects)
+            subject = subjects[key]
+            for p in subject:
+                if p != '@id' and isinstance(subject[p], list):
+                    subject[p].sort(_compareObjects)
 
     def markSerializationDirty(self, iri, changed, dir):
         """

-- 
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