Filter (autotransform.filter.base)

The base class and associated classes for Filter components.

class autotransform.filter.base.Filter(*, inverted: bool = False)

Bases: NamedComponent

The 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

name: ClassVar[FilterName]
class autotransform.filter.base.FilterName(value)

Bases: str, Enum

A simple enum for mapping.

AGGREGATE = 'aggregate'
CODEOWNERS = 'codeowners'
KEY_HASH_SHARD = 'key_hash_shard'
REGEX = 'regex'
REGEX_FILE_CONTENT = 'regex_file_content'