Transformer (autotransform.transformer.base)
The base class and associated classes for Transformer components.
- class autotransform.transformer.base.Transformer
Bases:
Generic
[TResult
],NamedComponent
The base for Transformer components. Transformers are used to execute changes to a codebase. A Transformer takes in a Batch and then executes all changes associated with the Batch.
- name
The name of the component.
- Type:
ClassVar[TransformerName]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: ClassVar[TransformerName]
- abstract transform(batch: Batch) TResult
Execute a transformation against the provided Batch. All writing should be done via CachedFile’s write_content method or FileItem’s write_content method to ensure operations are easily accessible to testing and file content cache’s are kept accurate.
- Parameters:
batch (Batch) – The Batch that will be transformed.