1
0
personal-data/personal_data/activity.py

30 lines
681 B
Python
Raw Normal View History

import dataclasses
import datetime
from collections.abc import Sequence
HIDDEN_LABEL_CATEGORY = '__'
2024-10-13 13:20:30 +00:00
@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
2024-10-13 13:20:30 +00:00
@dataclasses.dataclass(frozen=True, order=True)
2024-10-13 13:05:55 +00:00
class ActivitySample:
labels: Sequence[Label]
start_at: datetime.datetime | None
end_at: datetime.datetime | None
@dataclasses.dataclass(frozen=True, order=True)
2024-10-13 13:05:55 +00:00
class RealizedActivitySample(ActivitySample):
start_at: datetime.datetime
end_at: datetime.datetime