def test_filtering(self): def my_gen(): yield 1 yield None yield 2 gen = no_none(my_gen) assert [1, 2] == [x for x in gen()]
def configure(self): """Configure the workflows associated with this pipeline by calling the _configure function. Return the global doit config dict. Side effect: populate the task_dicts attribute with a list of doit tasks. You'll need this to get the tasks() method to return something other than an empty generator. """ default_tasks = list() self.task_dicts = list() self._configure = no_none(self._configure) nested_dicts = self._configure() flat_dicts = generator_flatten(nested_dicts) for d in self.filter_tasks(flat_dicts): default_tasks.append(d["name"]) self.task_dicts.append(d) # return the global doit config dictionary return { "default_tasks": default_tasks, "continue": True, "pipeline_name": self.name }