Enable Ruff RSE (#113695)

This commit is contained in:
Sid 2024-03-18 00:40:38 +01:00 committed by GitHub
parent 685553d17d
commit 82a60fe8ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
155 changed files with 325 additions and 324 deletions

View file

@ -44,7 +44,7 @@ class AdGuardHomeEntity(Entity):
async def _adguard_update(self) -> None: async def _adguard_update(self) -> None:
"""Update AdGuard Home entity.""" """Update AdGuard Home entity."""
raise NotImplementedError() raise NotImplementedError
@property @property
def device_info(self) -> DeviceInfo: def device_info(self) -> DeviceInfo:

View file

@ -83,7 +83,7 @@ class AirQualityEntity(Entity):
@property @property
def particulate_matter_2_5(self) -> StateType: def particulate_matter_2_5(self) -> StateType:
"""Return the particulate matter 2.5 level.""" """Return the particulate matter 2.5 level."""
raise NotImplementedError() raise NotImplementedError
@property @property
def particulate_matter_10(self) -> StateType: def particulate_matter_10(self) -> StateType:

View file

@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try: try:
await client.connect_and_stay_connected() await client.connect_and_stay_connected()
except TimeoutError as t: except TimeoutError as t:
raise ConfigEntryNotReady() from t raise ConfigEntryNotReady from t
# Store an API object for your platforms to access # Store an API object for your platforms to access
hass.data[DOMAIN][entry.entry_id] = client hass.data[DOMAIN][entry.entry_id] = client

View file

@ -54,7 +54,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try: try:
await node.async_connect() await node.async_connect()
except NodeProError as err: except NodeProError as err:
raise ConfigEntryNotReady() from err raise ConfigEntryNotReady from err
reload_task: asyncio.Task | None = None reload_task: asyncio.Task | None = None

View file

@ -44,7 +44,7 @@ class AirzoneEntity(CoordinatorEntity[AirzoneUpdateCoordinator]):
def get_airzone_value(self, key: str) -> Any: def get_airzone_value(self, key: str) -> Any:
"""Return Airzone entity value by key.""" """Return Airzone entity value by key."""
raise NotImplementedError() raise NotImplementedError
class AirzoneSystemEntity(AirzoneEntity): class AirzoneSystemEntity(AirzoneEntity):

View file

@ -173,7 +173,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
def alarm_disarm(self, code: str | None = None) -> None: def alarm_disarm(self, code: str | None = None) -> None:
"""Send disarm command.""" """Send disarm command."""
raise NotImplementedError() raise NotImplementedError
async def async_alarm_disarm(self, code: str | None = None) -> None: async def async_alarm_disarm(self, code: str | None = None) -> None:
"""Send disarm command.""" """Send disarm command."""
@ -181,7 +181,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
def alarm_arm_home(self, code: str | None = None) -> None: def alarm_arm_home(self, code: str | None = None) -> None:
"""Send arm home command.""" """Send arm home command."""
raise NotImplementedError() raise NotImplementedError
async def async_alarm_arm_home(self, code: str | None = None) -> None: async def async_alarm_arm_home(self, code: str | None = None) -> None:
"""Send arm home command.""" """Send arm home command."""
@ -189,7 +189,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
def alarm_arm_away(self, code: str | None = None) -> None: def alarm_arm_away(self, code: str | None = None) -> None:
"""Send arm away command.""" """Send arm away command."""
raise NotImplementedError() raise NotImplementedError
async def async_alarm_arm_away(self, code: str | None = None) -> None: async def async_alarm_arm_away(self, code: str | None = None) -> None:
"""Send arm away command.""" """Send arm away command."""
@ -197,7 +197,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
def alarm_arm_night(self, code: str | None = None) -> None: def alarm_arm_night(self, code: str | None = None) -> None:
"""Send arm night command.""" """Send arm night command."""
raise NotImplementedError() raise NotImplementedError
async def async_alarm_arm_night(self, code: str | None = None) -> None: async def async_alarm_arm_night(self, code: str | None = None) -> None:
"""Send arm night command.""" """Send arm night command."""
@ -205,7 +205,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
def alarm_arm_vacation(self, code: str | None = None) -> None: def alarm_arm_vacation(self, code: str | None = None) -> None:
"""Send arm vacation command.""" """Send arm vacation command."""
raise NotImplementedError() raise NotImplementedError
async def async_alarm_arm_vacation(self, code: str | None = None) -> None: async def async_alarm_arm_vacation(self, code: str | None = None) -> None:
"""Send arm vacation command.""" """Send arm vacation command."""
@ -213,7 +213,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
def alarm_trigger(self, code: str | None = None) -> None: def alarm_trigger(self, code: str | None = None) -> None:
"""Send alarm trigger command.""" """Send alarm trigger command."""
raise NotImplementedError() raise NotImplementedError
async def async_alarm_trigger(self, code: str | None = None) -> None: async def async_alarm_trigger(self, code: str | None = None) -> None:
"""Send alarm trigger command.""" """Send alarm trigger command."""
@ -221,7 +221,7 @@ class AlarmControlPanelEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_A
def alarm_arm_custom_bypass(self, code: str | None = None) -> None: def alarm_arm_custom_bypass(self, code: str | None = None) -> None:
"""Send arm custom bypass command.""" """Send arm custom bypass command."""
raise NotImplementedError() raise NotImplementedError
async def async_alarm_arm_custom_bypass(self, code: str | None = None) -> None: async def async_alarm_arm_custom_bypass(self, code: str | None = None) -> None:
"""Send arm custom bypass command.""" """Send arm custom bypass command."""

View file

@ -224,7 +224,7 @@ class AlexaCapabilityResource:
Return ModeResources, PresetResources friendlyNames serialized. Return ModeResources, PresetResources friendlyNames serialized.
""" """
raise NotImplementedError() raise NotImplementedError
def serialize_labels(self, resources: list[str]) -> dict[str, list[dict[str, Any]]]: def serialize_labels(self, resources: list[str]) -> dict[str, list[dict[str, Any]]]:
"""Return serialized labels for an API response. """Return serialized labels for an API response.

View file

@ -413,7 +413,7 @@ class APIDomainServicesView(HomeAssistantView):
) )
) )
except (vol.Invalid, ServiceNotFound) as ex: except (vol.Invalid, ServiceNotFound) as ex:
raise HTTPBadRequest() from ex raise HTTPBadRequest from ex
finally: finally:
cancel_listen() cancel_listen()

View file

