4042: Functions defined in get_items() now moved into expand_items()
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 3 Oct 2014 17:43:39 +0000 (13:43 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 3 Oct 2014 17:43:39 +0000 (13:43 -0400)
crunch_scripts/run-command

index 279a0e689d95cdc3f9592f5e3345a74f50eed47a..d620c7e8af8471c9c8ea3dcd4c5d3a492ab41c28 100755 (executable)
@@ -97,27 +97,6 @@ def expand_item(p, c):
             params = copy.copy(p)
             params[var] = items[int(c["index"])]
             return expand_list(params, c["command"])
             params = copy.copy(p)
             params[var] = items[int(c["index"])]
             return expand_list(params, c["command"])
-    elif isinstance(c, list):
-        return expand_list(p, c)
-    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)
-    else:
-        return [exp for arg in l for exp in expand_item(p, arg)]
-
-def add_to_group(gr, match):
-    m = ('^_^').join(match.groups())
-    if m not in gr:
-        gr[m] = []
-    gr[m].append(match.group(0))
-
-def get_items(p, value):
-    if isinstance(value, dict):
         if "regex" in value:
             pattern = re.compile(value["regex"])
             if "filter" in value:
         if "regex" in value:
             pattern = re.compile(value["regex"])
             if "filter" in value:
@@ -139,6 +118,28 @@ def get_items(p, value):
                     if p:
                         r.append(p.groups())
                 return r
                     if p:
                         r.append(p.groups())
                 return r
+    elif isinstance(c, list):
+        return expand_list(p, c)
+    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)
+    else:
+        return [exp for arg in l for exp in expand_item(p, arg)]
+
+def add_to_group(gr, match):
+    m = ('^_^').join(match.groups())
+    if m not in gr:
+        gr[m] = []
+    gr[m].append(match.group(0))
+
+def get_items(p, value):
+    if isinstance(value, dict):
+        return expand_list(p, value)
 
     if isinstance(value, list):
         return expand_list(p, value)
 
     if isinstance(value, list):
         return expand_list(p, value)