ButlerLogRecords¶
- class lsst.daf.butler.ButlerLogRecords(root: RootModelRootType = PydanticUndefined)¶
Bases:
_ButlerLogRecords
Class representing a collection of
ButlerLogRecord
.Attributes Summary
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].Metadata about the fields defined on the model, mapping of field names to [
FieldInfo
][pydantic.fields.FieldInfo].Methods Summary
append
(value)clear
()extend
(records)from_file
(filename)Read records from file.
from_raw
(serialized)Parse raw serialized form and return records.
from_records
(records)Create collection from iterable.
from_stream
(stream)Read records from I/O stream.
insert
(index, value)model_post_init
(__context)This function is meant to behave like a BaseModel method to initialise private attributes.
pop
([index])reverse
()set_log_format
(format)Set the log format string for these records.
Attributes Documentation
- log_format¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict
][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=list[ButlerLogRecord], required=True)}¶
Metadata about the fields defined on the model, mapping of field names to [
FieldInfo
][pydantic.fields.FieldInfo].This replaces
Model.__fields__
from Pydantic V1.
Methods Documentation
- append(value: LogRecord | ButlerLogRecord) None ¶
- extend(records: Iterable[LogRecord | ButlerLogRecord]) None ¶
- classmethod from_file(filename: str) ButlerLogRecords ¶
Read records from file.
- Parameters:
- filename
str
Name of file containing the JSON records.
- filename
Notes
Works with one-record-per-line format JSON files and a direct serialization of the Pydantic model.
- classmethod from_raw(serialized: str | bytes) ButlerLogRecords ¶
Parse raw serialized form and return records.
- classmethod from_records(records: Iterable[ButlerLogRecord]) ButlerLogRecords ¶
Create collection from iterable.
- Parameters:
- recordsiterable of
ButlerLogRecord
The records to seed this class with.
- recordsiterable of
- classmethod from_stream(stream: IO) ButlerLogRecords ¶
Read records from I/O stream.
- Parameters:
- stream
typing.IO
Stream from which to read JSON records.
- stream
Notes
Works with one-record-per-line format JSON files and a direct serialization of the Pydantic model.
- insert(index: int, value: LogRecord | ButlerLogRecord) None ¶
- model_post_init(__context: Any) None ¶
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Args:
self: The BaseModel instance. __context: The context.
- pop(index: int = -1) ButlerLogRecord ¶