taps.filter¶
Filter
¶
Bases: Protocol
Filter protocol.
A Filter is a callable object, e.g., a function, used by the
Engine
that takes an object as input and returns
a boolean indicating if the object should be transformed by
Engine
's data
Transformer
.
NeverFilterConfig
¶
NeverFilter
¶
ObjectSizeFilter
¶
Object size filter.
Checks if the size of an object (computed using
sys.getsizeof()
) is greater than a minimum size and
less than a maximum size.
Warning
sys.getsizeof()
does not count the size of objects
referred to by the main object.
Example
Parameters:
-
min_bytes
(int
, default:0
) –Minimum size threshold (inclusive) to pass through the filter.
-
max_bytes
(float
, default:inf
) –Maximum size threshold (inclusive) to pass through the filter.
Source code in taps/filter/_object.py
ObjectSizeFilterConfig
¶
ObjectTypeFilter
¶
Object type filter.
Checks if an object is of a certain type using isinstance()
or by pattern matching against the name of the type.
Example
Parameters:
-
types
(type
, default:()
) –Types to check.
-
patterns
(Sequence[str] | None
, default:None
) –Regex compatible patterns to compare against the name of the object's type.
Source code in taps/filter/_object.py
ObjectTypeFilterConfig
¶
PickleSizeFilter
¶
Object size filter.
Checks if the size of an object (computed using size of the pickled object) is greater than a minimum size and less than a maximum size.
Warning
Pickling large objects can take significant time, so this filter type is only recommended when the data transformation cost (e.g., communication or storage) is significantly greater than serialization of the objects.
Example
Parameters:
-
min_bytes
(int
, default:0
) –Minimum size threshold (inclusive) to pass through the filter.
-
max_bytes
(float
, default:inf
) –Maximum size threshold (inclusive) to pass through the filter.