Toolkits > com.ibm.streamsx.topology.pysamples 1.1.0 > com.ibm.streamsx.topology.pysamples.kwargs > ContainsFilter
Looks for a string term in any attribute in the tuple.
@spl.filter() class ContainsFilter(object): """ Looks for a string term in any attribute in the tuple. """ def __init__(self, term): self.term = term; def __call__(self, **tuple_): for s in tuple_.values(): if self.term in str(s): return True return False
Required: term
Tuple attribute values are passed by name to the Python callable using **kwargs.
This filter operator is configurable with one or two output ports. This first output port is mandatory.
This filter operator requires that the stream type of this output port matches the stream type of the input port. This output port receives the tuples that match the filter.
This filter operator is configurable with one or two output ports. This second output port is optional.
This filter operator requires that the stream type of this output port matches the stream type of the input port. This output port, if present, receives the tuples that fail to match the filter.
Required: term