[Python-modules-commits] [python-pyld] 37/276: Support @context in frame arrays.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:47:51 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 f8ae939a27a0bd564a954989fbeffac683dc2350
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Wed Nov 9 12:45:16 2011 -0500

    Support @context in frame arrays.
---
 lib/pyld/jsonld.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index df7455a..bc1e519 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -1411,8 +1411,18 @@ class Processor:
         if '@context' in frame:
             ctx = copy.copy(frame['@context'])
 
-        # remove context from frame
-        frame = expand(frame)
+            # remove context from frame
+            frame = expand(frame)
+        elif isinstance(frame, list):
+            # save first context in the array
+            if len(frame) > 0 and '@context' in frame[0]:
+                ctx = copy.copy(frame['@context'])
+
+            # expand all elements in the array
+            tmp = []
+            for f in frame:
+                tmp.append(expand(f))
+            frame = tmp
 
         # create framing options
         # TODO: merge in options from function parameter

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