ExtraDataBatcher (autotransform.batcher.extradata)

The implementation for the ExtraDataBatcher.

class autotransform.batcher.extradata.ExtraDataBatcher(*, group_by: str, metadata_keys: List[str] = None)

Bases: Batcher

A Batcher which uses the extra data on Items to create batches.

group_by

The key of the extra_data on items to group Items by for Batches.

Type:

str

metadata_keys

A list of keys from Items to combine in to the metadata of a batch. Defaults to [].

Type:

optional, List[str]

name

The name of the Component.

Type:

ClassVar[BatcherName]

batch(items: Sequence[Item]) List[Batch]

Take filtered Items and group them by an extra_data value.

Parameters:

items (Sequence[Item]) – The filtered Items to separate.

Returns:

A list of Batches grouped by the extra_data of the Items.

Return type:

List[Batch]

group_by: str
metadata_keys: List[str]
name: ClassVar[BatcherName] = 'extra_data'