Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pre-commit from 3.6.0 to 3.6.1 #332

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions mytoyota/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, controller: Controller) -> None:
Returns:
-------
None

"""
self.controller = controller

Expand Down Expand Up @@ -96,6 +97,7 @@ async def get_location_endpoint(self, vin: str) -> LocationResponseModel:
Returns:
-------
LocationResponseModel: A pydantic model for the location response

"""
parsed_response = await self._request_and_parse(
LocationResponseModel, "GET", VEHICLE_LOCATION_ENDPOINT, vin=vin
Expand All @@ -116,6 +118,7 @@ async def get_vehicle_health_status_endpoint(self, vin: str) -> VehicleHealthRes
Returns:
-------
VehicleHealthResponseModel: A pydantic model for the vehicle health response

"""
parsed_response = await self._request_and_parse(
VehicleHealthResponseModel, "GET", VEHICLE_HEALTH_STATUS_ENDPOINT, vin=vin
Expand Down Expand Up @@ -147,6 +150,7 @@ async def get_vehicle_electric_status_endpoint(self, vin: str) -> ElectricRespon
Returns:
-------
ElectricResponseModel: A pydantic model for the electric response

"""
parsed_response = await self._request_and_parse(
ElectricResponseModel,
Expand All @@ -169,6 +173,7 @@ async def get_telemetry_endpoint(self, vin: str) -> TelemetryResponseModel:
Returns:
-------
TelemetryResponseModel: A pydantic model for the telemetry response

"""
parsed_response = await self._request_and_parse(
TelemetryResponseModel, "GET", VEHICLE_TELEMETRY_ENDPOINT, vin=vin
Expand All @@ -190,6 +195,7 @@ async def get_notification_endpoint(self, vin: str) -> NotificationResponseModel
Returns:
-------
NotificationResponseModel: A pydantic model for the notification response

"""
parsed_response = await self._request_and_parse(
NotificationResponseModel,
Expand Down Expand Up @@ -230,6 +236,7 @@ async def get_trips_endpoint( # noqa: PLR0913
Returns:
-------
TripsResponseModel: A pydantic model for the trips response

"""
endpoint = VEHICLE_TRIPS_ENDPOINT.format(
from_date=from_date,
Expand Down Expand Up @@ -257,6 +264,7 @@ async def get_service_history_endpoint(self, vin: str) -> ServiceHistoryResponse
Returns:
-------
ServicHistoryResponseModel: A pydantic model for the service history response

"""
parsed_response = await self._request_and_parse(
ServiceHistoryResponseModel, "GET", VEHICLE_SERVICE_HISTORY_ENDPONT, vin=vin
Expand Down
1 change: 1 addition & 0 deletions mytoyota/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ async def request_json( # noqa: PLR0913
Examples:
--------
response = await request_json("GET", "/cars", vin="1234567890")

"""
response = await self.request_raw(method, endpoint, vin, body, params, headers)

Expand Down
11 changes: 11 additions & 0 deletions mytoyota/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__( # noqa: D417
Parameters
----------
metric: bool: Report distances in metric(or imperial)

"""
self._electric: Optional[ElectricStatusModel] = electric.payload if electric else None
self._telemetry: Optional[TelemetryModel] = telemetry.payload if telemetry else None
Expand All @@ -54,6 +55,7 @@ def odometer(self) -> Optional[float]:
Returns
-------
The latest odometer reading in the current selected units

"""
if self._telemetry:
return convert_distance(
Expand All @@ -70,6 +72,7 @@ def fuel_level(self) -> Optional[int]:
Returns
-------
A value as percentage

"""
return self._telemetry.fuel_level if self._telemetry else None

Expand All @@ -80,6 +83,7 @@ def battery_level(self) -> Optional[float]:
Returns
-------
A value as percentage

"""
return self._electric.battery_level if self._electric else None

Expand All @@ -93,6 +97,7 @@ def fuel_range(self) -> Optional[float]:

If vehicle is electric returns 0
If vehicle doesn't support fuel range returns None

"""
if self._electric and self._electric.fuel_range:
return convert_distance(
Expand All @@ -119,6 +124,7 @@ def battery_range(self) -> Optional[float]:

If vehicle is fuel only returns None
If vehicle doesn't support battery range returns None

"""
if self._electric:
return convert_distance(
Expand All @@ -139,6 +145,7 @@ def battery_range_with_ac(self) -> Optional[float]:

If vehicle is fuel only returns 0
If vehicle doesn't support battery range returns 0

"""
if self._electric:
return convert_distance(
Expand All @@ -161,6 +168,7 @@ def range(self) -> Optional[float]:
ev only == battery_range_with_ac
hybrid == fuel_range + battery_range_with_ac
None if not supported

"""
if self._telemetry and self._telemetry.distance_to_empty:
return convert_distance(
Expand All @@ -179,6 +187,7 @@ def charging_status(self) -> Optional[str]:
-------
A string containing the charging status as reported by the vehicle
None if vehicle doesn't support charging

"""
return self._electric.charging_status if self._electric else None

Expand All @@ -191,6 +200,7 @@ def remaining_charge_time(self) -> Optional[timedelta]:
The amount of time left
None if vehicle is not currently charging.
None if vehicle doesn't support charging

"""
return (
timedelta(minutes=self._electric.remaining_charge_time)
Expand All @@ -206,5 +216,6 @@ def warning_lights(self) -> Optional[List[Any]]:
-------
List of latest dashboard warning lights
_Note_ Not fully understood

"""
return self._health.warning if self._health else None
1 change: 1 addition & 0 deletions mytoyota/models/endpoints/electric.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ElectricStatusModel(BaseModel):
fuel_range (UnitValueModel): The fuel range of the electric vehicle.
last_update_timestamp (datetime): The timestamp of the last update.
remaining_charge_time Optional[int]: The time till full in minutes.

"""

battery_level: int = Field(alias="batteryLevel")
Expand Down
2 changes: 2 additions & 0 deletions mytoyota/models/endpoints/trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __add__(self, other: _SummaryBaseModel):
Args:
----
other: _SummaryBaseModel: to be added

"""
if other is not None:
self.length += other.length
Expand Down Expand Up @@ -101,6 +102,7 @@ def __add__(self, other: _HDCModel):
Args:
----
other: _SummaryBaseModel: to be added

"""
if other is not None:
self.ev_time = add_with_none(self.ev_time, other.ev_time)
Expand Down
1 change: 1 addition & 0 deletions mytoyota/models/endpoints/vehicle_guid.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ class VehicleGuidModel(BaseModel):
vehicle_capabilities (List[Any]): The capabilities of the vehicle.
vehicle_data_consents (Optional[Any]): The vehicle data consents of the vehicle.
vin (str): The VIN (Vehicle Identification Number) of the vehicle.

"""

alerts: List[Any] # TODO unsure what this returns
Expand Down
4 changes: 4 additions & 0 deletions mytoyota/models/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def latitude(self) -> Optional[float]:
Returns
-------
Latest latitude or None. _Not always available_.

"""
return self._location.latitude if self._location else None

Expand All @@ -41,6 +42,7 @@ def longitude(self) -> Optional[float]:
Returns
-------
Latest longitude or None. _Not always available_.

"""
return self._location.longitude if self._location else None

Expand All @@ -51,6 +53,7 @@ def timestamp(self) -> Optional[datetime]:
Returns
-------
Position aquired timestamp or None. _Not always available_.

"""
return self._location.location_acquisition_datetime if self._location else None

Expand All @@ -61,5 +64,6 @@ def state(self) -> str:
Returns
-------
The state of the position or None. _Not always available_.

"""
return self._location.display_name if self._location else None
3 changes: 3 additions & 0 deletions mytoyota/models/nofication.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def category(self) -> str:
Returns
-------
str: Category of notification

"""
return self._notification.category

Expand Down Expand Up @@ -65,6 +66,7 @@ def type(self) -> str:
Returns
-------
str: Notification type

"""
return self._notification.type

Expand All @@ -75,5 +77,6 @@ def date(self) -> datetime:
Returns
-------
datime: Time of notification

"""
return self._notification.notification_date
8 changes: 8 additions & 0 deletions mytoyota/models/service_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def service_date(self) -> date:
Returns
-------
date: The date of the service.

"""
return self._service_history.service_date

Expand All @@ -45,6 +46,7 @@ def customer_created_record(self) -> bool:
Returns
-------
str: Category of notification

"""
return self._service_history.customer_created_record

Expand Down Expand Up @@ -78,6 +80,7 @@ def notes(self) -> Any:
Returns
-------
Any: Additional notes about the service

"""
return self._service_history.notes

Expand All @@ -88,6 +91,7 @@ def operations_performed(self) -> Any:
Returns
-------
Any: The operations performed during the service

"""
return self._service_history.operations_performed

Expand All @@ -98,6 +102,7 @@ def ro_number(self) -> Any:
Returns
-------
Any: The RO (Repair Order) number associated with the service

"""
return self._service_history.ro_number

Expand All @@ -108,6 +113,7 @@ def service_category(self) -> str:
Returns
-------
str: The category of the service.

"""
return self._service_history.service_category

Expand All @@ -118,6 +124,7 @@ def service_provider(self) -> str:
Returns
-------
str: The service provider

"""
return self._service_history.service_provider

Expand All @@ -128,5 +135,6 @@ def servicing_dealer(self) -> Any:
Returns
-------
Any: The dealer that performed the service

"""
return self._service_history.servicing_dealer
10 changes: 10 additions & 0 deletions mytoyota/models/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__( # noqa: PLR0913
from_date (date, required): Start date for this summary
to_date (date, required): End date for this summary
hdc: (_HDCModel, optional): Hybrid data if available

"""
self._summary: _SummaryBaseModel = summary
self._hdc: Optional[_HDCModel] = hdc
Expand Down Expand Up @@ -80,6 +81,7 @@ def countries(self) -> List[str]:
-------
List[str]: List of countries visited in 'ISO 3166-1 alpha-2' or
two-letter country codes format.

"""
return self._summary.countries

Expand All @@ -90,6 +92,7 @@ def duration(self) -> timedelta:
Returns
-------
timedelta: The amount of time driving

"""
return timedelta(seconds=self._summary.duration)

Expand All @@ -100,6 +103,7 @@ def distance(self) -> float:
Returns
-------
float: Distance covered in the selected metric

"""
return convert_distance(self._distance_unit, "km", self._summary.length / 1000.0)

Expand All @@ -110,6 +114,7 @@ def ev_duration(self) -> Optional[timedelta]:
Returns
-------
timedelta: The amount of time driving using EV or None if not supported

"""
if self._hdc and self._hdc.ev_time:
return timedelta(seconds=self._hdc.ev_time)
Expand All @@ -122,6 +127,7 @@ def ev_distance(self) -> Optional[float]:
Returns
-------
timedelta: The distance driven using EV in selected metric or None if not supported

"""
if self._hdc and self._hdc.ev_distance:
return convert_distance(self._distance_unit, "km", self._hdc.ev_distance / 1000.0)
Expand All @@ -134,6 +140,7 @@ def from_date(self) -> date:
Returns
-------
date: The date the summary started

"""
return self._from_date

Expand All @@ -144,6 +151,7 @@ def to_date(self) -> date:
Returns
-------
date: The date the summary ended

"""
return self._to_date

Expand All @@ -154,6 +162,7 @@ def fuel_consumed(self) -> float:
Returns
-------
float: The total amount of fuel consumed in liters if metric or gallons

"""
if self._summary.fuel_consumption:
return (
Expand All @@ -171,6 +180,7 @@ def average_fuel_consumed(self) -> float:
Returns
-------
float: The average amount of fuel consumed in l/100km if metric or mpg

"""
if self._summary.fuel_consumption:
avg_fuel_consumed = (self._summary.fuel_consumption / self._summary.length) * 100
Expand Down
Loading