Fix implicit-return in uk_transport (#122932)
parent
be8186126e
commit
c702ffa7dd
|
@ -6,6 +6,7 @@ from datetime import datetime, timedelta
|
|||
from http import HTTPStatus
|
||||
import logging
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
import voluptuous as vol
|
||||
|
@ -196,10 +197,10 @@ class UkTransportLiveBusTimeSensor(UkTransportSensor):
|
|||
self._state = None
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
def extra_state_attributes(self) -> dict[str, Any] | None:
|
||||
"""Return other details about the sensor state."""
|
||||
attrs = {}
|
||||
if self._data is not None:
|
||||
attrs = {ATTR_NEXT_BUSES: self._next_buses}
|
||||
for key in (
|
||||
ATTR_ATCOCODE,
|
||||
ATTR_LOCALITY,
|
||||
|
@ -207,8 +208,8 @@ class UkTransportLiveBusTimeSensor(UkTransportSensor):
|
|||
ATTR_REQUEST_TIME,
|
||||
):
|
||||
attrs[key] = self._data.get(key)
|
||||
attrs[ATTR_NEXT_BUSES] = self._next_buses
|
||||
return attrs
|
||||
return None
|
||||
|
||||
|
||||
class UkTransportLiveTrainTimeSensor(UkTransportSensor):
|
||||
|
@ -266,15 +267,17 @@ class UkTransportLiveTrainTimeSensor(UkTransportSensor):
|
|||
self._state = None
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
def extra_state_attributes(self) -> dict[str, Any] | None:
|
||||
"""Return other details about the sensor state."""
|
||||
attrs = {}
|
||||
if self._data is not None:
|
||||
attrs[ATTR_STATION_CODE] = self._station_code
|
||||
attrs[ATTR_CALLING_AT] = self._calling_at
|
||||
attrs = {
|
||||
ATTR_STATION_CODE: self._station_code,
|
||||
ATTR_CALLING_AT: self._calling_at,
|
||||
}
|
||||
if self._next_trains:
|
||||
attrs[ATTR_NEXT_TRAINS] = self._next_trains
|
||||
return attrs
|
||||
return None
|
||||
|
||||
|
||||
def _delta_mins(hhmm_time_str):
|
||||
|
|
Loading…
Reference in New Issue