Filters remove some lines from the flux.

class rdc.etl.transform.filter.Filter(filter=None)[source]

Filter out hashes from the stream depending on the filter callable return value, when called with the current hash as parameter.

Can be used as a decorator on a filter callable.


A callable used to filter the hashes. If return value is True for a given hash, then the hash will be yield to output. Otherwise, it will be burnt.


>>> from rdc.etl.transform.filter import Filter
>>> from rdc.etl.hash import Hash

>>> @Filter
... def my_filter(hash, channel):
...     return hash['keepme'] == True

>>> list(my_filter(
...         (('foo', 'bar'), ('keepme', True), ),
...         (('foo', 'baz'), ('keepme', False), ),
...     ))
[H{'foo': 'bar', 'keepme': True}]