[ARVADOS] updated: db408055a4075188129f0c5b712e5d5a970b84c9

git at public.curoverse.com git at public.curoverse.com
Thu Oct 2 13:53:39 EDT 2014


Summary of changes:
 crunch_scripts/run-command | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

       via  db408055a4075188129f0c5b712e5d5a970b84c9 (commit)
       via  b9900ad53d6ccc6bf639e400a759bfcf70b27ee4 (commit)
      from  b4dde1b5648aa71180282b7dfa0fc70ba7c87755 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit db408055a4075188129f0c5b712e5d5a970b84c9
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 13:53:27 2014 -0400

    4042: Fix syntax error

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 01ab102..8a9eb1a 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -122,7 +122,7 @@ def get_items(p, value):
                 p = pattern.match(i)
                 if p:
                     add_to_group(groups, p)
-            return [r[k] for k in r]
+            return [groups[k] for k in groups]
     if isinstance(value, list):
         return expand_list(p, value)
 

commit b9900ad53d6ccc6bf639e400a759bfcf70b27ee4
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 13:44:47 2014 -0400

    4042: Add support for filter and group of lists

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 74ad8a8..01ab102 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -101,7 +101,28 @@ def expand_item(p, c):
 def expand_list(p, l):
     return [exp for arg in l for exp in expand_item(p, arg)]
 
+def add_to_group(gr, match):
+    m = ('^_^').join(match.groups()[1:])
+    if m not in gr:
+        gr[m] = []
+    gr[m].extend(match.group(0))
+
 def get_items(p, value):
+    if isinstance(value, dict):
+        if "filter" in value and "regex" in value:
+            pattern = re.compile(value["regex"])
+            items = get_items(p, value["group"])
+            return [i for i in items if pattern.match(i)]
+
+        if "group" in value and "regex" in value:
+            pattern = re.compile(value["regex"])
+            items = get_items(p, value["group"])
+            groups = {}
+            for i in items:
+                p = pattern.match(i)
+                if p:
+                    add_to_group(groups, p)
+            return [r[k] for k in r]
     if isinstance(value, list):
         return expand_list(p, value)
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list