-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_script.py
More file actions
40 lines (31 loc) · 993 Bytes
/
Copy pathtest_script.py
File metadata and controls
40 lines (31 loc) · 993 Bytes
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
from pydantic import BaseModel, ConfigDict, Field
class ChargerType:
fast = "fast"
medium = "medium"
high = "high"
critical = "critical"
class StationState(BaseModel):
model_config = ConfigDict(extra="forbid")
station_id: str = Field(..., description="Stable id like BLR-01")
neighborhood_slug: str = Field(..., description="Canonical slug like 'koramangala'")
neighborhood_name: str = Field(..., description="Display name like 'Koramangala'")
lat: float
lng: float
charger_type: str
total_slots: int = Field(..., ge=1)
occupied_slots: int = Field(0, ge=0)
queue_length: int = Field(0, ge=0)
price_per_kwh: float = Field(0.0, ge=0.0)
avg_wait_minutes: float = Field(0.0, ge=0.0)
s = StationState(
station_id="1",
neighborhood_slug="2",
neighborhood_name="3",
lat=1.0,
lng=1.0,
charger_type="fast",
total_slots=10,
occupied_slots=1,
)
print(type(s.occupied_slots))
print(s.occupied_slots)