Everything

Contents

Everything#

class brainstate.util.Everything[source]#

Filter that matches all objects.

This filter always returns True, effectively disabling filtering. It’s useful as a default filter or when you want to select everything in a structure.

Examples

>>> from brainstate.util.filter import Everything
>>>
>>> # Create a filter that matches everything
>>> all_filter = Everything()
>>>
>>> # Always returns True
>>> all_filter([], 'any_object')
True
>>> all_filter(['some', 'path'], 42)
True
>>> all_filter([], None)
True
>>>
>>> # Useful as a default filter
>>> def process_data(data, filter=None):
...     if filter is None:
...         filter = Everything()
...     # Process all data when no specific filter is provided

See also

Nothing

Filter that matches no objects

to_predicate

Convert True to Everything filter

Notes

This filter is equivalent to using to_predicate(True) or to_predicate(...) (Ellipsis).