Commit c47334f6 authored by Marc Betoule's avatar Marc Betoule
Browse files

working crossprod

parent 0775ce1d
......@@ -44,7 +44,6 @@ def cross_prod(*args):
res.extend([(a,)+b for b in l2])
return res
def union(*args):
""" Return the union of the input sets.
......@@ -73,31 +72,6 @@ def union(*args):
l.extend(zip(l_))
return l
def gather(*args):
""" Return the gathering of the input sets.
Parameters
----------
args : a sequence of lists.
Returns
-------
a list of one tuple.
Examples
--------
>>> print(len(gather(['a','b'])))
1
>>> print(len(gather(['a','b'],[1,2,3])))
1
>>> print(len(gather(['a','b'],[1,2,3],[0.1,0.2,0.3,0.4])))
1
"""
l = []
for l_ in args:
l.extend(l_)
return [l]
def _group(l, parent_list, code):
""" Compute the cross product and group the similar entries.
>>> group([('a',1),('b',2)],[(1,3),(1,4),(1,5)])
......
......@@ -167,11 +167,15 @@ class TaskList:
a.append(b)
output_set = method (*a)
output_set = filter multiplex
if directive.where:
f = multiplex._filter(parent_list, directive.where)
output_set = filter(f, output_set)
if directive.group_by:
output_set = multiplex._group(output_set, parent_list, directive.group_by)
## e for each task to push
lst_task = [Task(seg, make_dict([(r[2],r[0]) for r in e]), status='queued', parents=[r[1] for r in e if r[1] is not None]) for e in output_set]
for l in lst_task:
print str(l)+"parents: "
print l.parents
return lst_task
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment