A signal's prediction: tier_id (0-3) or None to abstain.
| 7 | |
| 8 | @dataclass(frozen=True, slots=True) |
| 9 | class TierVote: |
| 10 | """A signal's prediction: tier_id (0-3) or None to abstain.""" |
| 11 | tier_id: int | None |
| 12 | confidence: float |
| 13 | |
| 14 | def __post_init__(self): |
| 15 | if self.tier_id is not None: |
| 16 | if not isinstance(self.tier_id, int): |
| 17 | raise TypeError(f"tier_id must be int or None, got {type(self.tier_id).__name__}") |
| 18 | if not (0 <= self.tier_id <= 3): |
| 19 | raise ValueError(f"tier_id must be 0-3 or None, got {self.tier_id}") |
| 20 | if not (0.0 <= self.confidence <= 1.0): |
| 21 | raise ValueError(f"confidence must be 0.0-1.0, got {self.confidence}") |
| 22 | |
| 23 | @property |
| 24 | def abstained(self) -> bool: |
| 25 | return self.tier_id is None |
no outgoing calls