FileFormatter¶
- class lsst.daf.butler.formatters.file.FileFormatter(fileDescriptor: FileDescriptor, dataId: DataCoordinate, writeParameters: dict[str, Any] | None = None, writeRecipes: dict[str, Any] | None = None)¶
Bases:
Formatter
Interface for reading and writing files on a POSIX file system.
Attributes Summary
Default file extension to use for writing files.
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.
Attributes Documentation
- extension: str | None = None¶
Default file extension to use for writing files. None means that no modifications will be made to the supplied file extension. (
str
)
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:
- NotImplementedError
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
StorageClass
for reading differed from theStorageClass
used 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.
- NotImplementedError
Formatter does not implement a method to read from files.