@ -341,7 +341,7 @@ class AppleTVConfigFlow(ConfigFlow, domain=DOMAIN):
self.hass, self.scan_filter, self.hass.loop self.hass, self.scan_filter, self.hass.loop
) )
if not self.atv: if not self.atv:
raise DeviceNotFound() raise DeviceNotFound
# Protocols supported by the device are prospects for pairing # Protocols supported by the device are prospects for pairing
self.protocols_to_pair = deque( self.protocols_to_pair = deque(
@ -384,7 +384,7 @@ class AppleTVConfigFlow(ConfigFlow, domain=DOMAIN):
self.hass.config_entries.async_reload(entry.entry_id) self.hass.config_entries.async_reload(entry.entry_id)
) )
if not allow_exist: if not allow_exist:
raise DeviceAlreadyConfigured() raise DeviceAlreadyConfigured
async def async_step_confirm( async def async_step_confirm(
self, user_input: dict[str, str] | None = None self, user_input: dict[str, str] | None = None

View file

@ -51,7 +51,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
coordinator.stop_listen() coordinator.stop_listen()
raise ConfigEntryNotReady() raise ConfigEntryNotReady
await coordinator.wait_for_ready(ready_callback) await coordinator.wait_for_ready(ready_callback)

View file

@ -39,9 +39,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await client.login() await client.login()
services = await client.get_services(drop_types=ignore_types) services = await client.get_services(drop_types=ignore_types)
except AuthenticationException as exc: except AuthenticationException as exc:
raise ConfigEntryAuthFailed() from exc raise ConfigEntryAuthFailed from exc
except ClientError as exc: except ClientError as exc:
raise ConfigEntryNotReady() from exc raise ConfigEntryNotReady from exc
# Create an appropriate refresh function # Create an appropriate refresh function
def update_data_factory(service_id): def update_data_factory(service_id):

View file

@ -158,7 +158,7 @@ def _parse_client_id(client_id: str) -> ParseResult:
# Client identifier URLs # Client identifier URLs
# MUST have either an https or http scheme # MUST have either an https or http scheme
if parts.scheme not in ("http", "https"): if parts.scheme not in ("http", "https"):
raise ValueError() raise ValueError
# MUST contain a path component # MUST contain a path component
# Handled by url canonicalization. # Handled by url canonicalization.

View file

@ -366,7 +366,7 @@ class BluesoundPlayer(MediaPlayerEntity):
data = None data = None
elif response.status == 595: elif response.status == 595:
_LOGGER.info("Status 595 returned, treating as timeout") _LOGGER.info("Status 595 returned, treating as timeout")
raise BluesoundPlayer._TimeoutException() raise BluesoundPlayer._TimeoutException
else: else:
_LOGGER.error("Error %s on %s", response.status, url) _LOGGER.error("Error %s on %s", response.status, url)
return None return None
@ -432,7 +432,7 @@ class BluesoundPlayer(MediaPlayerEntity):
self.async_write_ha_state() self.async_write_ha_state()
elif response.status == 595: elif response.status == 595:
_LOGGER.info("Status 595 returned, treating as timeout") _LOGGER.info("Status 595 returned, treating as timeout")
raise BluesoundPlayer._TimeoutException() raise BluesoundPlayer._TimeoutException
else: else:
_LOGGER.error( _LOGGER.error(
"Error %s on %s. Trying one more time", response.status, url "Error %s on %s. Trying one more time", response.status, url

View file

@ -43,7 +43,7 @@ class BrotherConfigFlow(ConfigFlow, domain=DOMAIN):
if user_input is not None: if user_input is not None:
try: try:
if not is_host_valid(user_input[CONF_HOST]): if not is_host_valid(user_input[CONF_HOST]):
raise InvalidHost() raise InvalidHost
snmp_engine = get_snmp_engine(self.hass) snmp_engine = get_snmp_engine(self.hass)

View file

@ -51,7 +51,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
raise UpdateFailed(f"Error communicating with API: {err}") from err raise UpdateFailed(f"Error communicating with API: {err}") from err
except ClientResponseError as err: except ClientResponseError as err:
if err.status == 403: if err.status == 403:
raise ConfigEntryAuthFailed() from err raise ConfigEntryAuthFailed from err
if err.status == 401: if err.status == 401:
_LOGGER.warning("Device not found, will reload Brunt integration") _LOGGER.warning("Device not found, will reload Brunt integration")
await hass.config_entries.async_reload(entry.entry_id) await hass.config_entries.async_reload(entry.entry_id)

View file

@ -148,7 +148,7 @@ class ButtonEntity(RestoreEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_
def press(self) -> None: def press(self) -> None:
"""Press the button.""" """Press the button."""
raise NotImplementedError() raise NotImplementedError
async def async_press(self) -> None: async def async_press(self) -> None:
"""Press the button.""" """Press the button."""

View file

@ -503,7 +503,7 @@ class CalendarEntity(Entity):
@property @property
def event(self) -> CalendarEvent | None: def event(self) -> CalendarEvent | None:
"""Return the next upcoming event.""" """Return the next upcoming event."""
raise NotImplementedError() raise NotImplementedError
@final @final
@property @property
@ -599,11 +599,11 @@ class CalendarEntity(Entity):
end_date: datetime.datetime, end_date: datetime.datetime,
) -> list[CalendarEvent]: ) -> list[CalendarEvent]:
"""Return calendar events within a datetime range.""" """Return calendar events within a datetime range."""
raise NotImplementedError() raise NotImplementedError
async def async_create_event(self, **kwargs: Any) -> None: async def async_create_event(self, **kwargs: Any) -> None:
"""Add a new event to calendar.""" """Add a new event to calendar."""
raise NotImplementedError() raise NotImplementedError
async def async_delete_event( async def async_delete_event(
self, self,
@ -612,7 +612,7 @@ class CalendarEntity(Entity):
recurrence_range: str | None = None, recurrence_range: str | None = None,
) -> None: ) -> None:
"""Delete an event on the calendar.""" """Delete an event on the calendar."""
raise NotImplementedError() raise NotImplementedError
async def async_update_event( async def async_update_event(
self, self,
@ -622,7 +622,7 @@ class CalendarEntity(Entity):
recurrence_range: str | None = None, recurrence_range: str | None = None,
) -> None: ) -> None:
"""Delete an event on the calendar.""" """Delete an event on the calendar."""
raise NotImplementedError() raise NotImplementedError
class CalendarEventView(http.HomeAssistantView): class CalendarEventView(http.HomeAssistantView):

View file

@ -651,7 +651,7 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
self, width: int | None = None, height: int | None = None self, width: int | None = None, height: int | None = None
) -> bytes | None: ) -> bytes | None:
"""Return bytes of camera image.""" """Return bytes of camera image."""
raise NotImplementedError() raise NotImplementedError
async def async_camera_image( async def async_camera_image(
self, width: int | None = None, height: int | None = None self, width: int | None = None, height: int | None = None
@ -696,7 +696,7 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def turn_off(self) -> None: def turn_off(self) -> None:
"""Turn off camera.""" """Turn off camera."""
raise NotImplementedError() raise NotImplementedError
async def async_turn_off(self) -> None: async def async_turn_off(self) -> None:
"""Turn off camera.""" """Turn off camera."""
@ -704,7 +704,7 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def turn_on(self) -> None: def turn_on(self) -> None:
"""Turn off camera.""" """Turn off camera."""
raise NotImplementedError() raise NotImplementedError
async def async_turn_on(self) -> None: async def async_turn_on(self) -> None:
"""Turn off camera.""" """Turn off camera."""
@ -712,7 +712,7 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def enable_motion_detection(self) -> None: def enable_motion_detection(self) -> None:
"""Enable motion detection in the camera.""" """Enable motion detection in the camera."""
raise NotImplementedError() raise NotImplementedError
async def async_enable_motion_detection(self) -> None: async def async_enable_motion_detection(self) -> None:
"""Call the job and enable motion detection.""" """Call the job and enable motion detection."""
@ -720,7 +720,7 @@ class Camera(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def disable_motion_detection(self) -> None: def disable_motion_detection(self) -> None:
"""Disable motion detection in camera.""" """Disable motion detection in camera."""
raise NotImplementedError() raise NotImplementedError
async def async_disable_motion_detection(self) -> None: async def async_disable_motion_detection(self) -> None:
"""Call the job and disable motion detection.""" """Call the job and disable motion detection."""
@ -797,7 +797,7 @@ class CameraView(HomeAssistantView):
async def get(self, request: web.Request, entity_id: str) -> web.StreamResponse: async def get(self, request: web.Request, entity_id: str) -> web.StreamResponse:
"""Start a GET request.""" """Start a GET request."""
if (camera := self.component.get_entity(entity_id)) is None: if (camera := self.component.get_entity(entity_id)) is None:
raise web.HTTPNotFound() raise web.HTTPNotFound
authenticated = ( authenticated = (
request[KEY_AUTHENTICATED] request[KEY_AUTHENTICATED]
@ -808,19 +808,19 @@ class CameraView(HomeAssistantView):
# Attempt with invalid bearer token, raise unauthorized # Attempt with invalid bearer token, raise unauthorized
# so ban middleware can handle it. # so ban middleware can handle it.
if hdrs.AUTHORIZATION in request.headers: if hdrs.AUTHORIZATION in request.headers:
raise web.HTTPUnauthorized() raise web.HTTPUnauthorized
# Invalid sigAuth or camera access token # Invalid sigAuth or camera access token
raise web.HTTPForbidden() raise web.HTTPForbidden
if not camera.is_on: if not camera.is_on:
_LOGGER.debug("Camera is off") _LOGGER.debug("Camera is off")
raise web.HTTPServiceUnavailable() raise web.HTTPServiceUnavailable
return await self.handle(request, camera) return await self.handle(request, camera)
async def handle(self, request: web.Request, camera: Camera) -> web.StreamResponse: async def handle(self, request: web.Request, camera: Camera) -> web.StreamResponse:
"""Handle the camera request.""" """Handle the camera request."""
raise NotImplementedError() raise NotImplementedError
class CameraImageView(CameraView): class CameraImageView(CameraView):
@ -841,7 +841,7 @@ class CameraImageView(CameraView):
int(height) if height else None, int(height) if height else None,
) )
except (HomeAssistantError, ValueError) as ex: except (HomeAssistantError, ValueError) as ex:
raise web.HTTPInternalServerError() from ex raise web.HTTPInternalServerError from ex
return web.Response(body=image.content, content_type=image.content_type) return web.Response(body=image.content, content_type=image.content_type)
@ -861,7 +861,7 @@ class CameraMjpegStream(CameraView):
stream = None stream = None
_LOGGER.debug("Error while writing MJPEG stream to transport") _LOGGER.debug("Error while writing MJPEG stream to transport")
if stream is None: if stream is None:
raise web.HTTPBadGateway() raise web.HTTPBadGateway
return stream return stream
try: try:
@ -871,7 +871,7 @@ class CameraMjpegStream(CameraView):
raise ValueError(f"Stream interval must be > {MIN_STREAM_INTERVAL}") raise ValueError(f"Stream interval must be > {MIN_STREAM_INTERVAL}")
return await camera.handle_async_still_stream(request, interval) return await camera.handle_async_still_stream(request, interval)
except ValueError as err: except ValueError as err:
raise web.HTTPBadRequest() from err raise web.HTTPBadRequest from err
@websocket_api.websocket_command( @websocket_api.websocket_command(

View file

@ -657,7 +657,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_temperature(self, **kwargs: Any) -> None: def set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature.""" """Set new target temperature."""
raise NotImplementedError() raise NotImplementedError
async def async_set_temperature(self, **kwargs: Any) -> None: async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperature.""" """Set new target temperature."""
@ -667,7 +667,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_humidity(self, humidity: int) -> None: def set_humidity(self, humidity: int) -> None:
"""Set new target humidity.""" """Set new target humidity."""
raise NotImplementedError() raise NotImplementedError
async def async_set_humidity(self, humidity: int) -> None: async def async_set_humidity(self, humidity: int) -> None:
"""Set new target humidity.""" """Set new target humidity."""
@ -681,7 +681,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_fan_mode(self, fan_mode: str) -> None: def set_fan_mode(self, fan_mode: str) -> None:
"""Set new target fan mode.""" """Set new target fan mode."""
raise NotImplementedError() raise NotImplementedError
async def async_set_fan_mode(self, fan_mode: str) -> None: async def async_set_fan_mode(self, fan_mode: str) -> None:
"""Set new target fan mode.""" """Set new target fan mode."""
@ -689,7 +689,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_hvac_mode(self, hvac_mode: HVACMode) -> None: def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set new target hvac mode.""" """Set new target hvac mode."""
raise NotImplementedError() raise NotImplementedError
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set new target hvac mode.""" """Set new target hvac mode."""
@ -703,7 +703,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_swing_mode(self, swing_mode: str) -> None: def set_swing_mode(self, swing_mode: str) -> None:
"""Set new target swing operation.""" """Set new target swing operation."""
raise NotImplementedError() raise NotImplementedError
async def async_set_swing_mode(self, swing_mode: str) -> None: async def async_set_swing_mode(self, swing_mode: str) -> None:
"""Set new target swing operation.""" """Set new target swing operation."""
@ -717,7 +717,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_preset_mode(self, preset_mode: str) -> None: def set_preset_mode(self, preset_mode: str) -> None:
"""Set new preset mode.""" """Set new preset mode."""
raise NotImplementedError() raise NotImplementedError
async def async_set_preset_mode(self, preset_mode: str) -> None: async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set new preset mode.""" """Set new preset mode."""
@ -725,7 +725,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def turn_aux_heat_on(self) -> None: def turn_aux_heat_on(self) -> None:
"""Turn auxiliary heater on.""" """Turn auxiliary heater on."""
raise NotImplementedError() raise NotImplementedError
async def async_turn_aux_heat_on(self) -> None: async def async_turn_aux_heat_on(self) -> None:
"""Turn auxiliary heater on.""" """Turn auxiliary heater on."""
@ -733,7 +733,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def turn_aux_heat_off(self) -> None: def turn_aux_heat_off(self) -> None:
"""Turn auxiliary heater off.""" """Turn auxiliary heater off."""
raise NotImplementedError() raise NotImplementedError
async def async_turn_aux_heat_off(self) -> None: async def async_turn_aux_heat_off(self) -> None:
"""Turn auxiliary heater off.""" """Turn auxiliary heater off."""

View file

@ -37,7 +37,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if not info: if not info:
raise ConfigEntryNotReady raise ConfigEntryNotReady
except OSError as error: except OSError as error:
raise ConfigEntryNotReady() from error raise ConfigEntryNotReady from error
coordinator = CoolmasterDataUpdateCoordinator(hass, coolmaster) coordinator = CoolmasterDataUpdateCoordinator(hass, coolmaster)
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()

View file

@ -381,7 +381,7 @@ class CoverEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def open_cover(self, **kwargs: Any) -> None: def open_cover(self, **kwargs: Any) -> None:
"""Open the cover.""" """Open the cover."""
raise NotImplementedError() raise NotImplementedError
async def async_open_cover(self, **kwargs: Any) -> None: async def async_open_cover(self, **kwargs: Any) -> None:
"""Open the cover.""" """Open the cover."""
@ -389,7 +389,7 @@ class CoverEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def close_cover(self, **kwargs: Any) -> None: def close_cover(self, **kwargs: Any) -> None:
"""Close cover.""" """Close cover."""
raise NotImplementedError() raise NotImplementedError
async def async_close_cover(self, **kwargs: Any) -> None: async def async_close_cover(self, **kwargs: Any) -> None:
"""Close cover.""" """Close cover."""

View file

@ -74,7 +74,7 @@ def setup_platform(
data.update() data.update()
if data.available is False: if data.available is False:
_LOGGER.error("Unable to connect to CUPS server: %s:%s", host, port) _LOGGER.error("Unable to connect to CUPS server: %s:%s", host, port)
raise PlatformNotReady() raise PlatformNotReady
assert data.printers is not None assert data.printers is not None
dev: list[SensorEntity] = [] dev: list[SensorEntity] = []
@ -97,7 +97,7 @@ def setup_platform(
data.update() data.update()
if data.available is False: if data.available is False:
_LOGGER.error("Unable to connect to IPP printer: %s:%s", host, port) _LOGGER.error("Unable to connect to IPP printer: %s:%s", host, port)
raise PlatformNotReady() raise PlatformNotReady
dev = [] dev = []
for printer in printers: for printer in printers:

View file

@ -110,7 +110,7 @@ class DateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_value(self, value: date) -> None: def set_value(self, value: date) -> None:
"""Change the date.""" """Change the date."""
raise NotImplementedError() raise NotImplementedError
async def async_set_value(self, value: date) -> None: async def async_set_value(self, value: date) -> None:
"""Change the date.""" """Change the date."""

View file

@ -126,7 +126,7 @@ class DateTimeEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_value(self, value: datetime) -> None: def set_value(self, value: datetime) -> None:
"""Change the date/time.""" """Change the date/time."""
raise NotImplementedError() raise NotImplementedError
async def async_set_value(self, value: datetime) -> None: async def async_set_value(self, value: datetime) -> None:
"""Change the date/time.""" """Change the date/time."""

View file

@ -940,7 +940,7 @@ class DeviceScanner:
def scan_devices(self) -> list[str]: def scan_devices(self) -> list[str]:
"""Scan for devices.""" """Scan for devices."""
raise NotImplementedError() raise NotImplementedError
async def async_scan_devices(self) -> list[str]: async def async_scan_devices(self) -> list[str]:
"""Scan for devices.""" """Scan for devices."""
@ -951,7 +951,7 @@ class DeviceScanner:
def get_device_name(self, device: str) -> str | None: def get_device_name(self, device: str) -> str | None:
"""Get the name of a device.""" """Get the name of a device."""
raise NotImplementedError() raise NotImplementedError
async def async_get_device_name(self, device: str) -> str | None: async def async_get_device_name(self, device: str) -> str | None:
"""Get the name of a device.""" """Get the name of a device."""
@ -962,7 +962,7 @@ class DeviceScanner:
def get_extra_attributes(self, device: str) -> dict: def get_extra_attributes(self, device: str) -> dict:
"""Get the extra attributes of a device.""" """Get the extra attributes of a device."""
raise NotImplementedError() raise NotImplementedError
async def async_get_extra_attributes(self, device: str) -> dict: async def async_get_extra_attributes(self, device: str) -> dict:
"""Get the extra attributes of a device.""" """Get the extra attributes of a device."""

View file

@ -278,7 +278,7 @@ class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerEntity):
async def async_turn_on(self) -> None: async def async_turn_on(self) -> None:
"""Turn on the receiver.""" """Turn on the receiver."""
if self._is_client: if self._is_client:
raise NotImplementedError() raise NotImplementedError
_LOGGER.debug("Turn on %s", self.name) _LOGGER.debug("Turn on %s", self.name)
await self.dtv.remote("poweron", self._address) await self.dtv.remote("poweron", self._address)
@ -286,7 +286,7 @@ class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerEntity):
async def async_turn_off(self) -> None: async def async_turn_off(self) -> None:
"""Turn off the receiver.""" """Turn off the receiver."""
if self._is_client: if self._is_client:
raise NotImplementedError() raise NotImplementedError
_LOGGER.debug("Turn off %s", self.name) _LOGGER.debug("Turn off %s", self.name)
await self.dtv.remote("poweroff", self._address) await self.dtv.remote("poweroff", self._address)

View file

@ -25,7 +25,7 @@ class DuneHDConfigFlow(ConfigFlow, domain=DOMAIN):
player = DuneHDPlayer(host) player = DuneHDPlayer(host)
state = await self.hass.async_add_executor_job(player.update_state) state = await self.hass.async_add_executor_job(player.update_state)
if not state: if not state:
raise CannotConnect() raise CannotConnect
async def async_step_user( async def async_step_user(
self, user_input: dict[str, Any] | None = None self, user_input: dict[str, Any] | None = None
@ -39,7 +39,7 @@ class DuneHDConfigFlow(ConfigFlow, domain=DOMAIN):
try: try:
if self.host_already_configured(host): if self.host_already_configured(host):
raise AlreadyConfigured() raise AlreadyConfigured
await self.init_device(host) await self.init_device(host)
except CannotConnect: except CannotConnect:
errors[CONF_HOST] = "cannot_connect" errors[CONF_HOST] = "cannot_connect"

View file

@ -95,7 +95,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try: try:
client, panel = await _load_elmax_panel_client(entry) client, panel = await _load_elmax_panel_client(entry)
except ElmaxBadLoginError as err: except ElmaxBadLoginError as err:
raise ConfigEntryAuthFailed() from err raise ConfigEntryAuthFailed from err
# Create the API client object and attempt a login, so that we immediately know # Create the API client object and attempt a login, so that we immediately know
# if there is something wrong with user credentials # if there is something wrong with user credentials

View file

@ -424,7 +424,7 @@ class ElmaxConfigFlow(ConfigFlow, domain=DOMAIN):
if p.hash == self._entry.data[CONF_ELMAX_PANEL_ID] if p.hash == self._entry.data[CONF_ELMAX_PANEL_ID]
] ]
if len(panels) < 1: if len(panels) < 1:
raise NoOnlinePanelsError() raise NoOnlinePanelsError
# Verify the pin is still valid. # Verify the pin is still valid.
await client.get_panel_status( await client.get_panel_status(

View file

@ -81,7 +81,7 @@ def setup_platform(
api = EpsonPrinterAPI(host) api = EpsonPrinterAPI(host)
if not api.available: if not api.available:
raise PlatformNotReady() raise PlatformNotReady
sensors = [ sensors = [
EpsonPrinterCartridge(api, description) EpsonPrinterCartridge(api, description)

View file

@ -147,7 +147,7 @@ class EventEntity(RestoreEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_)
and self.entity_description.event_types is not None and self.entity_description.event_types is not None
): ):
return self.entity_description.event_types return self.entity_description.event_types
raise AttributeError() raise AttributeError
@final @final
def _trigger_event( def _trigger_event(

View file

@ -238,7 +238,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_percentage(self, percentage: int) -> None: def set_percentage(self, percentage: int) -> None:
"""Set the speed of the fan, as a percentage.""" """Set the speed of the fan, as a percentage."""
raise NotImplementedError() raise NotImplementedError
async def async_set_percentage(self, percentage: int) -> None: async def async_set_percentage(self, percentage: int) -> None:
"""Set the speed of the fan, as a percentage.""" """Set the speed of the fan, as a percentage."""
@ -277,7 +277,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_preset_mode(self, preset_mode: str) -> None: def set_preset_mode(self, preset_mode: str) -> None:
"""Set new preset mode.""" """Set new preset mode."""
raise NotImplementedError() raise NotImplementedError
@final @final
async def async_handle_set_preset_mode_service(self, preset_mode: str) -> None: async def async_handle_set_preset_mode_service(self, preset_mode: str) -> None:
@ -307,7 +307,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_direction(self, direction: str) -> None: def set_direction(self, direction: str) -> None:
"""Set the direction of the fan.""" """Set the direction of the fan."""
raise NotImplementedError() raise NotImplementedError
async def async_set_direction(self, direction: str) -> None: async def async_set_direction(self, direction: str) -> None:
"""Set the direction of the fan.""" """Set the direction of the fan."""
@ -320,7 +320,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
**kwargs: Any, **kwargs: Any,
) -> None: ) -> None:
"""Turn on the fan.""" """Turn on the fan."""
raise NotImplementedError() raise NotImplementedError
@final @final
async def async_handle_turn_on_service( async def async_handle_turn_on_service(
@ -352,7 +352,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def oscillate(self, oscillating: bool) -> None: def oscillate(self, oscillating: bool) -> None:
"""Oscillate the fan.""" """Oscillate the fan."""
raise NotImplementedError() raise NotImplementedError
async def async_oscillate(self, oscillating: bool) -> None: async def async_oscillate(self, oscillating: bool) -> None:
"""Oscillate the fan.""" """Oscillate the fan."""

View file

@ -229,7 +229,7 @@ class FFmpegBase(Entity, Generic[_HAFFmpegT]):
This method is a coroutine. This method is a coroutine.
""" """
raise NotImplementedError() raise NotImplementedError
async def _async_stop_ffmpeg(self, entity_ids: list[str] | None) -> None: async def _async_stop_ffmpeg(self, entity_ids: list[str] | None) -> None:
"""Stop a FFmpeg process. """Stop a FFmpeg process.

View file

@ -203,13 +203,13 @@ class FileUploadView(HomeAssistantView):
hass = request.app[KEY_HASS] hass = request.app[KEY_HASS]
if DOMAIN not in hass.data: if DOMAIN not in hass.data:
raise web.HTTPNotFound() raise web.HTTPNotFound
file_id = data["file_id"] file_id = data["file_id"]
file_upload_data: FileUploadData = hass.data[DOMAIN] file_upload_data: FileUploadData = hass.data[DOMAIN]
if file_upload_data.files.pop(file_id, None) is None: if file_upload_data.files.pop(file_id, None) is None:
raise web.HTTPNotFound() raise web.HTTPNotFound
await hass.async_add_executor_job( await hass.async_add_executor_job(
lambda: shutil.rmtree(file_upload_data.file_dir(file_id)) lambda: shutil.rmtree(file_upload_data.file_dir(file_id))

View file

@ -469,7 +469,7 @@ class Filter:
def _filter_state(self, new_state: FilterState) -> FilterState: def _filter_state(self, new_state: FilterState) -> FilterState:
"""Implement filter.""" """Implement filter."""
raise NotImplementedError() raise NotImplementedError
def filter_state(self, new_state: _State) -> _State: def filter_state(self, new_state: _State) -> _State:
"""Implement a common interface for filters.""" """Implement a common interface for filters."""

View file

@ -49,9 +49,9 @@ class FlickConfigFlow(ConfigFlow, domain=DOMAIN):
async with asyncio.timeout(60): async with asyncio.timeout(60):
token = await auth.async_get_access_token() token = await auth.async_get_access_token()
except TimeoutError as err: except TimeoutError as err:
raise CannotConnect() from err raise CannotConnect from err
except AuthException as err: except AuthException as err:
raise InvalidAuth() from err raise InvalidAuth from err
return token is not None return token is not None

View file

@ -36,7 +36,7 @@ class FreedomproDataUpdateCoordinator(DataUpdateCoordinator[list[dict[str, Any]]
if result["state"]: if result["state"]:
self._devices = result["devices"] self._devices = result["devices"]
else: else:
raise UpdateFailed() raise UpdateFailed
result = await get_states( result = await get_states(
aiohttp_client.async_get_clientsession(self._hass), self._api_key aiohttp_client.async_get_clientsession(self._hass), self._api_key

View file

@ -342,21 +342,21 @@ class FritzBoxTools(
def unique_id(self) -> str: def unique_id(self) -> str:
"""Return unique id.""" """Return unique id."""
if not self._unique_id: if not self._unique_id:
raise ClassSetupMissing() raise ClassSetupMissing
return self._unique_id return self._unique_id
@property @property
def model(self) -> str: def model(self) -> str:
"""Return device model.""" """Return device model."""
if not self._model: if not self._model:
raise ClassSetupMissing() raise ClassSetupMissing
return self._model return self._model
@property @property
def current_firmware(self) -> str: def current_firmware(self) -> str:
"""Return current SW version.""" """Return current SW version."""
if not self._current_firmware: if not self._current_firmware:
raise ClassSetupMissing() raise ClassSetupMissing
return self._current_firmware return self._current_firmware
@property @property
@ -378,7 +378,7 @@ class FritzBoxTools(
def mac(self) -> str: def mac(self) -> str:
"""Return device Mac address.""" """Return device Mac address."""
if not self._unique_id: if not self._unique_id:
raise ClassSetupMissing() raise ClassSetupMissing
return dr.format_mac(self._unique_id) return dr.format_mac(self._unique_id)
@property @property
@ -966,7 +966,7 @@ class FritzDeviceBase(update_coordinator.CoordinatorEntity[AvmWrapper]):
async def async_process_update(self) -> None: async def async_process_update(self) -> None:
"""Update device.""" """Update device."""
raise NotImplementedError() raise NotImplementedError
async def async_on_demand_update(self) -> None: async def async_on_demand_update(self) -> None:
"""Update state.""" """Update state."""

View file

@ -289,7 +289,7 @@ class FritzBoxBaseCoordinatorSwitch(CoordinatorEntity[AvmWrapper], SwitchEntity)
@property @property
def data(self) -> dict[str, Any]: def data(self) -> dict[str, Any]:
"""Return entity data from coordinator data.""" """Return entity data from coordinator data."""
raise NotImplementedError() raise NotImplementedError
@property @property
def available(self) -> bool: def available(self) -> bool:
@ -298,7 +298,7 @@ class FritzBoxBaseCoordinatorSwitch(CoordinatorEntity[AvmWrapper], SwitchEntity)
async def _async_handle_turn_on_off(self, turn_on: bool) -> None: async def _async_handle_turn_on_off(self, turn_on: bool) -> None:
"""Handle switch state change request.""" """Handle switch state change request."""
raise NotImplementedError() raise NotImplementedError
async def async_turn_on(self, **kwargs: Any) -> None: async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on switch.""" """Turn on switch."""

View file

@ -480,12 +480,12 @@ class CameraImagePreview(HomeAssistantView):
flow = self.hass.config_entries.options.async_get(flow_id) flow = self.hass.config_entries.options.async_get(flow_id)
except UnknownFlow as exc: except UnknownFlow as exc:
_LOGGER.warning("Unknown flow while getting image preview") _LOGGER.warning("Unknown flow while getting image preview")
raise web.HTTPNotFound() from exc raise web.HTTPNotFound from exc
user_input = flow["context"]["preview_cam"] user_input = flow["context"]["preview_cam"]
camera = GenericCamera(self.hass, user_input, flow_id, "preview") camera = GenericCamera(self.hass, user_input, flow_id, "preview")
if not camera.is_on: if not camera.is_on:
_LOGGER.debug("Camera is off") _LOGGER.debug("Camera is off")
raise web.HTTPServiceUnavailable() raise web.HTTPServiceUnavailable
image = await _async_get_image( image = await _async_get_image(
camera, camera,
CAMERA_IMAGE_TIMEOUT, CAMERA_IMAGE_TIMEOUT,

View file

@ -30,13 +30,13 @@ def validate_config_entry(
_LOGGER.error("Request denied: %s", api_error.message) _LOGGER.error("Request denied: %s", api_error.message)
raise InvalidApiKeyException from api_error raise InvalidApiKeyException from api_error
_LOGGER.error("Unknown error: %s", api_error.message) _LOGGER.error("Unknown error: %s", api_error.message)
raise UnknownException() from api_error raise UnknownException from api_error
except TransportError as transport_error: except TransportError as transport_error:
_LOGGER.error("Unknown error: %s", transport_error) _LOGGER.error("Unknown error: %s", transport_error)
raise UnknownException() from transport_error raise UnknownException from transport_error
except Timeout as timeout_error: except Timeout as timeout_error:
_LOGGER.error("Timeout error") _LOGGER.error("Timeout error")
raise TimeoutError() from timeout_error raise TimeoutError from timeout_error
class InvalidApiKeyException(Exception): class InvalidApiKeyException(Exception):

View file

@ -46,7 +46,7 @@ async def validate_input(hass: HomeAssistant, data: dict[str, str]) -> dict[str,
CONF_API_USER: data[CONF_API_USER], CONF_API_USER: data[CONF_API_USER],
} }
except ClientResponseError as ex: except ClientResponseError as ex:
raise InvalidAuth() from ex raise InvalidAuth from ex
class HabiticaConfigFlow(ConfigFlow, domain=DOMAIN): class HabiticaConfigFlow(ConfigFlow, domain=DOMAIN):

View file

@ -48,12 +48,12 @@ class HassIOBaseAuth(HomeAssistantView):
hassio_ip hassio_ip
): ):
_LOGGER.error("Invalid auth request from %s", request.remote) _LOGGER.error("Invalid auth request from %s", request.remote)
raise HTTPUnauthorized() raise HTTPUnauthorized
# Check caller token # Check caller token
if request[KEY_HASS_USER].id != self.user.id: if request[KEY_HASS_USER].id != self.user.id:
_LOGGER.error("Invalid auth request from %s", request[KEY_HASS_USER].name) _LOGGER.error("Invalid auth request from %s", request[KEY_HASS_USER].name)
raise HTTPUnauthorized() raise HTTPUnauthorized
class HassIOAuth(HassIOBaseAuth): class HassIOAuth(HassIOBaseAuth):
@ -82,7 +82,7 @@ class HassIOAuth(HassIOBaseAuth):
data[ATTR_USERNAME], data[ATTR_PASSWORD] data[ATTR_USERNAME], data[ATTR_PASSWORD]
) )
except auth_ha.InvalidAuth: except auth_ha.InvalidAuth:
raise HTTPNotFound() from None raise HTTPNotFound from None
return web.Response(status=HTTPStatus.OK) return web.Response(status=HTTPStatus.OK)
@ -112,6 +112,6 @@ class HassIOPasswordReset(HassIOBaseAuth):
data[ATTR_USERNAME], data[ATTR_PASSWORD] data[ATTR_USERNAME], data[ATTR_PASSWORD]
) )
except auth_ha.InvalidUser as err: except auth_ha.InvalidUser as err:
raise HTTPNotFound() from err raise HTTPNotFound from err
return web.Response(status=HTTPStatus.OK) return web.Response(status=HTTPStatus.OK)

View file

@ -78,7 +78,7 @@ class HassIODiscovery(HomeAssistantView):
data = await self.hassio.get_discovery_message(uuid) data = await self.hassio.get_discovery_message(uuid)
except HassioAPIError as err: except HassioAPIError as err:
_LOGGER.error("Can't read discovery data: %s", err) _LOGGER.error("Can't read discovery data: %s", err)
raise HTTPServiceUnavailable() from None raise HTTPServiceUnavailable from None
await self.async_process_new(data) await self.async_process_new(data)
return web.Response() return web.Response()

View file

@ -571,7 +571,7 @@ class HassIO:
# such as ../../../../etc/passwd # such as ../../../../etc/passwd
if url != str(joined_url): if url != str(joined_url):
_LOGGER.error("Invalid request %s", command) _LOGGER.error("Invalid request %s", command)
raise HassioAPIError() raise HassioAPIError
try: try:
response = await self.websession.request( response = await self.websession.request(
@ -598,7 +598,7 @@ class HassIO:
method, method,
response.status, response.status,
) )
raise HassioAPIError() raise HassioAPIError
if return_text: if return_text:
return await response.text(encoding="utf-8") return await response.text(encoding="utf-8")
@ -611,4 +611,4 @@ class HassIO:
except aiohttp.ClientError as err: except aiohttp.ClientError as err:
_LOGGER.error("Client error on %s request %s", command, err) _LOGGER.error("Client error on %s request %s", command, err)
raise HassioAPIError() raise HassioAPIError

View file

@ -196,7 +196,7 @@ class HassIOView(HomeAssistantView):
except TimeoutError: except TimeoutError:
_LOGGER.error("Client timeout error on API request %s", path) _LOGGER.error("Client timeout error on API request %s", path)
raise HTTPBadGateway() raise HTTPBadGateway
get = _handle get = _handle
post = _handle post = _handle

View file

@ -77,10 +77,10 @@ class HassIOIngress(HomeAssistantView):
try: try:
target_url = URL(url) target_url = URL(url)
except ValueError as err: except ValueError as err:
raise HTTPBadRequest() from err raise HTTPBadRequest from err
if not target_url.path.startswith(base_path): if not target_url.path.startswith(base_path):
raise HTTPBadRequest() raise HTTPBadRequest
return target_url return target_url
@ -99,7 +99,7 @@ class HassIOIngress(HomeAssistantView):
except aiohttp.ClientError as err: except aiohttp.ClientError as err:
_LOGGER.debug("Ingress error with %s / %s: %s", token, path, err) _LOGGER.debug("Ingress error with %s / %s: %s", token, path, err)
raise HTTPBadGateway() from None raise HTTPBadGateway from None
get = _handle get = _handle
post = _handle post = _handle
@ -247,7 +247,7 @@ def _init_header(request: web.Request, token: str) -> CIMultiDict | dict[str, st
assert request.transport assert request.transport
if (peername := request.transport.get_extra_info("peername")) is None: if (peername := request.transport.get_extra_info("peername")) is None:
_LOGGER.error("Can't set forward_for header, missing peername") _LOGGER.error("Can't set forward_for header, missing peername")
raise HTTPBadRequest() raise HTTPBadRequest
headers[hdrs.X_FORWARDED_FOR] = _forwarded_for_header(forward_for, peername[0]) headers[hdrs.X_FORWARDED_FOR] = _forwarded_for_header(forward_for, peername[0])

View file

@ -112,7 +112,7 @@ async def websocket_supervisor_api(
if not connection.user.is_admin and not WS_NO_ADMIN_ENDPOINTS.match( if not connection.user.is_admin and not WS_NO_ADMIN_ENDPOINTS.match(
msg[ATTR_ENDPOINT] msg[ATTR_ENDPOINT]
): ):
raise Unauthorized() raise Unauthorized
supervisor: HassIO = hass.data[DOMAIN] supervisor: HassIO = hass.data[DOMAIN]
command = msg[ATTR_ENDPOINT] command = msg[ATTR_ENDPOINT]

View file

@ -95,7 +95,7 @@ class CecPlayerEntity(CecEntity, MediaPlayerEntity):
def clear_playlist(self) -> None: def clear_playlist(self) -> None:
"""Clear players playlist.""" """Clear players playlist."""
raise NotImplementedError() raise NotImplementedError
def turn_off(self) -> None: def turn_off(self) -> None:
"""Turn device off.""" """Turn device off."""
@ -111,7 +111,7 @@ class CecPlayerEntity(CecEntity, MediaPlayerEntity):
self, media_type: MediaType | str, media_id: str, **kwargs: Any self, media_type: MediaType | str, media_id: str, **kwargs: Any
) -> None: ) -> None:
"""Not supported.""" """Not supported."""
raise NotImplementedError() raise NotImplementedError
def media_next_track(self) -> None: def media_next_track(self) -> None:
"""Skip to next track.""" """Skip to next track."""
@ -119,11 +119,11 @@ class CecPlayerEntity(CecEntity, MediaPlayerEntity):
def media_seek(self, position: float) -> None: def media_seek(self, position: float) -> None:
"""Not supported.""" """Not supported."""
raise NotImplementedError() raise NotImplementedError
def set_volume_level(self, volume: float) -> None: def set_volume_level(self, volume: float) -> None:
"""Set volume level, range 0..1.""" """Set volume level, range 0..1."""
raise NotImplementedError() raise NotImplementedError
def media_pause(self) -> None: def media_pause(self) -> None:
"""Pause playback.""" """Pause playback."""
@ -132,7 +132,7 @@ class CecPlayerEntity(CecEntity, MediaPlayerEntity):
def select_source(self, source: str) -> None: def select_source(self, source: str) -> None:
"""Not supported.""" """Not supported."""
raise NotImplementedError() raise NotImplementedError
def media_play(self) -> None: def media_play(self) -> None:
"""Start playback.""" """Start playback."""

View file

@ -90,7 +90,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
devices = await hive.session.startSession(hive_config) devices = await hive.session.startSession(hive_config)
except HTTPException as error: except HTTPException as error:
_LOGGER.error("Could not connect to the internet: %s", error) _LOGGER.error("Could not connect to the internet: %s", error)
raise ConfigEntryNotReady() from error raise ConfigEntryNotReady from error
except HiveReauthRequired as err: except HiveReauthRequired as err:
raise ConfigEntryAuthFailed from err raise ConfigEntryAuthFailed from err

View file

@ -1163,7 +1163,7 @@ class HomeKitPairingQRView(HomeAssistantView):
async def get(self, request: web.Request) -> web.Response: async def get(self, request: web.Request) -> web.Response:
"""Retrieve the pairing QRCode image.""" """Retrieve the pairing QRCode image."""
if not request.query_string: if not request.query_string:
raise Unauthorized() raise Unauthorized
entry_id, secret = request.query_string.split("-") entry_id, secret = request.query_string.split("-")
hass = request.app[KEY_HASS] hass = request.app[KEY_HASS]
domain_data: dict[str, HomeKitEntryData] = hass.data[DOMAIN] domain_data: dict[str, HomeKitEntryData] = hass.data[DOMAIN]
@ -1173,7 +1173,7 @@ class HomeKitPairingQRView(HomeAssistantView):
or not entry_data.pairing_qr_secret or not entry_data.pairing_qr_secret
or secret != entry_data.pairing_qr_secret or secret != entry_data.pairing_qr_secret
): ):
raise Unauthorized() raise Unauthorized
return web.Response( return web.Response(
body=entry_data.pairing_qr, body=entry_data.pairing_qr,
content_type="image/svg+xml", content_type="image/svg+xml",

View file

@ -588,7 +588,7 @@ class HomeAccessory(Accessory): # type: ignore[misc]
Overridden by accessory types. Overridden by accessory types.
""" """
raise NotImplementedError() raise NotImplementedError
@ha_callback @ha_callback
def async_call_service( def async_call_service(

View file

@ -82,7 +82,7 @@ async def ban_middleware(
# Verify if IP is not banned # Verify if IP is not banned
ip_address_ = ip_address(request.remote) # type: ignore[arg-type] ip_address_ = ip_address(request.remote) # type: ignore[arg-type]
if ip_address_ in ip_bans_lookup: if ip_address_ in ip_bans_lookup:
raise HTTPForbidden() raise HTTPForbidden
try: try:
return await handler(request) return await handler(request)

View file

@ -52,14 +52,14 @@ class CachingStaticResource(StaticResource):
filepath = await hass.async_add_executor_job(_get_file_path, *key) filepath = await hass.async_add_executor_job(_get_file_path, *key)
except (ValueError, FileNotFoundError) as error: except (ValueError, FileNotFoundError) as error:
# relatively safe # relatively safe
raise HTTPNotFound() from error raise HTTPNotFound from error
except HTTPForbidden: except HTTPForbidden:
# forbidden # forbidden
raise raise
except Exception as error: except Exception as error:
# perm error or other kind! # perm error or other kind!
request.app.logger.exception(error) request.app.logger.exception(error)
raise HTTPNotFound() from error raise HTTPNotFound from error
content_type: str | None = None content_type: str | None = None
if filepath is not None: if filepath is not None:

View file

@ -248,7 +248,7 @@ class HumidifierEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_AT
def set_humidity(self, humidity: int) -> None: def set_humidity(self, humidity: int) -> None:
"""Set new target humidity.""" """Set new target humidity."""
raise NotImplementedError() raise NotImplementedError
async def async_set_humidity(self, humidity: int) -> None: async def async_set_humidity(self, humidity: int) -> None:
"""Set new target humidity.""" """Set new target humidity."""
@ -256,7 +256,7 @@ class HumidifierEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_AT
def set_mode(self, mode: str) -> None: def set_mode(self, mode: str) -> None:
"""Set new mode.""" """Set new mode."""
raise NotImplementedError() raise NotImplementedError
async def async_set_mode(self, mode: str) -> None: async def async_set_mode(self, mode: str) -> None:
"""Set new mode.""" """Set new mode."""

View file

@ -141,7 +141,7 @@ class IcloudFlowHandler(ConfigFlow, domain=DOMAIN):
getattr, self.api, "devices" getattr, self.api, "devices"
) )
if not devices: if not devices:
raise PyiCloudNoDevicesException() raise PyiCloudNoDevicesException
except (PyiCloudServiceNotActivatedException, PyiCloudNoDevicesException): except (PyiCloudServiceNotActivatedException, PyiCloudNoDevicesException):
_LOGGER.error("No device found in the iCloud account: %s", self._username) _LOGGER.error("No device found in the iCloud account: %s", self._username)
self.api = None self.api = None

View file

@ -190,7 +190,7 @@ class ImageEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def image(self) -> bytes | None: def image(self) -> bytes | None:
"""Return bytes of image.""" """Return bytes of image."""
raise NotImplementedError() raise NotImplementedError
async def _fetch_url(self, url: str) -> httpx.Response | None: async def _fetch_url(self, url: str) -> httpx.Response | None:
"""Fetch a URL.""" """Fetch a URL."""
@ -278,7 +278,7 @@ class ImageView(HomeAssistantView):
async def get(self, request: web.Request, entity_id: str) -> web.StreamResponse: async def get(self, request: web.Request, entity_id: str) -> web.StreamResponse:
"""Start a GET request.""" """Start a GET request."""
if (image_entity := self.component.get_entity(entity_id)) is None: if (image_entity := self.component.get_entity(entity_id)) is None:
raise web.HTTPNotFound() raise web.HTTPNotFound
authenticated = ( authenticated = (
request[KEY_AUTHENTICATED] request[KEY_AUTHENTICATED]
@ -289,9 +289,9 @@ class ImageView(HomeAssistantView):
# Attempt with invalid bearer token, raise unauthorized # Attempt with invalid bearer token, raise unauthorized
# so ban middleware can handle it. # so ban middleware can handle it.
if hdrs.AUTHORIZATION in request.headers: if hdrs.AUTHORIZATION in request.headers:
raise web.HTTPUnauthorized() raise web.HTTPUnauthorized
# Invalid sigAuth or image entity access token # Invalid sigAuth or image entity access token
raise web.HTTPForbidden() raise web.HTTPForbidden
return await self.handle(request, image_entity) return await self.handle(request, image_entity)
@ -302,7 +302,7 @@ class ImageView(HomeAssistantView):
try: try:
image = await _async_get_image(image_entity, IMAGE_TIMEOUT) image = await _async_get_image(image_entity, IMAGE_TIMEOUT)
except (HomeAssistantError, ValueError) as ex: except (HomeAssistantError, ValueError) as ex:
raise web.HTTPInternalServerError() from ex raise web.HTTPInternalServerError from ex
return web.Response(body=image.content, content_type=image.content_type) return web.Response(body=image.content, content_type=image.content_type)

View file

@ -165,7 +165,7 @@ class ImageProcessingEntity(Entity):
def process_image(self, image: bytes) -> None: def process_image(self, image: bytes) -> None:
"""Process image.""" """Process image."""
raise NotImplementedError() raise NotImplementedError
async def async_process_image(self, image: bytes) -> None: async def async_process_image(self, image: bytes) -> None:
"""Process image.""" """Process image."""

View file

@ -199,7 +199,7 @@ class ImageServeView(HomeAssistantView):
image_info = self.image_collection.data.get(image_id) image_info = self.image_collection.data.get(image_id)
if image_info is None: if image_info is None:
raise web.HTTPNotFound() raise web.HTTPNotFound
hass = request.app[KEY_HASS] hass = request.app[KEY_HASS]
target_file = self.image_folder / image_id / f"{width}x{height}" target_file = self.image_folder / image_id / f"{width}x{height}"

View file

@ -406,7 +406,7 @@ class ImapPollingDataUpdateCoordinator(ImapDataUpdateCoordinator):
) as ex: ) as ex:
await self._cleanup() await self._cleanup()
self.async_set_update_error(ex) self.async_set_update_error(ex)
raise UpdateFailed() from ex raise UpdateFailed from ex
except InvalidFolder as ex: except InvalidFolder as ex:
_LOGGER.warning("Selected mailbox folder is invalid") _LOGGER.warning("Selected mailbox folder is invalid")
await self._cleanup() await self._cleanup()
@ -423,7 +423,7 @@ class ImapPollingDataUpdateCoordinator(ImapDataUpdateCoordinator):
) )
self.config_entry.async_start_reauth(self.hass) self.config_entry.async_start_reauth(self.hass)
self.async_set_update_error(ex) self.async_set_update_error(ex)
raise ConfigEntryAuthFailed() from ex raise ConfigEntryAuthFailed from ex
class ImapPushDataUpdateCoordinator(ImapDataUpdateCoordinator): class ImapPushDataUpdateCoordinator(ImapDataUpdateCoordinator):

View file

@ -166,7 +166,7 @@ def setup_platform(
influx = get_influx_connection(config, test_read=True) influx = get_influx_connection(config, test_read=True)
except ConnectionError as exc: except ConnectionError as exc:
_LOGGER.error(exc) _LOGGER.error(exc)
raise PlatformNotReady() from exc raise PlatformNotReady from exc
entities = [] entities = []
if CONF_QUERIES_FLUX in config: if CONF_QUERIES_FLUX in config:

View file

@ -92,7 +92,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# The IQVIA API can be selectively flaky, meaning that any number of the setup # The IQVIA API can be selectively flaky, meaning that any number of the setup
# API calls could fail. We only retry integration setup if *all* of the initial # API calls could fail. We only retry integration setup if *all* of the initial
# API calls fail: # API calls fail:
raise ConfigEntryNotReady() raise ConfigEntryNotReady
# Once we've successfully authenticated, we re-enable client request retries: # Once we've successfully authenticated, we re-enable client request retries:
client.enable_request_retries() client.enable_request_retries()

View file

@ -15,7 +15,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if "zip_code" in entry.data: if "zip_code" in entry.data:
coordinator = JustNimbusCoordinator(hass=hass, entry=entry) coordinator = JustNimbusCoordinator(hass=hass, entry=entry)
else: else:
raise ConfigEntryAuthFailed() raise ConfigEntryAuthFailed
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator

View file

@ -270,7 +270,7 @@ class KefMediaPlayer(MediaPlayerEntity):
async def async_turn_on(self) -> None: async def async_turn_on(self) -> None:
"""Turn the media player on.""" """Turn the media player on."""
if not self._supports_on: if not self._supports_on:
raise NotImplementedError() raise NotImplementedError
await self._speaker.turn_on() await self._speaker.turn_on()
async def async_volume_up(self) -> None: async def async_volume_up(self) -> None:

View file

@ -78,7 +78,7 @@ async def validate_ws(hass: HomeAssistant, data):
await kwc.connect() await kwc.connect()
if not kwc.connected: if not kwc.connected:
_LOGGER.warning("Cannot connect to %s:%s over WebSocket", host, ws_port) _LOGGER.warning("Cannot connect to %s:%s over WebSocket", host, ws_port)
raise WSCannotConnect() raise WSCannotConnect
kodi = Kodi(kwc) kodi = Kodi(kwc)
await kodi.ping() await kodi.ping()
except CannotConnectError as error: except CannotConnectError as error:

View file

@ -108,7 +108,7 @@ class LawnMowerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def start_mowing(self) -> None: def start_mowing(self) -> None:
"""Start or resume mowing.""" """Start or resume mowing."""
raise NotImplementedError() raise NotImplementedError
async def async_start_mowing(self) -> None: async def async_start_mowing(self) -> None:
"""Start or resume mowing.""" """Start or resume mowing."""
@ -116,7 +116,7 @@ class LawnMowerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def dock(self) -> None: def dock(self) -> None:
"""Dock the mower.""" """Dock the mower."""
raise NotImplementedError() raise NotImplementedError
async def async_dock(self) -> None: async def async_dock(self) -> None:
"""Dock the mower.""" """Dock the mower."""
@ -124,7 +124,7 @@ class LawnMowerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def pause(self) -> None: def pause(self) -> None:
"""Pause the lawn mower.""" """Pause the lawn mower."""
raise NotImplementedError() raise NotImplementedError
async def async_pause(self) -> None: async def async_pause(self) -> None:
"""Pause the lawn mower.""" """Pause the lawn mower."""

View file

@ -97,7 +97,7 @@ class LiteJetLight(LightEntity):
try: try:
await self._lj.activate_load(self._index) await self._lj.activate_load(self._index)
except LiteJetError as exc: except LiteJetError as exc:
raise HomeAssistantError() from exc raise HomeAssistantError from exc
return return
# If either attribute is specified then Home Assistant must # If either attribute is specified then Home Assistant must
@ -109,7 +109,7 @@ class LiteJetLight(LightEntity):
try: try:
await self._lj.activate_load_at(self._index, brightness, int(transition)) await self._lj.activate_load_at(self._index, brightness, int(transition))
except LiteJetError as exc: except LiteJetError as exc:
raise HomeAssistantError() from exc raise HomeAssistantError from exc
async def async_turn_off(self, **kwargs: Any) -> None: async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the light.""" """Turn off the light."""
@ -117,7 +117,7 @@ class LiteJetLight(LightEntity):
try: try:
await self._lj.activate_load_at(self._index, 0, kwargs[ATTR_TRANSITION]) await self._lj.activate_load_at(self._index, 0, kwargs[ATTR_TRANSITION])
except LiteJetError as exc: except LiteJetError as exc:
raise HomeAssistantError() from exc raise HomeAssistantError from exc
return return
# If transition attribute is not specified then the simple # If transition attribute is not specified then the simple
@ -126,7 +126,7 @@ class LiteJetLight(LightEntity):
try: try:
await self._lj.deactivate_load(self._index) await self._lj.deactivate_load(self._index)
except LiteJetError as exc: except LiteJetError as exc:
raise HomeAssistantError() from exc raise HomeAssistantError from exc
async def async_update(self) -> None: async def async_update(self) -> None:
"""Retrieve the light's brightness from the LiteJet system.""" """Retrieve the light's brightness from the LiteJet system."""

View file

@ -77,4 +77,4 @@ class LiteJetScene(Scene):
try: try:
await self._lj.activate_scene(self._index) await self._lj.activate_scene(self._index)
except LiteJetError as exc: except LiteJetError as exc:
raise HomeAssistantError() from exc raise HomeAssistantError from exc

View file

@ -92,11 +92,11 @@ class LiteJetSwitch(SwitchEntity):
try: try:
await self._lj.press_switch(self._index) await self._lj.press_switch(self._index)
except LiteJetError as exc: except LiteJetError as exc:
raise HomeAssistantError() from exc raise HomeAssistantError from exc
async def async_turn_off(self, **kwargs: Any) -> None: async def async_turn_off(self, **kwargs: Any) -> None:
"""Release the switch.""" """Release the switch."""
try: try:
await self._lj.release_switch(self._index) await self._lj.release_switch(self._index)
except LiteJetError as exc: except LiteJetError as exc:
raise HomeAssistantError() from exc raise HomeAssistantError from exc

View file

@ -219,7 +219,7 @@ class LockEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def lock(self, **kwargs: Any) -> None: def lock(self, **kwargs: Any) -> None:
"""Lock the lock.""" """Lock the lock."""
raise NotImplementedError() raise NotImplementedError
async def async_lock(self, **kwargs: Any) -> None: async def async_lock(self, **kwargs: Any) -> None:
"""Lock the lock.""" """Lock the lock."""
@ -232,7 +232,7 @@ class LockEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def unlock(self, **kwargs: Any) -> None: def unlock(self, **kwargs: Any) -> None:
"""Unlock the lock.""" """Unlock the lock."""
raise NotImplementedError() raise NotImplementedError
async def async_unlock(self, **kwargs: Any) -> None: async def async_unlock(self, **kwargs: Any) -> None:
"""Unlock the lock.""" """Unlock the lock."""
@ -245,7 +245,7 @@ class LockEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def open(self, **kwargs: Any) -> None: def open(self, **kwargs: Any) -> None:
"""Open the door latch.""" """Open the door latch."""
raise NotImplementedError() raise NotImplementedError
async def async_open(self, **kwargs: Any) -> None: async def async_open(self, **kwargs: Any) -> None:
"""Open the door latch.""" """Open the door latch."""

View file

@ -180,7 +180,7 @@ class Mailbox:
@property @property
def media_type(self) -> str: def media_type(self) -> str:
"""Return the supported media type.""" """Return the supported media type."""
raise NotImplementedError() raise NotImplementedError
@property @property
def can_delete(self) -> bool: def can_delete(self) -> bool:
@ -194,15 +194,15 @@ class Mailbox:
async def async_get_media(self, msgid: str) -> bytes: async def async_get_media(self, msgid: str) -> bytes:
"""Return the media blob for the msgid.""" """Return the media blob for the msgid."""
raise NotImplementedError() raise NotImplementedError
async def async_get_messages(self) -> list[dict[str, Any]]: async def async_get_messages(self) -> list[dict[str, Any]]:
"""Return a list of the current messages.""" """Return a list of the current messages."""
raise NotImplementedError() raise NotImplementedError
async def async_delete(self, msgid: str) -> bool: async def async_delete(self, msgid: str) -> bool:
"""Delete the specified messages.""" """Delete the specified messages."""
raise NotImplementedError() raise NotImplementedError
class StreamError(Exception): class StreamError(Exception):

View file

@ -127,7 +127,7 @@ class MediaExtractor:
all_media = ydl.extract_info(self.get_media_url(), process=False) all_media = ydl.extract_info(self.get_media_url(), process=False)
except DownloadError as err: except DownloadError as err:
# This exception will be logged by youtube-dl itself # This exception will be logged by youtube-dl itself
raise MEDownloadException() from err raise MEDownloadException from err
if "entries" in all_media: if "entries" in all_media:
_LOGGER.warning("Playlists are not supported, looking for the first video") _LOGGER.warning("Playlists are not supported, looking for the first video")
@ -136,7 +136,7 @@ class MediaExtractor:
selected_media = entries[0] selected_media = entries[0]
else: else:
_LOGGER.error("Playlist is empty") _LOGGER.error("Playlist is empty")
raise MEDownloadException() raise MEDownloadException
else: else:
selected_media = all_media selected_media = all_media
@ -147,7 +147,7 @@ class MediaExtractor:
requested_stream = ydl.process_ie_result(selected_media, download=False) requested_stream = ydl.process_ie_result(selected_media, download=False)
except (ExtractorError, DownloadError) as err: except (ExtractorError, DownloadError) as err:
_LOGGER.error("Could not extract stream for the query: %s", query) _LOGGER.error("Could not extract stream for the query: %s", query)
raise MEQueryException() from err raise MEQueryException from err
if "formats" in requested_stream: if "formats" in requested_stream:
if requested_stream["extractor"] == "youtube": if requested_stream["extractor"] == "youtube":

View file

@ -783,7 +783,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def turn_on(self) -> None: def turn_on(self) -> None:
"""Turn the media player on.""" """Turn the media player on."""
raise NotImplementedError() raise NotImplementedError
async def async_turn_on(self) -> None: async def async_turn_on(self) -> None:
"""Turn the media player on.""" """Turn the media player on."""
@ -791,7 +791,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def turn_off(self) -> None: def turn_off(self) -> None:
"""Turn the media player off.""" """Turn the media player off."""
raise NotImplementedError() raise NotImplementedError
async def async_turn_off(self) -> None: async def async_turn_off(self) -> None:
"""Turn the media player off.""" """Turn the media player off."""
@ -799,7 +799,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def mute_volume(self, mute: bool) -> None: def mute_volume(self, mute: bool) -> None:
"""Mute the volume.""" """Mute the volume."""
raise NotImplementedError() raise NotImplementedError
async def async_mute_volume(self, mute: bool) -> None: async def async_mute_volume(self, mute: bool) -> None:
"""Mute the volume.""" """Mute the volume."""
@ -807,7 +807,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_volume_level(self, volume: float) -> None: def set_volume_level(self, volume: float) -> None:
"""Set volume level, range 0..1.""" """Set volume level, range 0..1."""
raise NotImplementedError() raise NotImplementedError
async def async_set_volume_level(self, volume: float) -> None: async def async_set_volume_level(self, volume: float) -> None:
"""Set volume level, range 0..1.""" """Set volume level, range 0..1."""
@ -815,7 +815,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def media_play(self) -> None: def media_play(self) -> None:
"""Send play command.""" """Send play command."""
raise NotImplementedError() raise NotImplementedError
async def async_media_play(self) -> None: async def async_media_play(self) -> None:
"""Send play command.""" """Send play command."""
@ -823,7 +823,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def media_pause(self) -> None: def media_pause(self) -> None:
"""Send pause command.""" """Send pause command."""
raise NotImplementedError() raise NotImplementedError
async def async_media_pause(self) -> None: async def async_media_pause(self) -> None:
"""Send pause command.""" """Send pause command."""
@ -831,7 +831,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def media_stop(self) -> None: def media_stop(self) -> None:
"""Send stop command.""" """Send stop command."""
raise NotImplementedError() raise NotImplementedError
async def async_media_stop(self) -> None: async def async_media_stop(self) -> None:
"""Send stop command.""" """Send stop command."""
@ -839,7 +839,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def media_previous_track(self) -> None: def media_previous_track(self) -> None:
"""Send previous track command.""" """Send previous track command."""
raise NotImplementedError() raise NotImplementedError
async def async_media_previous_track(self) -> None: async def async_media_previous_track(self) -> None:
"""Send previous track command.""" """Send previous track command."""
@ -847,7 +847,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def media_next_track(self) -> None: def media_next_track(self) -> None:
"""Send next track command.""" """Send next track command."""
raise NotImplementedError() raise NotImplementedError
async def async_media_next_track(self) -> None: async def async_media_next_track(self) -> None:
"""Send next track command.""" """Send next track command."""
@ -855,7 +855,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def media_seek(self, position: float) -> None: def media_seek(self, position: float) -> None:
"""Send seek command.""" """Send seek command."""
raise NotImplementedError() raise NotImplementedError
async def async_media_seek(self, position: float) -> None: async def async_media_seek(self, position: float) -> None:
"""Send seek command.""" """Send seek command."""
@ -865,7 +865,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
self, media_type: MediaType | str, media_id: str, **kwargs: Any self, media_type: MediaType | str, media_id: str, **kwargs: Any
) -> None: ) -> None:
"""Play a piece of media.""" """Play a piece of media."""
raise NotImplementedError() raise NotImplementedError
async def async_play_media( async def async_play_media(
self, media_type: MediaType | str, media_id: str, **kwargs: Any self, media_type: MediaType | str, media_id: str, **kwargs: Any
@ -877,7 +877,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def select_source(self, source: str) -> None: def select_source(self, source: str) -> None:
"""Select input source.""" """Select input source."""
raise NotImplementedError() raise NotImplementedError
async def async_select_source(self, source: str) -> None: async def async_select_source(self, source: str) -> None:
"""Select input source.""" """Select input source."""
@ -885,7 +885,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def select_sound_mode(self, sound_mode: str) -> None: def select_sound_mode(self, sound_mode: str) -> None:
"""Select sound mode.""" """Select sound mode."""
raise NotImplementedError() raise NotImplementedError
async def async_select_sound_mode(self, sound_mode: str) -> None: async def async_select_sound_mode(self, sound_mode: str) -> None:
"""Select sound mode.""" """Select sound mode."""
@ -893,7 +893,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def clear_playlist(self) -> None: def clear_playlist(self) -> None:
"""Clear players playlist.""" """Clear players playlist."""
raise NotImplementedError() raise NotImplementedError
async def async_clear_playlist(self) -> None: async def async_clear_playlist(self) -> None:
"""Clear players playlist.""" """Clear players playlist."""
@ -901,7 +901,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_shuffle(self, shuffle: bool) -> None: def set_shuffle(self, shuffle: bool) -> None:
"""Enable/disable shuffle mode.""" """Enable/disable shuffle mode."""
raise NotImplementedError() raise NotImplementedError
async def async_set_shuffle(self, shuffle: bool) -> None: async def async_set_shuffle(self, shuffle: bool) -> None:
"""Enable/disable shuffle mode.""" """Enable/disable shuffle mode."""
@ -909,7 +909,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_repeat(self, repeat: RepeatMode) -> None: def set_repeat(self, repeat: RepeatMode) -> None:
"""Set repeat mode.""" """Set repeat mode."""
raise NotImplementedError() raise NotImplementedError
async def async_set_repeat(self, repeat: RepeatMode) -> None: async def async_set_repeat(self, repeat: RepeatMode) -> None:
"""Set repeat mode.""" """Set repeat mode."""
@ -1135,11 +1135,11 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
The BrowseMedia instance will be used by the The BrowseMedia instance will be used by the
"media_player/browse_media" websocket command. "media_player/browse_media" websocket command.
""" """
raise NotImplementedError() raise NotImplementedError
def join_players(self, group_members: list[str]) -> None: def join_players(self, group_members: list[str]) -> None:
"""Join `group_members` as a player group with the current player.""" """Join `group_members` as a player group with the current player."""
raise NotImplementedError() raise NotImplementedError
async def async_join_players(self, group_members: list[str]) -> None: async def async_join_players(self, group_members: list[str]) -> None:
"""Join `group_members` as a player group with the current player.""" """Join `group_members` as a player group with the current player."""
@ -1147,7 +1147,7 @@ class MediaPlayerEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def unjoin_player(self) -> None: def unjoin_player(self) -> None:
"""Remove this player from any group.""" """Remove this player from any group."""
raise NotImplementedError() raise NotImplementedError
async def async_unjoin_player(self) -> None: async def async_unjoin_player(self) -> None:
"""Remove this player from any group.""" """Remove this player from any group."""

View file

@ -219,21 +219,21 @@ class LocalMediaView(http.HomeAssistantView):
try: try:
raise_if_invalid_path(location) raise_if_invalid_path(location)
except ValueError as err: except ValueError as err:
raise web.HTTPBadRequest() from err raise web.HTTPBadRequest from err
if source_dir_id not in self.hass.config.media_dirs: if source_dir_id not in self.hass.config.media_dirs:
raise web.HTTPNotFound() raise web.HTTPNotFound
media_path = self.source.async_full_path(source_dir_id, location) media_path = self.source.async_full_path(source_dir_id, location)
# Check that the file exists # Check that the file exists
if not media_path.is_file(): if not media_path.is_file():
raise web.HTTPNotFound() raise web.HTTPNotFound
# Check that it's a media file # Check that it's a media file
mime_type, _ = mimetypes.guess_type(str(media_path)) mime_type, _ = mimetypes.guess_type(str(media_path))
if not mime_type or mime_type.split("/")[0] not in MEDIA_MIME_TYPES: if not mime_type or mime_type.split("/")[0] not in MEDIA_MIME_TYPES:
raise web.HTTPNotFound() raise web.HTTPNotFound
return web.FileResponse(media_path) return web.FileResponse(media_path)
@ -265,19 +265,19 @@ class UploadMediaView(http.HomeAssistantView):
data = self.schema(dict(await request.post())) data = self.schema(dict(await request.post()))
except vol.Invalid as err: except vol.Invalid as err:
LOGGER.error("Received invalid upload data: %s", err) LOGGER.error("Received invalid upload data: %s", err)
raise web.HTTPBadRequest() from err raise web.HTTPBadRequest from err
try: try:
item = MediaSourceItem.from_uri(self.hass, data["media_content_id"], None) item = MediaSourceItem.from_uri(self.hass, data["media_content_id"], None)
except ValueError as err: except ValueError as err:
LOGGER.error("Received invalid upload data: %s", err) LOGGER.error("Received invalid upload data: %s", err)
raise web.HTTPBadRequest() from err raise web.HTTPBadRequest from err
try: try:
source_dir_id, location = self.source.async_parse_identifier(item) source_dir_id, location = self.source.async_parse_identifier(item)
except Unresolvable as err: except Unresolvable as err:
LOGGER.error("Invalid local source ID") LOGGER.error("Invalid local source ID")
raise web.HTTPBadRequest() from err raise web.HTTPBadRequest from err
uploaded_file: FileField = data["file"] uploaded_file: FileField = data["file"]
@ -289,7 +289,7 @@ class UploadMediaView(http.HomeAssistantView):
raise_if_invalid_filename(uploaded_file.filename) raise_if_invalid_filename(uploaded_file.filename)
except ValueError as err: except ValueError as err:
LOGGER.error("Invalid filename") LOGGER.error("Invalid filename")
raise web.HTTPBadRequest() from err raise web.HTTPBadRequest from err
try: try:
await self.hass.async_add_executor_job( await self.hass.async_add_executor_job(
@ -299,7 +299,7 @@ class UploadMediaView(http.HomeAssistantView):
) )
except ValueError as err: except ValueError as err:
LOGGER.error("Moving upload failed: %s", err) LOGGER.error("Moving upload failed: %s", err)
raise web.HTTPBadRequest() from err raise web.HTTPBadRequest from err
return self.json( return self.json(
{"media_content_id": f"{data['media_content_id']}/{uploaded_file.filename}"} {"media_content_id": f"{data['media_content_id']}/{uploaded_file.filename}"}

View file

@ -78,7 +78,7 @@ class MetWeatherData:
"""Fetch data from API - (current weather and forecast).""" """Fetch data from API - (current weather and forecast)."""
resp = await self._weather_data.fetching_data() resp = await self._weather_data.fetching_data()
if not resp: if not resp:
raise CannotConnect() raise CannotConnect
self.current_weather_data = self._weather_data.get_current_weather() self.current_weather_data = self._weather_data.get_current_weather()
time_zone = dt_util.DEFAULT_TIME_ZONE time_zone = dt_util.DEFAULT_TIME_ZONE
self.daily_forecast = self._weather_data.get_forecast(time_zone, False, 0) self.daily_forecast = self._weather_data.get_forecast(time_zone, False, 0)

View file

@ -94,7 +94,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
fetch_site, connection, latitude, longitude fetch_site, connection, latitude, longitude
) )
if site is None: if site is None:
raise ConfigEntryNotReady() raise ConfigEntryNotReady
async def async_update_3hourly() -> MetOfficeData: async def async_update_3hourly() -> MetOfficeData:
return await hass.async_add_executor_job( return await hass.async_add_executor_job(

View file

@ -36,7 +36,7 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
) )
if site is None: if site is None:
raise CannotConnect() raise CannotConnect
return {"site_name": site.name} return {"site_name": site.name}

View file

@ -296,7 +296,7 @@ async def webhook_call_service(
config_entry.data[ATTR_DEVICE_NAME], config_entry.data[ATTR_DEVICE_NAME],
ex, ex,
) )
raise HTTPBadRequest() from ex raise HTTPBadRequest from ex
return empty_okay_response() return empty_okay_response()

View file

@ -30,7 +30,7 @@ async def _async_get_device_state(
await device.get_state() await device.get_state()
except MyStromConnectionError as err: except MyStromConnectionError as err:
_LOGGER.error("No route to myStrom plug: %s", ip_address) _LOGGER.error("No route to myStrom plug: %s", ip_address)
raise ConfigEntryNotReady() from err raise ConfigEntryNotReady from err
def _get_mystrom_bulb(host: str, mac: str) -> MyStromBulb: def _get_mystrom_bulb(host: str, mac: str) -> MyStromBulb:
@ -48,7 +48,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
info = await pymystrom.get_device_info(host) info = await pymystrom.get_device_info(host)
except MyStromConnectionError as err: except MyStromConnectionError as err:
_LOGGER.error("No route to myStrom plug: %s", host) _LOGGER.error("No route to myStrom plug: %s", host)
raise ConfigEntryNotReady() from err raise ConfigEntryNotReady from err
info.setdefault("type", 101) info.setdefault("type", 101)

View file

@ -64,7 +64,7 @@ def setup_platform(
requests.exceptions.HTTPError, requests.exceptions.HTTPError,
) as error: ) as error:
_LOGGER.error("Could not connect to the internet: %s", error) _LOGGER.error("Could not connect to the internet: %s", error)
raise PlatformNotReady() from error raise PlatformNotReady from error
except RequestParametersError as error: except RequestParametersError as error:
_LOGGER.error("Could not fetch stations, please check configuration: %s", error) _LOGGER.error("Could not fetch stations, please check configuration: %s", error)
return return

View file

@ -232,7 +232,7 @@ class BaseNotificationService:
kwargs can contain ATTR_TITLE to specify a title. kwargs can contain ATTR_TITLE to specify a title.
""" """
raise NotImplementedError() raise NotImplementedError
async def async_send_message(self, message: str, **kwargs: Any) -> None: async def async_send_message(self, message: str, **kwargs: Any) -> None:
"""Send a message. """Send a message.

View file

@ -394,7 +394,7 @@ class NumberEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def set_native_value(self, value: float) -> None: def set_native_value(self, value: float) -> None:
"""Set new value.""" """Set new value."""
raise NotImplementedError() raise NotImplementedError
async def async_set_native_value(self, value: float) -> None: async def async_set_native_value(self, value: float) -> None:
"""Set new value.""" """Set new value."""
@ -403,7 +403,7 @@ class NumberEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
@final @final
def set_value(self, value: float) -> None: def set_value(self, value: float) -> None:
"""Set new value.""" """Set new value."""
raise NotImplementedError() raise NotImplementedError
@final @final
async def async_set_value(self, value: float) -> None: async def async_set_value(self, value: float) -> None:

View file

@ -84,7 +84,7 @@ class InstallationTypeOnboardingView(HomeAssistantView):
async def get(self, request: web.Request) -> web.Response: async def get(self, request: web.Request) -> web.Response:
"""Return the onboarding status.""" """Return the onboarding status."""
if self._data["done"]: if self._data["done"]:
raise HTTPUnauthorized() raise HTTPUnauthorized
hass = request.app[KEY_HASS] hass = request.app[KEY_HASS]
info = await async_get_system_info(hass) info = await async_get_system_info(hass)

View file

@ -26,7 +26,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
CannotConnect, # Failed to connect to the server CannotConnect, # Failed to connect to the server
protocol.OwnetError, # Connected to server, but failed to list the devices protocol.OwnetError, # Connected to server, but failed to list the devices
) as exc: ) as exc:
raise ConfigEntryNotReady() from exc raise ConfigEntryNotReady from exc
hass.data[DOMAIN][entry.entry_id] = onewire_hub hass.data[DOMAIN][entry.entry_id] = onewire_hub

View file

@ -87,7 +87,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
raise ConfigEntryNotReady(f"Setup was unexpectedly canceled: {err}") from err raise ConfigEntryNotReady(f"Setup was unexpectedly canceled: {err}") from err
if not device.available: if not device.available:
raise ConfigEntryNotReady() raise ConfigEntryNotReady
hass.data[DOMAIN][entry.unique_id] = device hass.data[DOMAIN][entry.unique_id] = device

View file

@ -45,7 +45,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try: try:
devices: Any = await osoenergy.session.start_session(osoenergy_config) devices: Any = await osoenergy.session.start_session(osoenergy_config)
except HTTPException as error: except HTTPException as error:
raise ConfigEntryNotReady() from error raise ConfigEntryNotReady from error
except OSOEnergyReauthRequired as err: except OSOEnergyReauthRequired as err:
raise ConfigEntryAuthFailed from err raise ConfigEntryAuthFailed from err

View file

@ -78,16 +78,16 @@ async def async_setup_platform(
def _precheck_image(image, opts): def _precheck_image(image, opts):
"""Perform some pre-checks on the given image.""" """Perform some pre-checks on the given image."""
if not opts: if not opts:
raise ValueError() raise ValueError
try: try:
img = Image.open(io.BytesIO(image)) img = Image.open(io.BytesIO(image))
except OSError as err: except OSError as err:
_LOGGER.warning("Failed to open image") _LOGGER.warning("Failed to open image")
raise ValueError() from err raise ValueError from err
imgfmt = str(img.format) imgfmt = str(img.format)
if imgfmt not in ("PNG", "JPEG"): if imgfmt not in ("PNG", "JPEG"):
_LOGGER.warning("Image is of unsupported type: %s", imgfmt) _LOGGER.warning("Image is of unsupported type: %s", imgfmt)
raise ValueError() raise ValueError
if img.mode != "RGB": if img.mode != "RGB":
img = img.convert("RGB") img = img.convert("RGB")
return img return img
@ -292,7 +292,7 @@ class ProxyCamera(Camera):
if not image: if not image:
return None return None
except HomeAssistantError as err: except HomeAssistantError as err:
raise asyncio.CancelledError() from err raise asyncio.CancelledError from err
if self._mode == MODE_RESIZE: if self._mode == MODE_RESIZE:
job = _resize_image job = _resize_image

View file

@ -235,7 +235,7 @@ class RemoteEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_)
def send_command(self, command: Iterable[str], **kwargs: Any) -> None: def send_command(self, command: Iterable[str], **kwargs: Any) -> None:
"""Send commands to a device.""" """Send commands to a device."""
raise NotImplementedError() raise NotImplementedError
async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> None: async def async_send_command(self, command: Iterable[str], **kwargs: Any) -> None:
"""Send commands to a device.""" """Send commands to a device."""
@ -245,7 +245,7 @@ class RemoteEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_)
def learn_command(self, **kwargs: Any) -> None: def learn_command(self, **kwargs: Any) -> None:
"""Learn a command from a device.""" """Learn a command from a device."""
raise NotImplementedError() raise NotImplementedError
async def async_learn_command(self, **kwargs: Any) -> None: async def async_learn_command(self, **kwargs: Any) -> None:
"""Learn a command from a device.""" """Learn a command from a device."""
@ -253,7 +253,7 @@ class RemoteEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_)
def delete_command(self, **kwargs: Any) -> None: def delete_command(self, **kwargs: Any) -> None:
"""Delete commands from the database.""" """Delete commands from the database."""
raise NotImplementedError() raise NotImplementedError
async def async_delete_command(self, **kwargs: Any) -> None: async def async_delete_command(self, **kwargs: Any) -> None:
"""Delete commands from the database.""" """Delete commands from the database."""

View file

@ -21,16 +21,16 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
config_entry.data[CONF_USERNAME], config_entry.data[CONF_PASSWORD] config_entry.data[CONF_USERNAME], config_entry.data[CONF_PASSWORD]
) )
except (aiohttp.ClientConnectionError, GigyaException) as exc: except (aiohttp.ClientConnectionError, GigyaException) as exc:
raise ConfigEntryNotReady() from exc raise ConfigEntryNotReady from exc
if not login_success: if not login_success:
raise ConfigEntryAuthFailed() raise ConfigEntryAuthFailed
hass.data.setdefault(DOMAIN, {}) hass.data.setdefault(DOMAIN, {})
try: try:
await renault_hub.async_initialise(config_entry) await renault_hub.async_initialise(config_entry)
except aiohttp.ClientError as exc: except aiohttp.ClientError as exc:
raise ConfigEntryNotReady() from exc raise ConfigEntryNotReady from exc
hass.data[DOMAIN][config_entry.entry_id] = renault_hub hass.data[DOMAIN][config_entry.entry_id] = renault_hub

View file

@ -377,7 +377,7 @@ class RflinkDevice(Entity):
def _handle_event(self, event): def _handle_event(self, event):
"""Platform specific event handler.""" """Platform specific event handler."""
raise NotImplementedError() raise NotImplementedError
@property @property
def name(self): def name(self):

View file

@ -89,7 +89,7 @@ async def _async_setup_local_entry(hass: HomeAssistant, entry: ConfigEntry) -> b
try: try:
await risco.connect() await risco.connect()
except CannotConnectError as error: except CannotConnectError as error:
raise ConfigEntryNotReady() from error raise ConfigEntryNotReady from error
except UnauthorizedError: except UnauthorizedError:
_LOGGER.exception("Failed to login to Risco cloud") _LOGGER.exception("Failed to login to Risco cloud")
return False return False

View file

@ -125,7 +125,7 @@ class Scene(RestoreEntity):
def activate(self, **kwargs: Any) -> None: def activate(self, **kwargs: Any) -> None:
"""Activate scene. Try to get entities into requested state.""" """Activate scene. Try to get entities into requested state."""
raise NotImplementedError() raise NotImplementedError
async def async_activate(self, **kwargs: Any) -> None: async def async_activate(self, **kwargs: Any) -> None:
"""Activate scene. Try to get entities into requested state.""" """Activate scene. Try to get entities into requested state."""

View file

@ -159,7 +159,7 @@ class ScreenLogicSwitchingEntity(ScreenLogicEntity):
await self._async_set_state(ON_OFF.OFF) await self._async_set_state(ON_OFF.OFF)
async def _async_set_state(self, state: ON_OFF) -> None: async def _async_set_state(self, state: ON_OFF) -> None:
raise NotImplementedError() raise NotImplementedError
class ScreenLogicCircuitEntity(ScreenLogicSwitchingEntity, ScreenLogicPushEntity): class ScreenLogicCircuitEntity(ScreenLogicSwitchingEntity, ScreenLogicPushEntity):

View file

@ -112,7 +112,7 @@ class ScreenLogicNumber(ScreenLogicEntity, NumberEntity):
async def async_set_native_value(self, value: float) -> None: async def async_set_native_value(self, value: float) -> None:
"""Update the current value.""" """Update the current value."""
raise NotImplementedError() raise NotImplementedError
class ScreenLogicSCGNumber(ScreenLogicNumber): class ScreenLogicSCGNumber(ScreenLogicNumber):

View file

@ -164,7 +164,7 @@ class SelectEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
and self.entity_description.options is not None and self.entity_description.options is not None
): ):
return self.entity_description.options return self.entity_description.options
raise AttributeError() raise AttributeError
@cached_property @cached_property
def current_option(self) -> str | None: def current_option(self) -> str | None:
@ -197,7 +197,7 @@ class SelectEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
def select_option(self, option: str) -> None: def select_option(self, option: str) -> None:
"""Change the selected option.""" """Change the selected option."""
raise NotImplementedError() raise NotImplementedError
async def async_select_option(self, option: str) -> None: async def async_select_option(self, option: str) -> None:
"""Change the selected option.""" """Change the selected option."""

View file

@ -29,9 +29,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try: try:
await box.authenticate(username=username, password=password) await box.authenticate(username=username, password=password)
except SFRBoxAuthenticationError as err: except SFRBoxAuthenticationError as err:
raise ConfigEntryAuthFailed() from err raise ConfigEntryAuthFailed from err
except SFRBoxError as err: except SFRBoxError as err:
raise ConfigEntryNotReady() from err raise ConfigEntryNotReady from err
platforms = PLATFORMS_WITH_AUTH platforms = PLATFORMS_WITH_AUTH
data = DomainData( data = DomainData(

View file

@ -37,4 +37,4 @@ class SFRDataUpdateCoordinator(DataUpdateCoordinator[_T]):
try: try:
return await self._method(self.box) return await self._method(self.box)
except SFRBoxError as err: except SFRBoxError as err:
raise UpdateFailed() from err raise UpdateFailed from err

View file

@ -99,7 +99,7 @@ class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuum
def clean_spot(self, **kwargs: Any) -> None: def clean_spot(self, **kwargs: Any) -> None:
"""Clean a spot. Not yet implemented.""" """Clean a spot. Not yet implemented."""
raise NotImplementedError() raise NotImplementedError
def send_command( def send_command(
self, self,
@ -108,7 +108,7 @@ class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuum
**kwargs: Any, **kwargs: Any,
) -> None: ) -> None:
"""Send a command to the vacuum. Not yet implemented.""" """Send a command to the vacuum. Not yet implemented."""
raise NotImplementedError() raise NotImplementedError
@property @property
def is_online(self) -> bool: def is_online(self) -> bool:

View file

@ -33,7 +33,7 @@ async def async_setup_platform(
table_holder = hass.data[DATA_SISYPHUS][host] table_holder = hass.data[DATA_SISYPHUS][host]
table = await table_holder.get_table() table = await table_holder.get_table()
except aiohttp.ClientError as err: except aiohttp.ClientError as err:
raise PlatformNotReady() from err raise PlatformNotReady from err
add_entities([SisyphusLight(table_holder.name, table)], update_before_add=True) add_entities([SisyphusLight(table_holder.name, table)], update_before_add=True)

View file

@ -35,7 +35,7 @@ async def async_setup_platform(
table_holder = hass.data[DATA_SISYPHUS][host] table_holder = hass.data[DATA_SISYPHUS][host]
table = await table_holder.get_table() table = await table_holder.get_table()
except aiohttp.ClientError as err: except aiohttp.ClientError as err:
raise PlatformNotReady() from err raise PlatformNotReady from err
add_entities([SisyphusPlayer(table_holder.name, host, table)], True) add_entities([SisyphusPlayer(table_holder.name, host, table)], True)

Some files were not shown because too many files have changed in this diff Show more