lair.clock.TimeRange#

class lair.clock.TimeRange(time_range=None, start=None, stop=None)[source]#

Bases: object

TimeRange class to represent a time range with start and stop times.

Parameters:
start#

The start time of the time range.

Type:

dt.datetime | None

stop#

The stop time of the time range.

Type:

dt.datetime | None

total_seconds#

The total number of seconds in the time range.

Type:

float

parse_iso(string: str, inclusive: bool = False) → dt.datetime[source]#

Parse the ISO8601 formatted time string and return a datetime object.

Parameters:
Return type:

datetime

static parse_iso(string, inclusive=False)[source]#

Parse the ISO8601 formatted time string and return a namedtuple with the parsed components.

Parameters:
  • string (str) – The ISO8601 formatted time string.

  • inclusive (bool)

Returns:

dt.datetime – The parsed datetime object.

Raises:

ValueError – If the time_str format is invalid.

Return type:

datetime