FileFormatter¶
- class lsst.daf.butler.formatters.file.FileFormatter(fileDescriptor: FileDescriptor, *, dataId: DataCoordinate | None = None, writeParameters: Mapping[str, Any] | None = None, writeRecipes: Mapping[str, Any] | None = None, **kwargs: Any)¶
Bases:
FormatterInterface for reading and writing files on a POSIX file system.
Methods Summary
fromBytes(serializedDataset[, component])Read serialized data into a Dataset or its component.
read([component])Read data from a file.
toBytes(inMemoryDataset)Serialize the Dataset to bytes based on formatter.
write(inMemoryDataset)Write a Python object to a file.
Methods Documentation
- fromBytes(serializedDataset: bytes, component: str | None = None) Any¶
Read serialized data into a Dataset or its component.
- Parameters:
- Returns:
- inMemoryDataset
object The requested data as a Python object. The type of object is controlled by the specific formatter.
- inMemoryDataset
- Raises:
- FormatterNotImplementedError
Formatter does not support reading from bytes.
- read(component: str | None = None) Any¶
Read data from a file.
- Parameters:
- component
str, optional Component to read from the file. Only used if the
StorageClassfor reading differed from theStorageClassused to write the file.
- component
- Returns:
- inMemoryDataset
object The requested data as a Python object. The type of object is controlled by the specific formatter.
- inMemoryDataset
- Raises:
- ValueError
Component requested but this file does not seem to be a concrete composite.
- FormatterNotImplementedError
Formatter does not implement a method to read from files.