DirectoryBatcher (autotransform.batcher.directory)

The implementation for the DirectoryBatcher.

class autotransform.batcher.directory.DirectoryBatcher(*, prefix: str, metadata: Dict[str, Any] = None)

Bases: Batcher

A batcher which separates FileItems by directory. Batches are given a title that is based on a prefix and the directory that the Batch represents.

prefix

The prefix to apply to any titles for Batches.

Type

str

metadata

The metadata to associate with Batches. Defaults to None.

Type

Optional[Dict[str, Any]], optional

name

The name of the Component.

Type

ClassVar[BatcherName]

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

Takes in a list of FileItems and separates them based on their directory.

Parameters

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

Returns

A list containing a Batch for each directory containing files.

Return type

List[Batch]

metadata: Optional[Dict[str, Any]]
name: ClassVar[BatcherName] = 'directory'
prefix: str