pipeline: allow non-generator iterators

This commit is contained in:
Adrian Sampson 2012-10-09 10:35:48 -07:00
parent 74a661696e
commit 3de2b7f090

View file

@ -304,11 +304,11 @@ class Pipeline(object):
raise ValueError('pipeline must have at least two stages')
self.stages = []
for stage in stages:
if isinstance(stage, types.GeneratorType):
if isinstance(stage, (list, tuple)):
self.stages.append(stage)
else:
# Default to one thread per stage.
self.stages.append((stage,))
else:
self.stages.append(stage)
def run_sequential(self):
"""Run the pipeline sequentially in the current thread. The