-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
54 lines (41 loc) · 1.33 KB
/
Copy pathmodels.py
File metadata and controls
54 lines (41 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from __future__ import annotations
from dataclasses import dataclass, field
from decimal import Decimal
@dataclass(slots=True)
class PriceComponents:
per_kwh: dict[str, Decimal] = field(default_factory=dict)
monthly: dict[str, Decimal] = field(default_factory=dict)
@property
def per_kwh_total(self) -> Decimal:
return sum(self.per_kwh.values(), Decimal("0"))
@property
def monthly_total(self) -> Decimal:
return sum(self.monthly.values(), Decimal("0"))
@dataclass(slots=True)
class TimeWindow:
label: str
weekdays_only: bool = False
weekends_only: bool = False
weekends_all_day: bool = False
hour_ranges: list[tuple[int, int]] = field(default_factory=list)
months: set[int] = field(default_factory=lambda: set(range(1, 13)))
@dataclass(slots=True)
class SeasonalPeriodRate:
season_name: str
period_name: str
components: PriceComponents
window: TimeWindow
@dataclass(slots=True)
class RatePlan:
code: str
name: str
periods: list[SeasonalPeriodRate]
notes: list[str] = field(default_factory=list)
@dataclass(slots=True)
class ParsedRateCard:
source_url: str
effective_date: str | None
rates: dict[str, RatePlan]
raw_text_hash: str
pscr_rates: dict[str, Decimal] = field(default_factory=dict)
pscr_source_url: str | None = None