-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvehicle.py
More file actions
72 lines (69 loc) · 3.38 KB
/
Copy pathvehicle.py
File metadata and controls
72 lines (69 loc) · 3.38 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from datetime import datetime
from typing import Optional
from .propulsion_type import PropulsionType
from .vehicle_type import VehicleType
from .body_type import BodyType
from .use_type import UseType
from .insurance import Insurance
from pydantic import (
BaseModel,
create_model,
ConfigDict,
)
class Vehicle(BaseModel):
"""This class represents a vehicle returned from DMR.
Attributes:
make: The make/manufacturer of the vehicle
model: The vehicle model, if the vehicle were to be a Suzuki Swift, then the model would be "Swift\"
variant: This is the variant of the model, a VW Golf GTI, would have the GTI variation of the Golf model
type: The type of vehicle
color: The color of the vehicle, typically None
total_weight: The maximum weight the vehicle can be when fully loaded, value is in KG
vin: The vehicles identification number (VIN)
last_update: The last vehicle update, this could be the latest re-registration
registration_number: The vehicles license plate
first_registration: The date where the vehicle was first registered
use: The type of usage the vehicle is being used for
model_year: The model year of the vehicle
vehicle_weight: The weight of the vehicle. The value returned is in KG
propulsion: The type fuel needed to use the vehicle
tow_bar: Whether the vehicle has a tow bar
fuel_consumption: The fuel consumption of the vehicle, the value can be km/L if the vehicle runs on Benzin or Diesel
cylinders: The amount of cylinders the vehicle has. A return value of None doesn't necessarily mean that the vehicle has no cylinders
plugin_hybrid: Whether the vehicle is a Plug-In hybrid
electricity_consumption: The electric consumption of the vehicle, the value can be Wh/km
electric_range: The electric range of the vehicle, value is in km
battery_capacity: The battery capacity of the vehicle, value is in kWh
body_type: The body type of the vehicle
vehicle_id: The vehicle ID in the DMR system
doors: The amount of doors the vehicle has
particle_filter: Whether the vehicle has a particle filter
insurance: An insurance object
"""
model_config = ConfigDict(protected_namespaces=())
make: str
model: str
variant: str
type: VehicleType
color: Optional[str]
total_weight: int
vin: str
last_update: datetime
registration_number: str
first_registration: datetime
use: UseType
model_year: Optional[int]
vehicle_weight: Optional[int]
propulsion: PropulsionType
tow_bar: bool
fuel_consumption: Optional[float]
cylinders: Optional[int]
plugin_hybrid: bool
electricity_consumption: Optional[float]
electric_range: Optional[float]
battery_capacity: Optional[float]
body_type: Optional[BodyType]
vehicle_id: int
doors: Optional[int]
particle_filter: Optional[bool]
insurance: Optional[create_model("Insurance", __base__=Insurance)]