Filter (autotransform.filter.base)
The base class and associated classes for Filter components.
- class autotransform.filter.base.BulkFilter(*, inverted: bool = False)
Bases:
FilterThe base for BulkFilter components. Handles validation in bulk to determine valid Items.
- _valid_keys
Whether to invert the results of the filter. Defaults to an None.
- Type:
Optional[List[str]], optional
- name
The name of the component.
- Type:
ClassVar[FilterName]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- class autotransform.filter.base.Filter(*, inverted: bool = False)
Bases:
NamedComponentThe base for Filter components. Used by AutoTransform to determine if an Item from an Input is eligible for transformation.
- inverted
Whether to invert the results of the filter. Defaults to False.
- Type:
bool, optional
- name
The name of the component.
- Type:
ClassVar[FilterName]
- inverted: bool
- is_valid(item: Item) bool
Check whether an Item is valid based on the Filter and handle inversion.
- Parameters:
item (Item) – The Item to check.
- Returns:
Returns True if the Item is eligible for transformation.
- Return type:
bool
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: ClassVar[FilterName]