diff --git a/saucebrush/__init__.py b/saucebrush/__init__.py index 648ec78..767766d 100644 --- a/saucebrush/__init__.py +++ b/saucebrush/__init__.py @@ -37,7 +37,7 @@ class Recipe(filters.Filter): # connect datapath data = source for filter_ in filters: - data = filter_(data, recipe=self) + data = filter_.attach(data, recipe=self) # actually run the data through (causes iterators to actually be called) for record in data: diff --git a/saucebrush/filters.py b/saucebrush/filters.py index a63a59d..77b5db2 100644 --- a/saucebrush/filters.py +++ b/saucebrush/filters.py @@ -35,7 +35,7 @@ class Filter(object): if recipe: recipe.reject_record(record, message) - def __call__(self, source, recipe=None): + def attach(self, source, recipe=None): self._recipe = recipe for record in source: result = self.process_record(record) @@ -51,7 +51,7 @@ class YieldFilter(Filter): filter must derive from YieldFilter. """ - def __call__(self, source, recipe=None): + def attach(self, source, recipe=None): self._recipe = recipe for record in source: for result in self.process_record(record): @@ -286,10 +286,10 @@ class Splitter(Filter): for filter_ in filters: subrecord = filter_.process_record(subrecord) - # if a list or tuple, use __call__ + # if a list or tuple, use attach elif isinstance(subrecord, (list, tuple)): for filter_ in filters: - subrecord = filter_(subrecord, recipe=self._recipe) + subrecord = filter_.attach(subrecord, recipe=self._recipe) subrecord = [r for r in subrecord] # unchain generators # place back from whence it came