Skip to content

minrecord.generic

minrecord.generic

Contain the generic record implementation.

minrecord.generic.Record

Bases: BaseRecord[T]

Implement a generic record to store the recent values.

Internally, this class uses a deque to keep the most recent values added in the record. Note that this class does not allow to get the best value because it is not possible to define a generic rule to know the best object. Please see ScalarRecord that can compute the best value for scalars.

Parameters:

Name Type Description Default
name str

The name of the record.

required
elements Iterable[tuple[int | None, T]]

The initial elements in the record. Each element is a tuple with the step and its associated value.

()
max_size int

The maximum size of the record.

get_max_size()
Example
>>> from minrecord import Record
>>> record = Record(name="value", elements=((None, 64.0), (None, 42.0)))
>>> record
Record(name=value, max_size=10, size=2)
>>> record.get_last_value()
42.0
>>> record.get_most_recent()
((None, 64.0), (None, 42.0))

minrecord.generic.Record.max_size property

max_size: int

The maximum size of the record.