History

History of updates for an object. Provides access to time entries and derived views such as timestamps, datetimes, event ids, and intervals.

Methods

MethodDescription
collectCollect all time entries in chronological order.
collect_revCollect all time entries in reverse chronological order.
compose_historiesCompose multiple History objects into a single History by fusing their time entries in chronological order.
earliest_timeGet the earliest time entry.
is_emptyCheck whether the history has no entries.
latest_timeGet the latest time entry.
mergeMerge this History with another by interleaving entries in time order.
reverseReturn a History where iteration order is reversed.

Properties

PropertyDescription
dtAccess history events as UTC datetimes.
event_idAccess the unique event id of each time entry.
intervalsAccess the intervals between consecutive timestamps in milliseconds.
tAccess history events as timestamps (milliseconds since Unix the epoch).

Method Details

collect

Collect all time entries in chronological order.

Returns

TypeDescription
list[EventTime]Collected time entries.

collect_rev

Collect all time entries in reverse chronological order.

Returns

TypeDescription
list[EventTime]Collected time entries in reverse order.

compose_histories

Signature: compose_histories(objects)

Compose multiple History objects into a single History by fusing their time entries in chronological order.

Parameters

NameTypeDefaultDescription
objectsIterable[History]-History objects to compose.

Returns

TypeDescription
HistoryComposed History object containing entries from all inputs.

earliest_time

Get the earliest time entry.

Returns

TypeDescription
OptionalEventTimeEarliest time entry, or None if empty.

is_empty

Check whether the history has no entries.

Returns

TypeDescription
boolTrue if empty, otherwise False.

latest_time

Get the latest time entry.

Returns

TypeDescription
OptionalEventTimeLatest time entry, or None if empty.

merge

Signature: merge(other)

Merge this History with another by interleaving entries in time order.

Parameters

NameTypeDefaultDescription
otherHistory-Right-hand history to merge.

Returns

TypeDescription
HistoryMerged history containing entries from both inputs.

reverse

Return a History where iteration order is reversed.

Returns

TypeDescription
HistoryHistory that yields items in reverse chronological order.

Property Details

dt

Access history events as UTC datetimes.

Returns

TypeDescription
HistoryDateTimeDatetime view of this history.

event_id

Access the unique event id of each time entry.

Returns

TypeDescription
HistoryEventIdEvent id view of this history.

intervals

Access the intervals between consecutive timestamps in milliseconds.

Returns

TypeDescription
IntervalsIntervals view of this history.

t

Access history events as timestamps (milliseconds since Unix the epoch).

Returns

TypeDescription
HistoryTimestampTimestamp (as int) view of this history.