1
0
personal-data/personal_data/activity.py
Jon Michael Aanes 72be664d82
All checks were successful
Test Python / Test (push) Successful in 31s
Ruff
2024-10-13 15:20:30 +02:00

30 lines
681 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