Operator ContainsFilter

# Operator `ContainsFilter`

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.

## Python

    @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

## Summary

Ports
  This operator has 1 input port and 2 output ports.
Windowing
  This operator does not accept any windowing configurations.
Parameters
  This operator supports 1 parameter.

  Required: term

Metrics
  This operator does not report any metrics.

## Properties

Implementation
  C++
Threading
  `Always` - Operator always provides a single threaded execution context.

Input Ports

Ports (0)

  Tuple attribute values are passed by name to the Python callable using `**kwargs`.

  Properties
    - Optional: false
    - ControlPort: false
    - TupleMutationAllowed: false
    - WindowingMode: NonWindowed
    - WindowPunctuationInputMode: Oblivious

Output Ports

Ports (0)

  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.

  Assignments
    This port set does not allow assignments to output attributes.

  Properties
    - Optional: false
    - TupleMutationAllowed: false
    - WindowPunctuationOutputMode: Preserving

Ports (1)

  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.

  Assignments
    This port set does not allow assignments to output attributes.

  Properties
    - Optional: true
    - TupleMutationAllowed: false
    - WindowPunctuationOutputMode: Preserving

Parameters

This operator supports 1 parameter.

Required: term

`term`
  Properties
    - Type
    - Cardinality: 1
    - Optional: false
    - ExpressionMode: AttributeFree

Libraries

`SPLPY header`
  Include Path: `../../opt/.splpy/include`
`Python libraries.`
  Command: ../../opt/.splpy/common/pyversion3.sh