ButlerLogRecords¶
- class lsst.daf.butler.logging.ButlerLogRecords(root: RootModelRootType = PydanticUndefined)¶
Bases:
_ButlerLogRecords
Class representing a collection of
ButlerLogRecord
.Attributes Summary
A dictionary of computed field names and their corresponding
ComputedFieldInfo
objects.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] objects.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_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]] = {'root': FieldInfo(annotation=list[ButlerLogRecord], required=True)}¶
Metadata about the fields defined on the model, mapping of field names to [
FieldInfo
][pydantic.fields.FieldInfo] objects.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.
- Parameters:
- serialized
bytes
orstr
Either the serialized JSON of the model created using
.model_dump_json()
or a streaming format of one JSONButlerLogRecord
per line. This can also support a zero-length string.
- serialized
- 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 ¶