28 lines
679 B
Python
28 lines
679 B
Python
import dataclasses
|
|
import datetime
|
|
from collections.abc import Sequence
|
|
|
|
HIDDEN_LABEL_CATEGORY = '__'
|
|
|
|
@dataclasses.dataclass(frozen=True, order=True)
|
|
class Label:
|
|
category: str
|
|
label: str
|
|
|
|
def __post_init__(self):
|
|
assert self.category is not None
|
|
assert ':' not in self.category
|
|
assert self.label is not None
|
|
|
|
@dataclasses.dataclass(frozen=True, order=True)
|
|
class ActivitySample:
|
|
labels: Sequence[Label]
|
|
start_at: datetime.datetime | None
|
|
end_at: datetime.datetime | None
|
|
|
|
|
|
@dataclasses.dataclass(frozen=True, order=True)
|
|
class RealizedActivitySample(ActivitySample):
|
|
start_at: datetime.datetime
|
|
end_at: datetime.datetime
|