FileItem (autotransform.item.file)
The implementation for the FileItem.
- class autotransform.item.file.FileItem(*, key: str, extra_data: Dict[str, Any] | None = None)
Bases:
ItemAn item representing a file that can be used by AutoTransform. Provides some utility methods for interacting with the file.
- get_content() str
Gets the content of the file.
- Returns:
The file’s content.
- Return type:
str
- get_path() str
Gets the path of the file.
- Returns:
The file’s path.
- Return type:
str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- revert() None
Reverts all changes to the file.
- write_content(content: str) None
Writes new content to the file.
- Parameters:
content (str) – The new content for the File.