[ARVADOS] updated: e12e1407240e7362ae4156fe4d32599b9b5d4d8d

git at public.curoverse.com git at public.curoverse.com
Thu Oct 2 15:20:47 EDT 2014


Summary of changes:
 crunch_scripts/run-command | 47 ++++++++++++++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 16 deletions(-)

       via  e12e1407240e7362ae4156fe4d32599b9b5d4d8d (commit)
       via  08181a95191f00f2069758625512ada2788646e2 (commit)
       via  a1fb326e2568abf864f4282f0110ec577a6195aa (commit)
       via  8b23d1fb41d8655b81086c6073e28ef3c3a144c5 (commit)
       via  7b77e0a48d265f3ac56017ee22be4a97d779b063 (commit)
       via  23053a2d35694a9e8a7169c493620c3a33bd78f2 (commit)
       via  508dcd2f13881bc8ac93b2e7189d6e57500a8acc (commit)
      from  11699475c3d0f9c4b9d1eb50d9032a7fc5984ec9 (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 e12e1407240e7362ae4156fe4d32599b9b5d4d8d
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 15:18:27 2014 -0400

    4042: another expand fix

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 40fb712..279a0e6 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -99,14 +99,14 @@ def expand_item(p, c):
             return expand_list(params, c["command"])
     elif isinstance(c, list):
         return expand_list(p, c)
-    elif isinstance(c, str) or isinstance(c, unicode):
+    elif isinstance(c, basestring):
         return [subst.do_substitution(p, c)]
 
     return []
 
 def expand_list(p, l):
     if isinstance(l, basestring):
-        return [expand_item(p, l)]
+        return expand_item(p, l)
     else:
         return [exp for arg in l for exp in expand_item(p, arg)]
 

commit 08181a95191f00f2069758625512ada2788646e2
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 15:15:08 2014 -0400

    4042: expand list fix

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 9c30f41..40fb712 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -96,7 +96,7 @@ def expand_item(p, c):
             items = get_items(p, p[var])
             params = copy.copy(p)
             params[var] = items[int(c["index"])]
-            r.extend(expand_list(params, c["command"]))
+            return expand_list(params, c["command"])
     elif isinstance(c, list):
         return expand_list(p, c)
     elif isinstance(c, str) or isinstance(c, unicode):

commit a1fb326e2568abf864f4282f0110ec577a6195aa
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 15:12:14 2014 -0400

    4042: add command pattern to list index

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 0d45fab..9c30f41 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -91,10 +91,12 @@ def expand_item(p, c):
                 params[var] = i
                 r.extend(expand_list(params, c["command"]))
             return r
-        if "list" in c and "index" in c:
+        if "list" in c and "index" in c and "command" in c:
             var = c["list"]
             items = get_items(p, p[var])
-            return items[int(c["index"])]
+            params = copy.copy(p)
+            params[var] = items[int(c["index"])]
+            r.extend(expand_list(params, c["command"]))
     elif isinstance(c, list):
         return expand_list(p, c)
     elif isinstance(c, str) or isinstance(c, unicode):
@@ -103,7 +105,10 @@ def expand_item(p, c):
     return []
 
 def expand_list(p, l):
-    return [exp for arg in l for exp in expand_item(p, arg)]
+    if isinstance(l, basestring):
+        return [expand_item(p, l)]
+    else:
+        return [exp for arg in l for exp in expand_item(p, arg)]
 
 def add_to_group(gr, match):
     m = ('^_^').join(match.groups())

commit 8b23d1fb41d8655b81086c6073e28ef3c3a144c5
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 15:04:35 2014 -0400

    4042: fix bad keys

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 1e6f3a7..0d45fab 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -113,30 +113,27 @@ def add_to_group(gr, match):
 
 def get_items(p, value):
     if isinstance(value, dict):
-        if "filter" in value and "regex" in value:
+        if "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 [groups[k] for k in groups]
-
-        if "extract" in value and "regex" in value:
-            pattern = re.compile(value["regex"])
-            items = get_items(p, value["group"])
-            r = []
-            for i in items:
-                p = pattern.match(i)
-                if p:
-                    r.append(p.groups())
-            return r
+            if "filter" in value:
+                items = get_items(p, value["filter"])
+                return [i for i in items if pattern.match(i)]
+            elif "group" in value:
+                items = get_items(p, value["group"])
+                groups = {}
+                for i in items:
+                    p = pattern.match(i)
+                    if p:
+                        add_to_group(groups, p)
+                return [groups[k] for k in groups]
+            elif "extract" in value:
+                items = get_items(p, value["extract"])
+                r = []
+                for i in items:
+                    p = pattern.match(i)
+                    if p:
+                        r.append(p.groups())
+                return r
 
     if isinstance(value, list):
         return expand_list(p, value)

commit 7b77e0a48d265f3ac56017ee22be4a97d779b063
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 15:01:46 2014 -0400

    4042: fix bad syntax

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 3b58186..1e6f3a7 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -131,7 +131,12 @@ def get_items(p, value):
         if "extract" in value and "regex" in value:
             pattern = re.compile(value["regex"])
             items = get_items(p, value["group"])
-            return [p.groups() for i in items if p = pattern.match(i)]
+            r = []
+            for i in items:
+                p = pattern.match(i)
+                if p:
+                    r.append(p.groups())
+            return r
 
     if isinstance(value, list):
         return expand_list(p, value)

commit 23053a2d35694a9e8a7169c493620c3a33bd78f2
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 14:58:20 2014 -0400

    4042: Add list index

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 23cb0e6..3b58186 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -91,6 +91,10 @@ def expand_item(p, c):
                 params[var] = i
                 r.extend(expand_list(params, c["command"]))
             return r
+        if "list" in c and "index" in c:
+            var = c["list"]
+            items = get_items(p, p[var])
+            return items[int(c["index"])]
     elif isinstance(c, list):
         return expand_list(p, c)
     elif isinstance(c, str) or isinstance(c, unicode):

commit 508dcd2f13881bc8ac93b2e7189d6e57500a8acc
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Oct 2 14:49:58 2014 -0400

    4042: add "extract"

diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command
index 57bf3c7..23cb0e6 100755
--- a/crunch_scripts/run-command
+++ b/crunch_scripts/run-command
@@ -122,9 +122,13 @@ def get_items(p, value):
                 p = pattern.match(i)
                 if p:
                     add_to_group(groups, p)
-            print groups
             return [groups[k] for k in groups]
 
+        if "extract" in value and "regex" in value:
+            pattern = re.compile(value["regex"])
+            items = get_items(p, value["group"])
+            return [p.groups() for i in items if p = pattern.match(i)]
+
     if isinstance(value, list):
         return expand_list(p, value)
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list