Skip to content

History #

Bases: object

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

dt property #

Access history events as UTC datetimes.

Returns:

Type Description
HistoryDateTime

Datetime view of this history.

event_id property #

Access the unique event id of each time entry.

Returns:

Type Description
HistoryEventId

Event id view of this history.

intervals property #

Access the intervals between consecutive timestamps in milliseconds.

Returns:

Type Description
Intervals

Intervals view of this history.

t property #

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

Returns:

Type Description
HistoryTimestamp

Timestamp (as int) view of this history.

__contains__(key) #

Return bool(key in self).

__eq__(value) #

Return self==value.

__ge__(value) #

Return self>=value.

__getitem__(key) #

Return self[key].

__gt__(value) #

Return self>value.

__iter__() #

Implement iter(self).

__le__(value) #

Return self<=value.

__len__() #

Return len(self).

__lt__(value) #

Return self<value.

__ne__(value) #

Return self!=value.

__repr__() #

Return repr(self).

__reversed__() #

Iterate over all time entries in reverse chronological order.

Returns:

Type Description
Iterator[EventTime]

Iterator over time entries in reverse order.

collect() #

Collect all time entries in chronological order.

Returns:

Type Description
list[EventTime]

Collected time entries.

collect_rev() #

Collect all time entries in reverse chronological order.

Returns:

Type Description
list[EventTime]

Collected time entries in reverse order.

compose_histories(objects) staticmethod #

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

Parameters:

Name Type Description Default
objects Iterable[History]

History objects to compose.

required

Returns:

Type Description
History

Composed History object containing entries from all inputs.

earliest_time() #

Get the earliest time entry.

Returns:

Type Description
OptionalEventTime

Earliest time entry, or None if empty.

is_empty() #

Check whether the history has no entries.

Returns:

Type Description
bool

True if empty, otherwise False.

latest_time() #

Get the latest time entry.

Returns:

Type Description
OptionalEventTime

Latest time entry, or None if empty.

merge(other) #

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

Parameters:

Name Type Description Default
other History

Right-hand history to merge.

required

Returns:

Type Description
History

Merged history containing entries from both inputs.

reverse() #

Return a History where iteration order is reversed.

Returns:

Type Description
History

History that yields items in reverse chronological order.