Cleanup unnecessary returns (#121652)
parent
b0837dd98f
commit
e812b0e02f
|
@ -123,7 +123,7 @@ class DiscordNotificationService(BaseNotificationService):
|
|||
|
||||
if ATTR_TARGET not in kwargs:
|
||||
_LOGGER.error("No target specified")
|
||||
return None
|
||||
return
|
||||
|
||||
data = kwargs.get(ATTR_DATA) or {}
|
||||
|
||||
|
|
|
@ -174,10 +174,9 @@ class InputButton(collection.CollectionEntity, ButtonEntity, RestoreEntity):
|
|||
async def async_press(self) -> None:
|
||||
"""Press the button.
|
||||
|
||||
Left emtpty intentionally.
|
||||
Left empty intentionally.
|
||||
The input button itself doesn't trigger anything.
|
||||
"""
|
||||
return None
|
||||
|
||||
async def async_update_config(self, config: ConfigType) -> None:
|
||||
"""Handle when the config is updated."""
|
||||
|
|
|
@ -317,7 +317,7 @@ async def async_setup_trigger(
|
|||
)
|
||||
send_discovery_done(hass, discovery_data)
|
||||
clear_discovery_hash(hass, discovery_data[ATTR_DISCOVERY_HASH])
|
||||
return None
|
||||
return
|
||||
|
||||
if TYPE_CHECKING:
|
||||
assert isinstance(device_id, str)
|
||||
|
|
|
@ -106,16 +106,15 @@ class NeurioData:
|
|||
"""Return latest active power value."""
|
||||
return self._active_power
|
||||
|
||||
def get_active_power(self):
|
||||
def get_active_power(self) -> None:
|
||||
"""Return current power value."""
|
||||
try:
|
||||
sample = self.neurio_client.get_samples_live_last(self.sensor_id)
|
||||
self._active_power = sample["consumptionPower"]
|
||||
except (requests.exceptions.RequestException, ValueError, KeyError):
|
||||
_LOGGER.warning("Could not update current power usage")
|
||||
return None
|
||||
|
||||
def get_daily_usage(self):
|
||||
def get_daily_usage(self) -> None:
|
||||
"""Return current daily power usage."""
|
||||
kwh = 0
|
||||
start_time = dt_util.start_of_local_day().astimezone(dt_util.UTC).isoformat()
|
||||
|
@ -129,7 +128,7 @@ class NeurioData:
|
|||
)
|
||||
except (requests.exceptions.RequestException, ValueError, KeyError):
|
||||
_LOGGER.warning("Could not update daily power usage")
|
||||
return None
|
||||
return
|
||||
|
||||
for result in history:
|
||||
kwh += result["consumptionEnergy"] / 3600000
|
||||
|
|
|
@ -30,7 +30,7 @@ class DiscoveryService(Listener):
|
|||
|
||||
device = await async_build_base_device(device_info)
|
||||
if device is None:
|
||||
return None
|
||||
return
|
||||
|
||||
coordo = RefossDataUpdateCoordinator(self.hass, device)
|
||||
self.hass.data[DOMAIN][COORDINATORS].append(coordo)
|
||||
|
|
|
@ -30,7 +30,7 @@ async def async_setup_platform(
|
|||
) -> None:
|
||||
"""Set up the sensor platform."""
|
||||
if discovery_info is None:
|
||||
return None
|
||||
return
|
||||
|
||||
consumer = hass.data[DOMAIN][KEY_CONSUMER]
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ async def async_setup_platform(
|
|||
) -> None:
|
||||
"""Set up actuator platform."""
|
||||
if discovery_info is None:
|
||||
return None
|
||||
return
|
||||
|
||||
consumer = hass.data[DOMAIN][KEY_CONSUMER]
|
||||
|
||||
|
|
|
@ -922,7 +922,6 @@ class WeatherEntity(Entity, PostInit, cached_properties=CACHED_PROPERTIES_WITH_A
|
|||
forecast_type: Literal["daily", "hourly", "twice_daily"],
|
||||
) -> None:
|
||||
"""Start subscription to forecast_type."""
|
||||
return None
|
||||
|
||||
@callback
|
||||
def _async_subscription_ended(
|
||||
|
@ -930,7 +929,6 @@ class WeatherEntity(Entity, PostInit, cached_properties=CACHED_PROPERTIES_WITH_A
|
|||
forecast_type: Literal["daily", "hourly", "twice_daily"],
|
||||
) -> None:
|
||||
"""End subscription to forecast_type."""
|
||||
return None
|
||||
|
||||
@final
|
||||
@callback
|
||||
|
|
|
@ -129,13 +129,11 @@ class Throttle:
|
|||
|
||||
async def throttled_value() -> None:
|
||||
"""Stand-in function for when real func is being throttled."""
|
||||
return None
|
||||
|
||||
else:
|
||||
|
||||
def throttled_value() -> None: # type: ignore[misc]
|
||||
"""Stand-in function for when real func is being throttled."""
|
||||
return None
|
||||
|
||||
if self.limit_no_throttle is not None:
|
||||
method = Throttle(self.limit_no_throttle)(method)
|
||||
|
|
Loading…
Reference in New Issue