diff --git a/homeassistant/components/airnow/config_flow.py b/homeassistant/components/airnow/config_flow.py index dd17e7f98db..e839acdcb7b 100644 --- a/homeassistant/components/airnow/config_flow.py +++ b/homeassistant/components/airnow/config_flow.py @@ -82,7 +82,7 @@ class AirNowConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except InvalidLocation: errors["base"] = "invalid_location" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/airthings/config_flow.py b/homeassistant/components/airthings/config_flow.py index eae7d35c62b..ab453ede20c 100644 --- a/homeassistant/components/airthings/config_flow.py +++ b/homeassistant/components/airthings/config_flow.py @@ -56,7 +56,7 @@ class AirthingsConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except airthings.AirthingsAuthError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/airthings_ble/config_flow.py b/homeassistant/components/airthings_ble/config_flow.py index d525aee04b1..48c7219cbaf 100644 --- a/homeassistant/components/airthings_ble/config_flow.py +++ b/homeassistant/components/airthings_ble/config_flow.py @@ -102,7 +102,7 @@ class AirthingsConfigFlow(ConfigFlow, domain=DOMAIN): device = await self._get_device_data(discovery_info) except AirthingsDeviceUpdateError: return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return self.async_abort(reason="unknown") name = get_name(device) @@ -160,7 +160,7 @@ class AirthingsConfigFlow(ConfigFlow, domain=DOMAIN): device = await self._get_device_data(discovery_info) except AirthingsDeviceUpdateError: return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return self.async_abort(reason="unknown") name = get_name(device) self._discovered_devices[address] = Discovery(name, discovery_info, device) diff --git a/homeassistant/components/airtouch5/config_flow.py b/homeassistant/components/airtouch5/config_flow.py index 3c4671cf54e..d96aaed96b7 100644 --- a/homeassistant/components/airtouch5/config_flow.py +++ b/homeassistant/components/airtouch5/config_flow.py @@ -32,7 +32,7 @@ class AirTouch5ConfigFlow(ConfigFlow, domain=DOMAIN): client = Airtouch5SimpleClient(user_input[CONF_HOST]) try: await client.test_connection() - except Exception: # pylint: disable=broad-exception-caught + except Exception: # noqa: BLE001 errors = {"base": "cannot_connect"} else: await self.async_set_unique_id(user_input[CONF_HOST]) diff --git a/homeassistant/components/airvisual_pro/config_flow.py b/homeassistant/components/airvisual_pro/config_flow.py index 97265b33913..ebdbc807b18 100644 --- a/homeassistant/components/airvisual_pro/config_flow.py +++ b/homeassistant/components/airvisual_pro/config_flow.py @@ -60,7 +60,7 @@ async def async_validate_credentials( except NodeProError as err: LOGGER.error("Unknown Pro error while connecting to %s: %s", ip_address, err) errors["base"] = "unknown" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.exception("Unknown error while connecting to %s: %s", ip_address, err) errors["base"] = "unknown" else: diff --git a/homeassistant/components/alarmdecoder/config_flow.py b/homeassistant/components/alarmdecoder/config_flow.py index a775375b835..779951dd0b0 100644 --- a/homeassistant/components/alarmdecoder/config_flow.py +++ b/homeassistant/components/alarmdecoder/config_flow.py @@ -128,7 +128,7 @@ class AlarmDecoderFlowHandler(ConfigFlow, domain=DOMAIN): ) except NoDeviceError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception during AlarmDecoder setup") errors["base"] = "unknown" diff --git a/homeassistant/components/alexa/capabilities.py b/homeassistant/components/alexa/capabilities.py index df32220895d..8a636fd744e 100644 --- a/homeassistant/components/alexa/capabilities.py +++ b/homeassistant/components/alexa/capabilities.py @@ -268,7 +268,7 @@ class AlexaCapability: prop_value = self.get_property(prop_name) except UnsupportedProperty: raise - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Unexpected error getting %s.%s property from %s", self.name(), diff --git a/homeassistant/components/alexa/entities.py b/homeassistant/components/alexa/entities.py index ca7b78f7ff5..1ab4aafc081 100644 --- a/homeassistant/components/alexa/entities.py +++ b/homeassistant/components/alexa/entities.py @@ -353,7 +353,7 @@ class AlexaEntity: try: capabilities.append(i.serialize_discovery()) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error serializing %s discovery for %s", i.name(), self.entity ) @@ -379,7 +379,7 @@ def async_get_entities( try: alexa_entity = ENTITY_ADAPTERS[state.domain](hass, config, state) interfaces = list(alexa_entity.interfaces()) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unable to serialize %s for discovery", state.entity_id) else: if not interfaces: diff --git a/homeassistant/components/alexa/handlers.py b/homeassistant/components/alexa/handlers.py index c28b1923399..47e09db1166 100644 --- a/homeassistant/components/alexa/handlers.py +++ b/homeassistant/components/alexa/handlers.py @@ -126,7 +126,7 @@ async def async_api_discovery( continue try: discovered_serialized_entity = alexa_entity.serialize_discovery() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Unable to serialize %s for discovery", alexa_entity.entity_id ) diff --git a/homeassistant/components/alexa/smart_home.py b/homeassistant/components/alexa/smart_home.py index 81ce2981acb..57c1ba791ba 100644 --- a/homeassistant/components/alexa/smart_home.py +++ b/homeassistant/components/alexa/smart_home.py @@ -219,7 +219,7 @@ async def async_handle_message( error_message=err.error_message, payload=err.payload, ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Uncaught exception processing Alexa %s/%s request (%s)", directive.namespace, diff --git a/homeassistant/components/androidtv/config_flow.py b/homeassistant/components/androidtv/config_flow.py index 20396b20bb9..1ed4b0f6782 100644 --- a/homeassistant/components/androidtv/config_flow.py +++ b/homeassistant/components/androidtv/config_flow.py @@ -119,7 +119,7 @@ class AndroidTVFlowHandler(ConfigFlow, domain=DOMAIN): try: aftv, error_message = await async_connect_androidtv(self.hass, user_input) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Unknown error connecting with Android device at %s", user_input[CONF_HOST], diff --git a/homeassistant/components/androidtv/entity.py b/homeassistant/components/androidtv/entity.py index 7df80c187cd..6e5414ec9f4 100644 --- a/homeassistant/components/androidtv/entity.py +++ b/homeassistant/components/androidtv/entity.py @@ -89,7 +89,7 @@ def adb_decorator( await self.aftv.adb_close() self._attr_available = False return None - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 # An unforeseen exception occurred. Close the ADB connection so that # it doesn't happen over and over again. if self.available: diff --git a/homeassistant/components/anova/config_flow.py b/homeassistant/components/anova/config_flow.py index 08a3d4e832f..0015d5ea13f 100644 --- a/homeassistant/components/anova/config_flow.py +++ b/homeassistant/components/anova/config_flow.py @@ -38,7 +38,7 @@ class AnovaConfligFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except NoDevicesFound: errors["base"] = "no_devices_found" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" else: # We store device list in config flow in order to persist found devices on restart, as the Anova api get_devices does not return any devices that are offline. diff --git a/homeassistant/components/aosmith/config_flow.py b/homeassistant/components/aosmith/config_flow.py index ec38460116d..6d74a9936ae 100644 --- a/homeassistant/components/aosmith/config_flow.py +++ b/homeassistant/components/aosmith/config_flow.py @@ -36,7 +36,7 @@ class AOSmithConfigFlow(ConfigFlow, domain=DOMAIN): await client.get_devices() except AOSmithInvalidCredentialsException: return "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return "unknown" diff --git a/homeassistant/components/apple_tv/__init__.py b/homeassistant/components/apple_tv/__init__.py index cd1a1c59127..5e3c1c37d4a 100644 --- a/homeassistant/components/apple_tv/__init__.py +++ b/homeassistant/components/apple_tv/__init__.py @@ -246,7 +246,7 @@ class AppleTVManager(DeviceListener): if self._task: self._task.cancel() self._task = None - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("An error occurred while disconnecting") def _start_connect_loop(self) -> None: @@ -292,7 +292,7 @@ class AppleTVManager(DeviceListener): return except asyncio.CancelledError: pass - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Failed to connect") await self.disconnect() diff --git a/homeassistant/components/apple_tv/config_flow.py b/homeassistant/components/apple_tv/config_flow.py index 1f2aa3b3b3a..71c26244203 100644 --- a/homeassistant/components/apple_tv/config_flow.py +++ b/homeassistant/components/apple_tv/config_flow.py @@ -184,7 +184,7 @@ class AppleTVConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "no_devices_found" except DeviceAlreadyConfigured: errors["base"] = "already_configured" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -329,7 +329,7 @@ class AppleTVConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="no_devices_found") except DeviceAlreadyConfigured: return self.async_abort(reason="already_configured") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") @@ -472,7 +472,7 @@ class AppleTVConfigFlow(ConfigFlow, domain=DOMAIN): except exceptions.PairingError: _LOGGER.exception("Authentication problem") abort_reason = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") abort_reason = "unknown" @@ -514,7 +514,7 @@ class AppleTVConfigFlow(ConfigFlow, domain=DOMAIN): except exceptions.PairingError: _LOGGER.exception("Authentication problem") errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/arcam_fmj/__init__.py b/homeassistant/components/arcam_fmj/__init__.py index ff6bd872065..e4a0ae78920 100644 --- a/homeassistant/components/arcam_fmj/__init__.py +++ b/homeassistant/components/arcam_fmj/__init__.py @@ -86,6 +86,6 @@ async def _run_client(hass: HomeAssistant, client: Client, interval: float) -> N await asyncio.sleep(interval) except TimeoutError: continue - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception, aborting arcam client") return diff --git a/homeassistant/components/aseko_pool_live/config_flow.py b/homeassistant/components/aseko_pool_live/config_flow.py index f4df44aa2d7..cd2f0e4ac7f 100644 --- a/homeassistant/components/aseko_pool_live/config_flow.py +++ b/homeassistant/components/aseko_pool_live/config_flow.py @@ -62,7 +62,7 @@ class AsekoConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuthCredentials: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -126,7 +126,7 @@ class AsekoConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuthCredentials: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/assist_pipeline/pipeline.py b/homeassistant/components/assist_pipeline/pipeline.py index 2251167466c..71b3d9f1592 100644 --- a/homeassistant/components/assist_pipeline/pipeline.py +++ b/homeassistant/components/assist_pipeline/pipeline.py @@ -1295,7 +1295,7 @@ def _pipeline_debug_recording_thread_proc( wav_writer.writeframes(message) except Empty: pass # occurs when pipeline has unexpected error - except Exception: # pylint: disable=broad-exception-caught + except Exception: _LOGGER.exception("Unexpected error in debug recording thread") finally: if wav_writer is not None: diff --git a/homeassistant/components/asuswrt/config_flow.py b/homeassistant/components/asuswrt/config_flow.py index e456b1c55ba..f5db3dfa3d8 100644 --- a/homeassistant/components/asuswrt/config_flow.py +++ b/homeassistant/components/asuswrt/config_flow.py @@ -195,7 +195,7 @@ class AsusWrtFlowHandler(ConfigFlow, domain=DOMAIN): ) error = RESULT_CONN_ERROR - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Unknown error connecting with AsusWrt router at %s using protocol %s", host, diff --git a/homeassistant/components/august/config_flow.py b/homeassistant/components/august/config_flow.py index e6803da2ae0..08401e15b84 100644 --- a/homeassistant/components/august/config_flow.py +++ b/homeassistant/components/august/config_flow.py @@ -254,7 +254,7 @@ class AugustConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except RequireValidation: validation_required = True - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: _LOGGER.exception("Unexpected exception") errors["base"] = "unhandled" description_placeholders = {"error": str(ex)} diff --git a/homeassistant/components/aurora/config_flow.py b/homeassistant/components/aurora/config_flow.py index 744624c2eb8..521af17b659 100644 --- a/homeassistant/components/aurora/config_flow.py +++ b/homeassistant/components/aurora/config_flow.py @@ -64,7 +64,7 @@ class AuroraConfigFlow(ConfigFlow, domain=DOMAIN): await api.get_forecast_data(longitude, latitude) except ClientError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/auth/__init__.py b/homeassistant/components/auth/__init__.py index b631c61a18d..fadc1c5e553 100644 --- a/homeassistant/components/auth/__init__.py +++ b/homeassistant/components/auth/__init__.py @@ -651,7 +651,7 @@ def websocket_delete_all_refresh_tokens( continue try: hass.auth.async_remove_refresh_token(token) - except Exception: # pylint: disable=broad-except + except Exception: getLogger(__name__).exception("Error during refresh token removal") remove_failed = True diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py index fa242ac1557..977008df1f8 100644 --- a/homeassistant/components/automation/__init__.py +++ b/homeassistant/components/automation/__init__.py @@ -747,7 +747,7 @@ class AutomationEntity(BaseAutomationEntity, RestoreEntity): err, ) automation_trace.set_error(err) - except Exception as err: # pylint: disable=broad-except + except Exception as err: self._logger.exception("While executing automation %s", self.entity_id) automation_trace.set_error(err) diff --git a/homeassistant/components/azure_event_hub/config_flow.py b/homeassistant/components/azure_event_hub/config_flow.py index c088b35a002..264daa683bc 100644 --- a/homeassistant/components/azure_event_hub/config_flow.py +++ b/homeassistant/components/azure_event_hub/config_flow.py @@ -73,7 +73,7 @@ async def validate_data(data: dict[str, Any]) -> dict[str, str] | None: await client.test_connection() except EventHubError: return {"base": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error") return {"base": "unknown"} return None diff --git a/homeassistant/components/backup/websocket.py b/homeassistant/components/backup/websocket.py index 08d6fda3663..8deba33c8ba 100644 --- a/homeassistant/components/backup/websocket.py +++ b/homeassistant/components/backup/websocket.py @@ -92,7 +92,7 @@ async def handle_backup_start( try: await manager.pre_backup_actions() - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 connection.send_error(msg["id"], "pre_backup_actions_failed", str(err)) return @@ -114,7 +114,7 @@ async def handle_backup_end( try: await manager.post_backup_actions() - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 connection.send_error(msg["id"], "post_backup_actions_failed", str(err)) return diff --git a/homeassistant/components/baf/config_flow.py b/homeassistant/components/baf/config_flow.py index d0a3a82b396..0d56699e1ce 100644 --- a/homeassistant/components/baf/config_flow.py +++ b/homeassistant/components/baf/config_flow.py @@ -92,7 +92,7 @@ class BAFFlowHandler(ConfigFlow, domain=DOMAIN): device = await async_try_connect(ip_address) except CannotConnect: errors[CONF_IP_ADDRESS] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Unknown exception during connection test to %s", ip_address ) diff --git a/homeassistant/components/balboa/config_flow.py b/homeassistant/components/balboa/config_flow.py index 2dc98fbcd69..fccfeceb331 100644 --- a/homeassistant/components/balboa/config_flow.py +++ b/homeassistant/components/balboa/config_flow.py @@ -74,7 +74,7 @@ class BalboaSpaClientFlowHandler(ConfigFlow, domain=DOMAIN): info = await validate_input(user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/blink/config_flow.py b/homeassistant/components/blink/config_flow.py index 1531728aa79..62f15bd6e10 100644 --- a/homeassistant/components/blink/config_flow.py +++ b/homeassistant/components/blink/config_flow.py @@ -69,7 +69,7 @@ class BlinkConfigFlow(ConfigFlow, domain=DOMAIN): return await self.async_step_2fa() except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" @@ -96,7 +96,7 @@ class BlinkConfigFlow(ConfigFlow, domain=DOMAIN): ) except BlinkSetupError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/blue_current/config_flow.py b/homeassistant/components/blue_current/config_flow.py index 66070094c29..a3aaf60cc39 100644 --- a/homeassistant/components/blue_current/config_flow.py +++ b/homeassistant/components/blue_current/config_flow.py @@ -48,7 +48,7 @@ class BlueCurrentConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "already_connected" except InvalidApiToken: errors["base"] = "invalid_token" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/bluetooth/active_update_coordinator.py b/homeassistant/components/bluetooth/active_update_coordinator.py index df5701a81a3..2a525b55582 100644 --- a/homeassistant/components/bluetooth/active_update_coordinator.py +++ b/homeassistant/components/bluetooth/active_update_coordinator.py @@ -136,7 +136,7 @@ class ActiveBluetoothDataUpdateCoordinator( ) self.last_poll_successful = False return - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 if self.last_poll_successful: self.logger.exception("%s: Failure while polling", self.address) self.last_poll_successful = False diff --git a/homeassistant/components/bluetooth/active_update_processor.py b/homeassistant/components/bluetooth/active_update_processor.py index be4f6553738..d0e21691a55 100644 --- a/homeassistant/components/bluetooth/active_update_processor.py +++ b/homeassistant/components/bluetooth/active_update_processor.py @@ -129,7 +129,7 @@ class ActiveBluetoothProcessorCoordinator( ) self.last_poll_successful = False return - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 if self.last_poll_successful: self.logger.exception("%s: Failure while polling", self.address) self.last_poll_successful = False diff --git a/homeassistant/components/bluetooth/manager.py b/homeassistant/components/bluetooth/manager.py index 789991cce9c..9355fca6cdc 100644 --- a/homeassistant/components/bluetooth/manager.py +++ b/homeassistant/components/bluetooth/manager.py @@ -107,7 +107,7 @@ class HomeAssistantBluetoothManager(BluetoothManager): callback = match[CALLBACK] try: callback(service_info, BluetoothChange.ADVERTISEMENT) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error in bluetooth callback") for domain in matched_domains: @@ -182,7 +182,7 @@ class HomeAssistantBluetoothManager(BluetoothManager): if ble_device_matches(callback_matcher, service_info): try: callback(service_info, BluetoothChange.ADVERTISEMENT) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error in bluetooth callback") return _async_remove_callback diff --git a/homeassistant/components/bluetooth/passive_update_processor.py b/homeassistant/components/bluetooth/passive_update_processor.py index c13c93bdb37..e7a902f4db0 100644 --- a/homeassistant/components/bluetooth/passive_update_processor.py +++ b/homeassistant/components/bluetooth/passive_update_processor.py @@ -373,7 +373,7 @@ class PassiveBluetoothProcessorCoordinator( try: update = self._update_method(service_info) - except Exception: # pylint: disable=broad-except + except Exception: self.last_update_success = False self.logger.exception("Unexpected error updating %s data", self.name) return @@ -583,7 +583,7 @@ class PassiveBluetoothDataProcessor(Generic[_T]): """Handle a Bluetooth event.""" try: new_data = self.update_method(update) - except Exception: # pylint: disable=broad-except + except Exception: self.last_update_success = False self.coordinator.logger.exception( "Unexpected error updating %s data", self.coordinator.name diff --git a/homeassistant/components/bosch_shc/config_flow.py b/homeassistant/components/bosch_shc/config_flow.py index 5483c080f39..6279f3ca932 100644 --- a/homeassistant/components/bosch_shc/config_flow.py +++ b/homeassistant/components/bosch_shc/config_flow.py @@ -124,7 +124,7 @@ class BoschSHCConfigFlow(ConfigFlow, domain=DOMAIN): self.info = await self._get_info(self.host) except SHCConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -161,7 +161,7 @@ class BoschSHCConfigFlow(ConfigFlow, domain=DOMAIN): except SHCRegistrationError as err: _LOGGER.warning("Registration error: %s", err.message) errors["base"] = "pairing_failed" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/bring/config_flow.py b/homeassistant/components/bring/config_flow.py index 1fbddeb7bfe..1f730abb432 100644 --- a/homeassistant/components/bring/config_flow.py +++ b/homeassistant/components/bring/config_flow.py @@ -59,7 +59,7 @@ class BringConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except BringAuthException: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/brunt/config_flow.py b/homeassistant/components/brunt/config_flow.py index 65886c3081c..ecb2dd41d6f 100644 --- a/homeassistant/components/brunt/config_flow.py +++ b/homeassistant/components/brunt/config_flow.py @@ -43,7 +43,7 @@ async def validate_input(user_input: dict[str, Any]) -> dict[str, str] | None: except ServerDisconnectedError: _LOGGER.warning("Cannot connect to Brunt") errors = {"base": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error when trying to login to Brunt") errors = {"base": "unknown"} finally: diff --git a/homeassistant/components/caldav/config_flow.py b/homeassistant/components/caldav/config_flow.py index 3710f7f1b4b..9e1d1098f45 100644 --- a/homeassistant/components/caldav/config_flow.py +++ b/homeassistant/components/caldav/config_flow.py @@ -82,7 +82,7 @@ class CalDavConfigFlow(ConfigFlow, domain=DOMAIN): except DAVError as err: _LOGGER.warning("CalDAV client error: %s", err) return "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return "unknown" return None diff --git a/homeassistant/components/camera/img_util.py b/homeassistant/components/camera/img_util.py index b9b607d5edf..8ce8d51c812 100644 --- a/homeassistant/components/camera/img_util.py +++ b/homeassistant/components/camera/img_util.py @@ -6,7 +6,7 @@ from contextlib import suppress import logging from typing import TYPE_CHECKING, Literal, cast -with suppress(Exception): # pylint: disable=broad-except +with suppress(Exception): # TurboJPEG imports numpy which may or may not work so # we have to guard the import here. We still want # to import it at top level so it gets loaded @@ -98,7 +98,7 @@ class TurboJPEGSingleton: """Try to create TurboJPEG only once.""" try: TurboJPEGSingleton.__instance = TurboJPEG() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error loading libturbojpeg; Camera snapshot performance will be sub-optimal" ) diff --git a/homeassistant/components/canary/config_flow.py b/homeassistant/components/canary/config_flow.py index f586a7e4e85..6ae7632a7e2 100644 --- a/homeassistant/components/canary/config_flow.py +++ b/homeassistant/components/canary/config_flow.py @@ -82,7 +82,7 @@ class CanaryConfigFlow(ConfigFlow, domain=DOMAIN): ) except (ConnectTimeout, HTTPError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") else: diff --git a/homeassistant/components/ccm15/config_flow.py b/homeassistant/components/ccm15/config_flow.py index f115aa8f6e1..0e49e0929e5 100644 --- a/homeassistant/components/ccm15/config_flow.py +++ b/homeassistant/components/ccm15/config_flow.py @@ -42,7 +42,7 @@ class CCM15ConfigFlow(ConfigFlow, domain=DOMAIN): try: if not await ccm15.async_test_connection(): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/cloud/http_api.py b/homeassistant/components/cloud/http_api.py index 29185191a20..2d8974ad6a3 100644 --- a/homeassistant/components/cloud/http_api.py +++ b/homeassistant/components/cloud/http_api.py @@ -136,7 +136,7 @@ def _handle_cloud_errors( """Handle exceptions that raise from the wrapped request handler.""" try: result = await handler(view, request, *args, **kwargs) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 status, msg = _process_cloud_exception(err, request.path) return view.json_message( msg, status_code=status, message_code=err.__class__.__name__.lower() @@ -167,7 +167,7 @@ def _ws_handle_cloud_errors( try: return await handler(hass, connection, msg) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 err_status, err_msg = _process_cloud_exception(err, msg["type"]) connection.send_error(msg["id"], str(err_status), err_msg) diff --git a/homeassistant/components/cloudflare/config_flow.py b/homeassistant/components/cloudflare/config_flow.py index f4becf12067..704e4c0fd47 100644 --- a/homeassistant/components/cloudflare/config_flow.py +++ b/homeassistant/components/cloudflare/config_flow.py @@ -194,7 +194,7 @@ class CloudflareConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except pycfdns.AuthenticationException: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/coinbase/config_flow.py b/homeassistant/components/coinbase/config_flow.py index 71ebcec65ee..623d5cf6731 100644 --- a/homeassistant/components/coinbase/config_flow.py +++ b/homeassistant/components/coinbase/config_flow.py @@ -130,7 +130,7 @@ class CoinbaseConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth_secret" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -188,7 +188,7 @@ class OptionsFlowHandler(OptionsFlow): errors["base"] = "currency_unavailable" except ExchangeRateUnavailable: errors["base"] = "exchange_rate_unavailable" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/comelit/config_flow.py b/homeassistant/components/comelit/config_flow.py index 53d08e0097c..4cd8b749031 100644 --- a/homeassistant/components/comelit/config_flow.py +++ b/homeassistant/components/comelit/config_flow.py @@ -92,7 +92,7 @@ class ComelitConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -138,7 +138,7 @@ class ComelitConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/control4/config_flow.py b/homeassistant/components/control4/config_flow.py index 4ecc1ebe3f5..f6d746c9cb4 100644 --- a/homeassistant/components/control4/config_flow.py +++ b/homeassistant/components/control4/config_flow.py @@ -112,7 +112,7 @@ class Control4ConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/daikin/__init__.py b/homeassistant/components/daikin/__init__.py index 6f1196c7721..85e5cada048 100644 --- a/homeassistant/components/daikin/__init__.py +++ b/homeassistant/components/daikin/__init__.py @@ -93,7 +93,7 @@ async def daikin_api_setup( except ClientConnectionError as err: _LOGGER.debug("ClientConnectionError to %s", host) raise ConfigEntryNotReady from err - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.error("Unexpected error creating device %s", host) return None diff --git a/homeassistant/components/daikin/config_flow.py b/homeassistant/components/daikin/config_flow.py index 2acbe42264d..f8c0181d93b 100644 --- a/homeassistant/components/daikin/config_flow.py +++ b/homeassistant/components/daikin/config_flow.py @@ -109,7 +109,7 @@ class FlowHandler(ConfigFlow, domain=DOMAIN): data_schema=self.schema, errors={"base": "unknown"}, ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error creating device") return self.async_show_form( step_id="user", diff --git a/homeassistant/components/deluge/__init__.py b/homeassistant/components/deluge/__init__.py index 6a313db2669..d2f36bbc28b 100644 --- a/homeassistant/components/deluge/__init__.py +++ b/homeassistant/components/deluge/__init__.py @@ -42,7 +42,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await hass.async_add_executor_job(api.connect) except (ConnectionRefusedError, TimeoutError, SSLError) as ex: raise ConfigEntryNotReady("Connection to Deluge Daemon failed") from ex - except Exception as ex: # pylint:disable=broad-except + except Exception as ex: # noqa: BLE001 if type(ex).__name__ == "BadLoginError": raise ConfigEntryAuthFailed( "Credentials for Deluge client are not valid" diff --git a/homeassistant/components/deluge/config_flow.py b/homeassistant/components/deluge/config_flow.py index 8ebf56ceb5b..0a04a17a991 100644 --- a/homeassistant/components/deluge/config_flow.py +++ b/homeassistant/components/deluge/config_flow.py @@ -94,7 +94,7 @@ class DelugeFlowHandler(ConfigFlow, domain=DOMAIN): await self.hass.async_add_executor_job(api.connect) except (ConnectionRefusedError, TimeoutError, SSLError): return "cannot_connect" - except Exception as ex: # pylint:disable=broad-except + except Exception as ex: # noqa: BLE001 if type(ex).__name__ == "BadLoginError": return "invalid_auth" return "unknown" diff --git a/homeassistant/components/device_tracker/legacy.py b/homeassistant/components/device_tracker/legacy.py index dfeed98f320..ac168c06fb1 100644 --- a/homeassistant/components/device_tracker/legacy.py +++ b/homeassistant/components/device_tracker/legacy.py @@ -365,7 +365,7 @@ class DeviceTrackerPlatform: hass.config.components.add(full_name) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception( "Error setting up platform %s %s", self.type, self.name ) diff --git a/homeassistant/components/devolo_home_network/config_flow.py b/homeassistant/components/devolo_home_network/config_flow.py index 5a27383f9fa..c060a0173f8 100644 --- a/homeassistant/components/devolo_home_network/config_flow.py +++ b/homeassistant/components/devolo_home_network/config_flow.py @@ -63,7 +63,7 @@ class DevoloHomeNetworkConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except DeviceNotFound: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/dexcom/config_flow.py b/homeassistant/components/dexcom/config_flow.py index 48cdcd99439..19b35c2b03d 100644 --- a/homeassistant/components/dexcom/config_flow.py +++ b/homeassistant/components/dexcom/config_flow.py @@ -40,7 +40,7 @@ class DexcomConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except AccountError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" if "base" not in errors: diff --git a/homeassistant/components/directv/config_flow.py b/homeassistant/components/directv/config_flow.py index f1289119f2b..7cdfd5c07c9 100644 --- a/homeassistant/components/directv/config_flow.py +++ b/homeassistant/components/directv/config_flow.py @@ -55,7 +55,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except DIRECTVError: return self._show_setup_form({"base": ERROR_CANNOT_CONNECT}) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason=ERROR_UNKNOWN) @@ -88,7 +88,7 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, self.discovery_info) except DIRECTVError: return self.async_abort(reason=ERROR_CANNOT_CONNECT) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason=ERROR_UNKNOWN) diff --git a/homeassistant/components/discord/config_flow.py b/homeassistant/components/discord/config_flow.py index a25a86cab3a..f86c597fb57 100644 --- a/homeassistant/components/discord/config_flow.py +++ b/homeassistant/components/discord/config_flow.py @@ -89,7 +89,7 @@ async def _async_try_connect(token: str) -> tuple[str | None, nextcord.AppInfo | return "invalid_auth", None except (ClientConnectorError, nextcord.HTTPException, nextcord.NotFound): return "cannot_connect", None - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return "unknown", None await discord_bot.close() diff --git a/homeassistant/components/discovergy/config_flow.py b/homeassistant/components/discovergy/config_flow.py index e47935764a8..5e17f0764b7 100644 --- a/homeassistant/components/discovergy/config_flow.py +++ b/homeassistant/components/discovergy/config_flow.py @@ -91,7 +91,7 @@ class DiscovergyConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except discovergyError.InvalidLogin: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error occurred while getting meters") errors["base"] = "unknown" else: diff --git a/homeassistant/components/dlink/config_flow.py b/homeassistant/components/dlink/config_flow.py index 4613aeb9cef..4452a2958fc 100644 --- a/homeassistant/components/dlink/config_flow.py +++ b/homeassistant/components/dlink/config_flow.py @@ -121,7 +121,7 @@ class DLinkFlowHandler(ConfigFlow, domain=DOMAIN): user_input[CONF_USERNAME], user_input[CONF_USE_LEGACY_PROTOCOL], ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return "unknown" if not smartplug.authenticated and smartplug.use_legacy_protocol: diff --git a/homeassistant/components/doorbird/config_flow.py b/homeassistant/components/doorbird/config_flow.py index 8bb069bab88..b59c03ac565 100644 --- a/homeassistant/components/doorbird/config_flow.py +++ b/homeassistant/components/doorbird/config_flow.py @@ -148,7 +148,7 @@ class DoorBirdConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return info, errors diff --git a/homeassistant/components/dormakaba_dkey/config_flow.py b/homeassistant/components/dormakaba_dkey/config_flow.py index d4cd19644c1..5f90e7e663a 100644 --- a/homeassistant/components/dormakaba_dkey/config_flow.py +++ b/homeassistant/components/dormakaba_dkey/config_flow.py @@ -175,7 +175,7 @@ class DormkabaConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_code" except dkey_errors.WrongActivationCode: errors["base"] = "wrong_code" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") else: diff --git a/homeassistant/components/dremel_3d_printer/config_flow.py b/homeassistant/components/dremel_3d_printer/config_flow.py index aa4cdb045e7..913180db0f7 100644 --- a/homeassistant/components/dremel_3d_printer/config_flow.py +++ b/homeassistant/components/dremel_3d_printer/config_flow.py @@ -42,7 +42,7 @@ class Dremel3DPrinterConfigFlow(ConfigFlow, domain=DOMAIN): api = await self.hass.async_add_executor_job(Dremel3DPrinter, host) except (ConnectTimeout, HTTPError, JSONDecodeError): errors = {"base": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("An unknown error has occurred") errors = {"base": "unknown"} diff --git a/homeassistant/components/duotecno/config_flow.py b/homeassistant/components/duotecno/config_flow.py index 44675d6bbde..ca95726542f 100644 --- a/homeassistant/components/duotecno/config_flow.py +++ b/homeassistant/components/duotecno/config_flow.py @@ -51,7 +51,7 @@ class DuoTecnoConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidPassword: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/ecoforest/config_flow.py b/homeassistant/components/ecoforest/config_flow.py index 91260f0811e..9c0f15f390b 100644 --- a/homeassistant/components/ecoforest/config_flow.py +++ b/homeassistant/components/ecoforest/config_flow.py @@ -46,7 +46,7 @@ class EcoForestConfigFlow(ConfigFlow, domain=DOMAIN): device = await api.get() except EcoforestAuthenticationRequired: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "cannot_connect" else: diff --git a/homeassistant/components/ecovacs/config_flow.py b/homeassistant/components/ecovacs/config_flow.py index 4a421113f5f..7e4bfbe5597 100644 --- a/homeassistant/components/ecovacs/config_flow.py +++ b/homeassistant/components/ecovacs/config_flow.py @@ -93,7 +93,7 @@ async def _validate_input( errors["base"] = "cannot_connect" except InvalidAuthenticationError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception during login") errors["base"] = "unknown" @@ -121,7 +121,7 @@ async def _validate_input( errors[cannot_connect_field] = "cannot_connect" except InvalidAuthenticationError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception during mqtt connection verification") errors["base"] = "unknown" diff --git a/homeassistant/components/efergy/config_flow.py b/homeassistant/components/efergy/config_flow.py index 8e23925d193..1eddb1074f2 100644 --- a/homeassistant/components/efergy/config_flow.py +++ b/homeassistant/components/efergy/config_flow.py @@ -68,7 +68,7 @@ class EfergyFlowHandler(ConfigFlow, domain=DOMAIN): return None, "cannot_connect" except exceptions.InvalidAuth: return None, "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") return None, "unknown" return api.info["hid"], None diff --git a/homeassistant/components/elkm1/config_flow.py b/homeassistant/components/elkm1/config_flow.py index 9a71c86478b..972b38d2ae9 100644 --- a/homeassistant/components/elkm1/config_flow.py +++ b/homeassistant/components/elkm1/config_flow.py @@ -248,7 +248,7 @@ class Elkm1ConfigFlow(ConfigFlow, domain=DOMAIN): return {"base": "cannot_connect"}, None except InvalidAuth: return {CONF_PASSWORD: "invalid_auth"}, None - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return {"base": "unknown"}, None diff --git a/homeassistant/components/elmax/config_flow.py b/homeassistant/components/elmax/config_flow.py index 666f4e75fcd..2971a425663 100644 --- a/homeassistant/components/elmax/config_flow.py +++ b/homeassistant/components/elmax/config_flow.py @@ -370,7 +370,7 @@ class ElmaxConfigFlow(ConfigFlow, domain=DOMAIN): ) except ElmaxBadPinError: errors["base"] = "invalid_pin" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error occurred") errors["base"] = "unknown" diff --git a/homeassistant/components/emonitor/config_flow.py b/homeassistant/components/emonitor/config_flow.py index 70bd58e4cc0..9909ddff19c 100644 --- a/homeassistant/components/emonitor/config_flow.py +++ b/homeassistant/components/emonitor/config_flow.py @@ -46,7 +46,7 @@ class EmonitorConfigFlow(ConfigFlow, domain=DOMAIN): info = await fetch_mac_and_title(self.hass, user_input[CONF_HOST]) except aiohttp.ClientError: errors[CONF_HOST] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -77,7 +77,7 @@ class EmonitorConfigFlow(ConfigFlow, domain=DOMAIN): self.discovered_info = await fetch_mac_and_title( self.hass, self.discovered_ip ) - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 _LOGGER.debug( "Unable to fetch status, falling back to manual entry", exc_info=ex ) diff --git a/homeassistant/components/enigma2/config_flow.py b/homeassistant/components/enigma2/config_flow.py index ac57bd9d0fa..b628d10b91a 100644 --- a/homeassistant/components/enigma2/config_flow.py +++ b/homeassistant/components/enigma2/config_flow.py @@ -95,7 +95,7 @@ class Enigma2ConfigFlowHandler(ConfigFlow, domain=DOMAIN): errors = {"base": "invalid_auth"} except ClientError: errors = {"base": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors = {"base": "unknown"} else: await self.async_set_unique_id(about["info"]["ifaces"][0]["mac"]) diff --git a/homeassistant/components/enphase_envoy/config_flow.py b/homeassistant/components/enphase_envoy/config_flow.py index 5f859d16142..6c9f6b35554 100644 --- a/homeassistant/components/enphase_envoy/config_flow.py +++ b/homeassistant/components/enphase_envoy/config_flow.py @@ -169,7 +169,7 @@ class EnphaseConfigFlow(ConfigFlow, domain=DOMAIN): except EnvoyError as e: errors["base"] = "cannot_connect" description_placeholders = {"reason": str(e)} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/environment_canada/config_flow.py b/homeassistant/components/environment_canada/config_flow.py index 369a419f2a6..a351bb0ef06 100644 --- a/homeassistant/components/environment_canada/config_flow.py +++ b/homeassistant/components/environment_canada/config_flow.py @@ -61,7 +61,7 @@ class EnvironmentCanadaConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "bad_station_id" else: errors["base"] = "error_response" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/epic_games_store/config_flow.py b/homeassistant/components/epic_games_store/config_flow.py index 2ae86060ba2..9e65c93c334 100644 --- a/homeassistant/components/epic_games_store/config_flow.py +++ b/homeassistant/components/epic_games_store/config_flow.py @@ -82,7 +82,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): try: await validate_input(self.hass, user_input) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/epic_games_store/helper.py b/homeassistant/components/epic_games_store/helper.py index 2510c7699e5..6cd55eaaf22 100644 --- a/homeassistant/components/epic_games_store/helper.py +++ b/homeassistant/components/epic_games_store/helper.py @@ -60,7 +60,7 @@ def get_game_url(raw_game_data: dict[str, Any], language: str) -> str: url_slug: str | None = None try: url_slug = raw_game_data["offerMappings"][0]["pageSlug"] - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 with contextlib.suppress(Exception): url_slug = raw_game_data["catalogNs"]["mappings"][0]["pageSlug"] diff --git a/homeassistant/components/esphome/entry_data.py b/homeassistant/components/esphome/entry_data.py index 41b18c9b88c..19e5267e8bc 100644 --- a/homeassistant/components/esphome/entry_data.py +++ b/homeassistant/components/esphome/entry_data.py @@ -374,7 +374,7 @@ class RuntimeEntryData: if subscription := self.state_subscriptions.get(subscription_key): try: subscription() - except Exception: # pylint: disable=broad-except + except Exception: # If we allow this exception to raise it will # make it all the way to data_received in aioesphomeapi # which will cause the connection to be closed. diff --git a/homeassistant/components/evil_genius_labs/config_flow.py b/homeassistant/components/evil_genius_labs/config_flow.py index 283b3d36beb..67bbd7faf54 100644 --- a/homeassistant/components/evil_genius_labs/config_flow.py +++ b/homeassistant/components/evil_genius_labs/config_flow.py @@ -67,7 +67,7 @@ class EvilGeniusLabsConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "timeout" except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/ezviz/config_flow.py b/homeassistant/components/ezviz/config_flow.py index a17d8312700..2b47b120cf8 100644 --- a/homeassistant/components/ezviz/config_flow.py +++ b/homeassistant/components/ezviz/config_flow.py @@ -189,7 +189,7 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN): except PyEzvizError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") @@ -242,7 +242,7 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN): except PyEzvizError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") @@ -297,7 +297,7 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN): except (PyEzvizError, AuthTestResultFailed): errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") @@ -358,7 +358,7 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN): except (PyEzvizError, AuthTestResultFailed): errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/faa_delays/config_flow.py b/homeassistant/components/faa_delays/config_flow.py index 935831c467d..c5b90812f2d 100644 --- a/homeassistant/components/faa_delays/config_flow.py +++ b/homeassistant/components/faa_delays/config_flow.py @@ -43,7 +43,7 @@ class FAADelaysConfigFlow(ConfigFlow, domain=DOMAIN): _LOGGER.error("Error connecting to FAA API") errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/fivem/config_flow.py b/homeassistant/components/fivem/config_flow.py index 7cc553a6a72..b5ced70b846 100644 --- a/homeassistant/components/fivem/config_flow.py +++ b/homeassistant/components/fivem/config_flow.py @@ -59,7 +59,7 @@ class FiveMConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidGameNameError: errors["base"] = "invalid_game_name" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/flexit_bacnet/config_flow.py b/homeassistant/components/flexit_bacnet/config_flow.py index 087f70869bb..db1918d3f13 100644 --- a/homeassistant/components/flexit_bacnet/config_flow.py +++ b/homeassistant/components/flexit_bacnet/config_flow.py @@ -46,7 +46,7 @@ class FlexitBacnetConfigFlow(ConfigFlow, domain=DOMAIN): await device.update() except (asyncio.exceptions.TimeoutError, ConnectionError, DecodingError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/flick_electric/config_flow.py b/homeassistant/components/flick_electric/config_flow.py index 41b58431977..7fe5fda3f4e 100644 --- a/homeassistant/components/flick_electric/config_flow.py +++ b/homeassistant/components/flick_electric/config_flow.py @@ -65,7 +65,7 @@ class FlickConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/flipr/config_flow.py b/homeassistant/components/flipr/config_flow.py index 0b0230f536e..3d616feb37f 100644 --- a/homeassistant/components/flipr/config_flow.py +++ b/homeassistant/components/flipr/config_flow.py @@ -44,7 +44,7 @@ class FliprConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except (Timeout, ConnectionError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: errors["base"] = "unknown" _LOGGER.exception("Unexpected exception") diff --git a/homeassistant/components/fortios/device_tracker.py b/homeassistant/components/fortios/device_tracker.py index 3169e9a842f..7cc5bab7d16 100644 --- a/homeassistant/components/fortios/device_tracker.py +++ b/homeassistant/components/fortios/device_tracker.py @@ -48,7 +48,7 @@ def get_scanner(hass: HomeAssistant, config: ConfigType) -> FortiOSDeviceScanner except ConnectionError as ex: _LOGGER.error("ConnectionError to FortiOS API: %s", ex) return None - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 _LOGGER.error("Failed to login to FortiOS API: %s", ex) return None diff --git a/homeassistant/components/foscam/config_flow.py b/homeassistant/components/foscam/config_flow.py index ab9bc32c6b0..8a005f19f09 100644 --- a/homeassistant/components/foscam/config_flow.py +++ b/homeassistant/components/foscam/config_flow.py @@ -110,7 +110,7 @@ class FoscamConfigFlow(ConfigFlow, domain=DOMAIN): except AbortFlow: raise - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/freebox/config_flow.py b/homeassistant/components/freebox/config_flow.py index b790556b8e3..88e2165defd 100644 --- a/homeassistant/components/freebox/config_flow.py +++ b/homeassistant/components/freebox/config_flow.py @@ -89,7 +89,7 @@ class FreeboxFlowHandler(ConfigFlow, domain=DOMAIN): ) errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Unknown error connecting with Freebox router at %s", self._data[CONF_HOST], diff --git a/homeassistant/components/fritz/common.py b/homeassistant/components/fritz/common.py index ec893e99ab1..f71639c7e09 100644 --- a/homeassistant/components/fritz/common.py +++ b/homeassistant/components/fritz/common.py @@ -441,7 +441,7 @@ class FritzBoxTools( hosts_info = await self.hass.async_add_executor_job( self.fritz_hosts.get_hosts_info ) - except Exception as ex: # pylint: disable=[broad-except] + except Exception as ex: # noqa: BLE001 if not self.hass.is_stopping: raise HomeAssistantError( translation_domain=DOMAIN, diff --git a/homeassistant/components/fritz/config_flow.py b/homeassistant/components/fritz/config_flow.py index fdafd486b29..4cdd4c19c1b 100644 --- a/homeassistant/components/fritz/config_flow.py +++ b/homeassistant/components/fritz/config_flow.py @@ -91,7 +91,7 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN): return ERROR_AUTH_INVALID except FritzConnectionException: return ERROR_CANNOT_CONNECT - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return ERROR_UNKNOWN diff --git a/homeassistant/components/fronius/config_flow.py b/homeassistant/components/fronius/config_flow.py index 2b46d226b7a..cd0078230a3 100644 --- a/homeassistant/components/fronius/config_flow.py +++ b/homeassistant/components/fronius/config_flow.py @@ -97,7 +97,7 @@ class FroniusConfigFlow(ConfigFlow, domain=DOMAIN): unique_id, info = await validate_host(self.hass, user_input[CONF_HOST]) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/frontier_silicon/config_flow.py b/homeassistant/components/frontier_silicon/config_flow.py index cf775b15138..103323ff575 100644 --- a/homeassistant/components/frontier_silicon/config_flow.py +++ b/homeassistant/components/frontier_silicon/config_flow.py @@ -74,7 +74,7 @@ class FrontierSiliconConfigFlow(ConfigFlow, domain=DOMAIN): self._webfsapi_url = await AFSAPI.get_webfsapi_endpoint(device_url) except FSConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -108,7 +108,7 @@ class FrontierSiliconConfigFlow(ConfigFlow, domain=DOMAIN): self._webfsapi_url = await AFSAPI.get_webfsapi_endpoint(device_url) except FSConnectionError: return self.async_abort(reason="cannot_connect") - except Exception as exception: # pylint: disable=broad-except + except Exception as exception: # noqa: BLE001 _LOGGER.debug(exception) return self.async_abort(reason="unknown") @@ -206,7 +206,7 @@ class FrontierSiliconConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidPinException: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/fully_kiosk/config_flow.py b/homeassistant/components/fully_kiosk/config_flow.py index 8fd0d4ee4cc..98cf96f637e 100644 --- a/homeassistant/components/fully_kiosk/config_flow.py +++ b/homeassistant/components/fully_kiosk/config_flow.py @@ -64,7 +64,7 @@ class FullyKioskConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" description_placeholders["error_detail"] = str(error.args) return None - except Exception as error: # pylint: disable=broad-except + except Exception as error: # noqa: BLE001 LOGGER.exception("Unexpected exception: %s", error) errors["base"] = "unknown" description_placeholders["error_detail"] = str(error.args) diff --git a/homeassistant/components/fyta/config_flow.py b/homeassistant/components/fyta/config_flow.py index 3d83c099ac3..c09aac1b966 100644 --- a/homeassistant/components/fyta/config_flow.py +++ b/homeassistant/components/fyta/config_flow.py @@ -50,7 +50,7 @@ class FytaConfigFlow(ConfigFlow, domain=DOMAIN): return {"base": "invalid_auth"} except FytaPasswordError: return {"base": "invalid_auth", CONF_PASSWORD: "password_error"} - except Exception as e: # pylint: disable=broad-except + except Exception as e: # noqa: BLE001 _LOGGER.error(e) return {"base": "unknown"} finally: diff --git a/homeassistant/components/garages_amsterdam/config_flow.py b/homeassistant/components/garages_amsterdam/config_flow.py index 6623ad5bd18..0f4f277ed61 100644 --- a/homeassistant/components/garages_amsterdam/config_flow.py +++ b/homeassistant/components/garages_amsterdam/config_flow.py @@ -36,7 +36,7 @@ class GaragesAmsterdamConfigFlow(ConfigFlow, domain=DOMAIN): except ClientResponseError: _LOGGER.error("Unexpected response from server") return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/goalzero/config_flow.py b/homeassistant/components/goalzero/config_flow.py index c276db135fa..eb38e8fa154 100644 --- a/homeassistant/components/goalzero/config_flow.py +++ b/homeassistant/components/goalzero/config_flow.py @@ -111,7 +111,7 @@ class GoalZeroFlowHandler(ConfigFlow, domain=DOMAIN): return None, "cannot_connect" except exceptions.InvalidHost: return None, "invalid_host" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return None, "unknown" return str(api.sysdata["macAddress"]), None diff --git a/homeassistant/components/gogogate2/config_flow.py b/homeassistant/components/gogogate2/config_flow.py index 96ab97f5ba5..cd9ca21b063 100644 --- a/homeassistant/components/gogogate2/config_flow.py +++ b/homeassistant/components/gogogate2/config_flow.py @@ -111,7 +111,7 @@ class Gogogate2FlowHandler(ConfigFlow, domain=DOMAIN): else: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "cannot_connect" if self._ip_address and self._device_type: diff --git a/homeassistant/components/google_assistant/smart_home.py b/homeassistant/components/google_assistant/smart_home.py index a03d7c397cc..e362d1121c2 100644 --- a/homeassistant/components/google_assistant/smart_home.py +++ b/homeassistant/components/google_assistant/smart_home.py @@ -90,7 +90,7 @@ async def _process(hass, data, message): result = await handler(hass, data, inputs[0].get("payload")) except SmartHomeError as err: return {"requestId": data.request_id, "payload": {"errorCode": err.code}} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error") return { "requestId": data.request_id, @@ -115,7 +115,7 @@ async def async_devices_sync_response(hass, config, agent_user_id): try: devices.append(entity.sync_serialize(agent_user_id, instance_uuid)) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error serializing %s", entity.entity_id) return devices @@ -179,7 +179,7 @@ async def async_devices_query_response(hass, config, payload_devices): entity = GoogleEntity(hass, config, state) try: devices[devid] = entity.query_serialize() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error serializing query for %s", state) devices[devid] = {"online": False} diff --git a/homeassistant/components/google_cloud/tts.py b/homeassistant/components/google_cloud/tts.py index cd5c53b5fd7..c5eeaa7d924 100644 --- a/homeassistant/components/google_cloud/tts.py +++ b/homeassistant/components/google_cloud/tts.py @@ -295,7 +295,7 @@ class GoogleCloudTTSProvider(Provider): except TimeoutError as ex: _LOGGER.error("Timeout for Google Cloud TTS call: %s", ex) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error occurred during Google Cloud TTS call") return None, None diff --git a/homeassistant/components/google_generative_ai_conversation/config_flow.py b/homeassistant/components/google_generative_ai_conversation/config_flow.py index dde82db91cc..ab1c976273f 100644 --- a/homeassistant/components/google_generative_ai_conversation/config_flow.py +++ b/homeassistant/components/google_generative_ai_conversation/config_flow.py @@ -94,7 +94,7 @@ class GoogleGenerativeAIConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" else: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/google_tasks/config_flow.py b/homeassistant/components/google_tasks/config_flow.py index a9ef5c7ff23..965c215ee4d 100644 --- a/homeassistant/components/google_tasks/config_flow.py +++ b/homeassistant/components/google_tasks/config_flow.py @@ -66,7 +66,7 @@ class OAuth2FlowHandler( reason="access_not_configured", description_placeholders={"message": error}, ) - except Exception: # pylint: disable=broad-except + except Exception: self.logger.exception("Unknown error occurred") return self.async_abort(reason="unknown") user_id = user_resource_info["id"] diff --git a/homeassistant/components/graphite/__init__.py b/homeassistant/components/graphite/__init__.py index 17dd140aef7..b0672e1f853 100644 --- a/homeassistant/components/graphite/__init__.py +++ b/homeassistant/components/graphite/__init__.py @@ -177,7 +177,7 @@ class GraphiteFeeder(threading.Thread): self._report_attributes( event.data["entity_id"], event.data["new_state"] ) - except Exception: # pylint: disable=broad-except + except Exception: # Catch this so we can avoid the thread dying and # make it visible. _LOGGER.exception("Failed to process STATE_CHANGED event") diff --git a/homeassistant/components/habitica/config_flow.py b/homeassistant/components/habitica/config_flow.py index 9a8852b731d..4c733bcf1d5 100644 --- a/homeassistant/components/habitica/config_flow.py +++ b/homeassistant/components/habitica/config_flow.py @@ -64,7 +64,7 @@ class HabiticaConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except InvalidAuth: errors = {"base": "invalid_credentials"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors = {"base": "unknown"} else: diff --git a/homeassistant/components/harmony/config_flow.py b/homeassistant/components/harmony/config_flow.py index b579e7659f4..629c54a3571 100644 --- a/homeassistant/components/harmony/config_flow.py +++ b/homeassistant/components/harmony/config_flow.py @@ -76,7 +76,7 @@ class HarmonyConfigFlow(ConfigFlow, domain=DOMAIN): validated = await validate_input(user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/hko/config_flow.py b/homeassistant/components/hko/config_flow.py index aeee7d4aff8..8548bb4767d 100644 --- a/homeassistant/components/hko/config_flow.py +++ b/homeassistant/components/hko/config_flow.py @@ -54,7 +54,7 @@ class HKOConfigFlow(ConfigFlow, domain=DOMAIN): except HKOError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" else: await self.async_set_unique_id( diff --git a/homeassistant/components/homeassistant/exposed_entities.py b/homeassistant/components/homeassistant/exposed_entities.py index 4d6d9724ecb..135b2847520 100644 --- a/homeassistant/components/homeassistant/exposed_entities.py +++ b/homeassistant/components/homeassistant/exposed_entities.py @@ -259,7 +259,7 @@ class ExposedEntities: if assistant in registry_entry.options: if "should_expose" in registry_entry.options[assistant]: should_expose = registry_entry.options[assistant]["should_expose"] - return should_expose # noqa: RET504 + return should_expose if self.async_get_expose_new_entities(assistant): should_expose = self._is_default_exposed(entity_id, registry_entry) @@ -286,7 +286,7 @@ class ExposedEntities: ) and assistant in exposed_entity.assistants: if "should_expose" in exposed_entity.assistants[assistant]: should_expose = exposed_entity.assistants[assistant]["should_expose"] - return should_expose # noqa: RET504 + return should_expose if self.async_get_expose_new_entities(assistant): should_expose = self._is_default_exposed(entity_id, None) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index f9f91ec162b..828f8bf94d6 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -740,7 +740,7 @@ class HomeKit: if acc is not None: self.bridge.add_accessory(acc) return acc - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Failed to create a HomeKit accessory for %s", state.entity_id ) diff --git a/homeassistant/components/homekit/type_cameras.py b/homeassistant/components/homekit/type_cameras.py index 4f05bfbd687..b5764520b61 100644 --- a/homeassistant/components/homekit/type_cameras.py +++ b/homeassistant/components/homekit/type_cameras.py @@ -356,7 +356,7 @@ class Camera(HomeAccessory, PyhapCamera): # type: ignore[misc] stream_source = await camera.async_get_stream_source( self.hass, self.entity_id ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Failed to get stream source - this could be a transient error or your" " camera might not be compatible with HomeKit yet" @@ -503,7 +503,7 @@ class Camera(HomeAccessory, PyhapCamera): # type: ignore[misc] _LOGGER.info("[%s] %s stream", session_id, shutdown_method) try: await getattr(stream, shutdown_method)() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "[%s] Failed to %s stream", session_id, shutdown_method ) diff --git a/homeassistant/components/homekit_controller/config_flow.py b/homeassistant/components/homekit_controller/config_flow.py index e48cb069dfe..48aa3fc2bc7 100644 --- a/homeassistant/components/homekit_controller/config_flow.py +++ b/homeassistant/components/homekit_controller/config_flow.py @@ -476,7 +476,7 @@ class HomekitControllerFlowHandler(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="accessory_not_found_error") except InsecureSetupCode: errors["pairing_code"] = "insecure_setup_code" - except Exception as err: # pylint: disable=broad-except + except Exception as err: _LOGGER.exception("Pairing attempt failed with an unhandled exception") self.finish_pairing = None errors["pairing_code"] = "pairing_failed" @@ -508,7 +508,7 @@ class HomekitControllerFlowHandler(ConfigFlow, domain=DOMAIN): # TLV error, usually not in pairing mode _LOGGER.exception("Pairing communication failed") return await self.async_step_protocol_error() - except Exception as err: # pylint: disable=broad-except + except Exception as err: _LOGGER.exception("Pairing attempt failed with an unhandled exception") errors["pairing_code"] = "pairing_failed" description_placeholders["error"] = str(err) diff --git a/homeassistant/components/homematic/entity.py b/homeassistant/components/homematic/entity.py index b728e85f959..ac0a05d24c1 100644 --- a/homeassistant/components/homematic/entity.py +++ b/homeassistant/components/homematic/entity.py @@ -116,7 +116,7 @@ class HMDevice(Entity): # Link events from pyhomematic self._available = not self._hmdevice.UNREACH - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 self._connected = False _LOGGER.error("Exception while linking %s: %s", self._address, str(err)) diff --git a/homeassistant/components/homematicip_cloud/hap.py b/homeassistant/components/homematicip_cloud/hap.py index 7825999900e..2384426dc82 100644 --- a/homeassistant/components/homematicip_cloud/hap.py +++ b/homeassistant/components/homematicip_cloud/hap.py @@ -100,7 +100,7 @@ class HomematicipHAP: ) except HmipcConnectionError as err: raise ConfigEntryNotReady from err - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.error("Error connecting with HomematicIP Cloud: %s", err) return False diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index 7d28d6c187f..b0c40c71658 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -308,7 +308,7 @@ class Router: ResponseErrorNotSupportedException, ): pass # Ok, normal, nothing to do - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.warning("Logout error", exc_info=True) def cleanup(self, *_: Any) -> None: @@ -406,7 +406,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: wlan_settings = await hass.async_add_executor_job( router.client.wlan.multi_basic_settings ) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 # Assume not supported, or authentication required but in unauthenticated mode wlan_settings = {} macs = get_device_macs(router_info or {}, wlan_settings) diff --git a/homeassistant/components/huawei_lte/config_flow.py b/homeassistant/components/huawei_lte/config_flow.py index 84cf88786a9..ce6131c784f 100644 --- a/homeassistant/components/huawei_lte/config_flow.py +++ b/homeassistant/components/huawei_lte/config_flow.py @@ -171,7 +171,7 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN): except Timeout: _LOGGER.warning("Connection timeout", exc_info=True) errors[CONF_URL] = "connection_timeout" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.warning("Unknown error connecting to device", exc_info=True) errors[CONF_URL] = "unknown" return conn @@ -181,7 +181,7 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN): try: conn.close() conn.requests_session.close() - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.debug("Disconnect error", exc_info=True) async def async_step_user( @@ -210,18 +210,18 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN): client = Client(conn) try: device_info = client.device.information() - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.debug("Could not get device.information", exc_info=True) try: device_info = client.device.basic_information() - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.debug( "Could not get device.basic_information", exc_info=True ) device_info = {} try: wlan_settings = client.wlan.multi_basic_settings() - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.debug("Could not get wlan.multi_basic_settings", exc_info=True) wlan_settings = {} return device_info, wlan_settings @@ -291,7 +291,7 @@ class ConfigFlowHandler(ConfigFlow, domain=DOMAIN): basic_info = Client(conn).device.basic_information() except ResponseErrorException: # API compatible error return True - except Exception: # API incompatible error # pylint: disable=broad-except + except Exception: # API incompatible error # noqa: BLE001 return False return isinstance(basic_info, dict) # Crude content check diff --git a/homeassistant/components/hue/bridge.py b/homeassistant/components/hue/bridge.py index f167897d77b..5397eeebd96 100644 --- a/homeassistant/components/hue/bridge.py +++ b/homeassistant/components/hue/bridge.py @@ -94,7 +94,7 @@ class HueBridge: raise ConfigEntryNotReady( f"Error connecting to the Hue bridge at {self.host}" ) from err - except Exception: # pylint: disable=broad-except + except Exception: self.logger.exception("Unknown error connecting to Hue bridge") return False finally: diff --git a/homeassistant/components/hue/config_flow.py b/homeassistant/components/hue/config_flow.py index de2d9363ac7..fb32f568ee1 100644 --- a/homeassistant/components/hue/config_flow.py +++ b/homeassistant/components/hue/config_flow.py @@ -189,7 +189,7 @@ class HueFlowHandler(ConfigFlow, domain=DOMAIN): except CannotConnect: LOGGER.error("Error connecting to the Hue bridge at %s", bridge.host) return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: LOGGER.exception( "Unknown error connecting with Hue bridge at %s", bridge.host ) diff --git a/homeassistant/components/huisbaasje/config_flow.py b/homeassistant/components/huisbaasje/config_flow.py index 3697c1fcb86..d0d2632c386 100644 --- a/homeassistant/components/huisbaasje/config_flow.py +++ b/homeassistant/components/huisbaasje/config_flow.py @@ -40,7 +40,7 @@ class HuisbaasjeConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except AbortFlow: raise - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/hunterdouglas_powerview/config_flow.py b/homeassistant/components/hunterdouglas_powerview/config_flow.py index 7753f4ba94b..88ccf890c66 100644 --- a/homeassistant/components/hunterdouglas_powerview/config_flow.py +++ b/homeassistant/components/hunterdouglas_powerview/config_flow.py @@ -114,7 +114,7 @@ class PowerviewConfigFlow(ConfigFlow, domain=DOMAIN): return None, "cannot_connect" except UnsupportedDevice: return None, "unsupported_device" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return None, "unknown" diff --git a/homeassistant/components/huum/config_flow.py b/homeassistant/components/huum/config_flow.py index 5de94260a4b..6a5fd96b99d 100644 --- a/homeassistant/components/huum/config_flow.py +++ b/homeassistant/components/huum/config_flow.py @@ -47,7 +47,7 @@ class HuumConfigFlow(ConfigFlow, domain=DOMAIN): # Most likely Forbidden as that is what is returned from `.status()` with bad creds _LOGGER.error("Could not log in to Huum with given credentials") errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error") errors["base"] = "unknown" else: diff --git a/homeassistant/components/hvv_departures/sensor.py b/homeassistant/components/hvv_departures/sensor.py index 5998a3dd826..89260b921ea 100644 --- a/homeassistant/components/hvv_departures/sensor.py +++ b/homeassistant/components/hvv_departures/sensor.py @@ -125,7 +125,7 @@ class HVVDepartureSensor(SensorEntity): _LOGGER.warning("Network unavailable: %r", error) self._last_error = ClientConnectorError self._attr_available = False - except Exception as error: # pylint: disable=broad-except + except Exception as error: # noqa: BLE001 if self._last_error != error: _LOGGER.error("Error occurred while fetching data: %r", error) self._last_error = error diff --git a/homeassistant/components/ialarm/config_flow.py b/homeassistant/components/ialarm/config_flow.py index 6aef66922b4..08cb9868357 100644 --- a/homeassistant/components/ialarm/config_flow.py +++ b/homeassistant/components/ialarm/config_flow.py @@ -48,7 +48,7 @@ class IAlarmConfigFlow(ConfigFlow, domain=DOMAIN): mac = await _get_device_mac(self.hass, host, port) except ConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/icloud/account.py b/homeassistant/components/icloud/account.py index 015726fbf73..2b3d1a22f21 100644 --- a/homeassistant/components/icloud/account.py +++ b/homeassistant/components/icloud/account.py @@ -169,7 +169,7 @@ class IcloudAccount: api_devices = {} try: api_devices = self.api.devices - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.error("Unknown iCloud error: %s", err) self._fetch_interval = 2 dispatcher_send(self.hass, self.signal_device_update) diff --git a/homeassistant/components/idasen_desk/config_flow.py b/homeassistant/components/idasen_desk/config_flow.py index 8d6af14f043..b7c14089656 100644 --- a/homeassistant/components/idasen_desk/config_flow.py +++ b/homeassistant/components/idasen_desk/config_flow.py @@ -72,7 +72,7 @@ class IdasenDeskConfigFlow(ConfigFlow, domain=DOMAIN): except BleakError: _LOGGER.exception("Unexpected Bluetooth error") errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error") errors["base"] = "unknown" else: diff --git a/homeassistant/components/iotawatt/config_flow.py b/homeassistant/components/iotawatt/config_flow.py index b9310b8a2b9..f8821784a1d 100644 --- a/homeassistant/components/iotawatt/config_flow.py +++ b/homeassistant/components/iotawatt/config_flow.py @@ -31,7 +31,7 @@ async def validate_input(hass: HomeAssistant, data: dict[str, str]) -> dict[str, is_connected = await iotawatt.connect() except CONNECTION_ERRORS: return {"base": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return {"base": "unknown"} diff --git a/homeassistant/components/isy994/config_flow.py b/homeassistant/components/isy994/config_flow.py index 639e591746d..0239926f5e3 100644 --- a/homeassistant/components/isy994/config_flow.py +++ b/homeassistant/components/isy994/config_flow.py @@ -157,7 +157,7 @@ class Isy994ConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_host" except InvalidAuth: errors[CONF_PASSWORD] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/jellyfin/config_flow.py b/homeassistant/components/jellyfin/config_flow.py index 9a1e3d5985c..44374fb9399 100644 --- a/homeassistant/components/jellyfin/config_flow.py +++ b/homeassistant/components/jellyfin/config_flow.py @@ -66,7 +66,7 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: errors["base"] = "unknown" _LOGGER.exception("Unexpected exception") else: @@ -116,7 +116,7 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: errors["base"] = "unknown" _LOGGER.exception("Unexpected exception") else: diff --git a/homeassistant/components/juicenet/config_flow.py b/homeassistant/components/juicenet/config_flow.py index 237c89922b2..607ffb6ffe2 100644 --- a/homeassistant/components/juicenet/config_flow.py +++ b/homeassistant/components/juicenet/config_flow.py @@ -58,7 +58,7 @@ class JuiceNetConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/justnimbus/config_flow.py b/homeassistant/components/justnimbus/config_flow.py index 2a286c41b5f..0520c558266 100644 --- a/homeassistant/components/justnimbus/config_flow.py +++ b/homeassistant/components/justnimbus/config_flow.py @@ -56,7 +56,7 @@ class JustNimbusConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except justnimbus.JustNimbusError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/kmtronic/config_flow.py b/homeassistant/components/kmtronic/config_flow.py index dd0a7652418..746b075789f 100644 --- a/homeassistant/components/kmtronic/config_flow.py +++ b/homeassistant/components/kmtronic/config_flow.py @@ -74,7 +74,7 @@ class KmtronicConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/kodi/config_flow.py b/homeassistant/components/kodi/config_flow.py index b4d9c575122..e431c72d21e 100644 --- a/homeassistant/components/kodi/config_flow.py +++ b/homeassistant/components/kodi/config_flow.py @@ -133,7 +133,7 @@ class KodiConfigFlow(ConfigFlow, domain=DOMAIN): return await self.async_step_ws_port() except CannotConnect: return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") @@ -167,7 +167,7 @@ class KodiConfigFlow(ConfigFlow, domain=DOMAIN): return await self.async_step_ws_port() except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -192,7 +192,7 @@ class KodiConfigFlow(ConfigFlow, domain=DOMAIN): return await self.async_step_ws_port() except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -215,7 +215,7 @@ class KodiConfigFlow(ConfigFlow, domain=DOMAIN): await validate_ws(self.hass, self._get_data()) except WSCannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -235,7 +235,7 @@ class KodiConfigFlow(ConfigFlow, domain=DOMAIN): except CannotConnect: _LOGGER.exception("Cannot connect to Kodi") reason = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") reason = "unknown" else: diff --git a/homeassistant/components/kostal_plenticore/config_flow.py b/homeassistant/components/kostal_plenticore/config_flow.py index c1c8ac249e0..547afa9d71b 100644 --- a/homeassistant/components/kostal_plenticore/config_flow.py +++ b/homeassistant/components/kostal_plenticore/config_flow.py @@ -59,7 +59,7 @@ class KostalPlenticoreConfigFlow(ConfigFlow, domain=DOMAIN): _LOGGER.error("Error response: %s", ex) except (ClientError, TimeoutError): errors[CONF_HOST] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors[CONF_BASE] = "unknown" diff --git a/homeassistant/components/lacrosse_view/config_flow.py b/homeassistant/components/lacrosse_view/config_flow.py index 805afc40d2b..5a3fe4a03ca 100644 --- a/homeassistant/components/lacrosse_view/config_flow.py +++ b/homeassistant/components/lacrosse_view/config_flow.py @@ -75,7 +75,7 @@ class LaCrosseViewConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except NoLocations: errors["base"] = "no_locations" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/lametric/config_flow.py b/homeassistant/components/lametric/config_flow.py index f21b0cb0a3c..8dbd5279bc6 100644 --- a/homeassistant/components/lametric/config_flow.py +++ b/homeassistant/components/lametric/config_flow.py @@ -152,7 +152,7 @@ class LaMetricFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN): except LaMetricConnectionError as ex: LOGGER.error("Error connecting to LaMetric: %s", ex) errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected error occurred") errors["base"] = "unknown" @@ -214,7 +214,7 @@ class LaMetricFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN): except LaMetricConnectionError as ex: LOGGER.error("Error connecting to LaMetric: %s", ex) errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected error occurred") errors["base"] = "unknown" diff --git a/homeassistant/components/lastfm/config_flow.py b/homeassistant/components/lastfm/config_flow.py index 154409ac66d..c6ea120242d 100644 --- a/homeassistant/components/lastfm/config_flow.py +++ b/homeassistant/components/lastfm/config_flow.py @@ -49,7 +49,7 @@ def get_lastfm_user(api_key: str, username: str) -> tuple[User, dict[str, str]]: errors["base"] = "invalid_auth" else: errors["base"] = "unknown" - except Exception: # pylint:disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" return user, errors diff --git a/homeassistant/components/laundrify/config_flow.py b/homeassistant/components/laundrify/config_flow.py index c131befd7d4..5a608954321 100644 --- a/homeassistant/components/laundrify/config_flow.py +++ b/homeassistant/components/laundrify/config_flow.py @@ -58,7 +58,7 @@ class LaundrifyConfigFlow(ConfigFlow, domain=DOMAIN): errors[CONF_CODE] = "invalid_auth" except ApiConnectionException: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/ld2410_ble/config_flow.py b/homeassistant/components/ld2410_ble/config_flow.py index 10d282cb8c7..2cbc660aec6 100644 --- a/homeassistant/components/ld2410_ble/config_flow.py +++ b/homeassistant/components/ld2410_ble/config_flow.py @@ -64,7 +64,7 @@ class Ld2410BleConfigFlow(ConfigFlow, domain=DOMAIN): await ld2410_ble.initialise() except BLEAK_EXCEPTIONS: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error") errors["base"] = "unknown" else: diff --git a/homeassistant/components/led_ble/config_flow.py b/homeassistant/components/led_ble/config_flow.py index a5afbcc6c0d..90d86d44160 100644 --- a/homeassistant/components/led_ble/config_flow.py +++ b/homeassistant/components/led_ble/config_flow.py @@ -68,7 +68,7 @@ class LedBleConfigFlow(ConfigFlow, domain=DOMAIN): await led_ble.update() except BLEAK_EXCEPTIONS: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error") errors["base"] = "unknown" else: diff --git a/homeassistant/components/linear_garage_door/config_flow.py b/homeassistant/components/linear_garage_door/config_flow.py index 31629f8e3b0..dca2780cfea 100644 --- a/homeassistant/components/linear_garage_door/config_flow.py +++ b/homeassistant/components/linear_garage_door/config_flow.py @@ -88,7 +88,7 @@ class LinearGarageDoorConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/litterrobot/config_flow.py b/homeassistant/components/litterrobot/config_flow.py index aada2f6c9cb..633c6a5a5a2 100644 --- a/homeassistant/components/litterrobot/config_flow.py +++ b/homeassistant/components/litterrobot/config_flow.py @@ -94,7 +94,7 @@ class LitterRobotConfigFlow(ConfigFlow, domain=DOMAIN): return "invalid_auth" except LitterRobotException: return "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return "unknown" return "" diff --git a/homeassistant/components/logbook/processor.py b/homeassistant/components/logbook/processor.py index df1eb6a15f2..f617c8e7d73 100644 --- a/homeassistant/components/logbook/processor.py +++ b/homeassistant/components/logbook/processor.py @@ -246,7 +246,7 @@ def _humanify( domain, describe_event = external_events[event_type] try: data = describe_event(event_cache.get(row)) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error with %s describe event for %s", domain, event_type ) @@ -358,7 +358,7 @@ class ContextAugmenter: event = self.event_cache.get(context_row) try: described = describe_event(event) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error with %s describe event for %s", domain, event_type) return if name := described.get(LOGBOOK_ENTRY_NAME): diff --git a/homeassistant/components/lookin/config_flow.py b/homeassistant/components/lookin/config_flow.py index 61dfd9a2c20..ce798b8f24b 100644 --- a/homeassistant/components/lookin/config_flow.py +++ b/homeassistant/components/lookin/config_flow.py @@ -40,7 +40,7 @@ class LookinFlowHandler(ConfigFlow, domain=DOMAIN): device: Device = await self._validate_device(host=host) except (aiohttp.ClientError, NoUsableService): return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") @@ -62,7 +62,7 @@ class LookinFlowHandler(ConfigFlow, domain=DOMAIN): device = await self._validate_device(host=host) except (aiohttp.ClientError, NoUsableService): errors[CONF_HOST] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/lupusec/config_flow.py b/homeassistant/components/lupusec/config_flow.py index 3af823e4fa1..82162bccf80 100644 --- a/homeassistant/components/lupusec/config_flow.py +++ b/homeassistant/components/lupusec/config_flow.py @@ -52,7 +52,7 @@ class LupusecConfigFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except JSONDecodeError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" @@ -84,7 +84,7 @@ class LupusecConfigFlowHandler(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="cannot_connect") except JSONDecodeError: return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/lutron/config_flow.py b/homeassistant/components/lutron/config_flow.py index 8fd11484a72..d267a646b03 100644 --- a/homeassistant/components/lutron/config_flow.py +++ b/homeassistant/components/lutron/config_flow.py @@ -47,7 +47,7 @@ class LutronConfigFlow(ConfigFlow, domain=DOMAIN): except HTTPError: _LOGGER.exception("Http error") errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error") errors["base"] = "unknown" else: @@ -94,7 +94,7 @@ class LutronConfigFlow(ConfigFlow, domain=DOMAIN): except HTTPError: _LOGGER.exception("Http error") return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/mailbox/__init__.py b/homeassistant/components/mailbox/__init__.py index 337a58e3b2f..b446ba3704e 100644 --- a/homeassistant/components/mailbox/__init__.py +++ b/homeassistant/components/mailbox/__init__.py @@ -98,7 +98,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: _LOGGER.error("Failed to initialize mailbox platform %s", p_type) return - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error setting up platform %s", p_type) return diff --git a/homeassistant/components/matter/__init__.py b/homeassistant/components/matter/__init__.py index 06c205859bb..86b642f7389 100644 --- a/homeassistant/components/matter/__init__.py +++ b/homeassistant/components/matter/__init__.py @@ -153,7 +153,7 @@ async def _client_listen( if entry.state != ConfigEntryState.LOADED: raise LOGGER.error("Failed to listen: %s", err) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 # We need to guard against unknown exceptions to not crash this task. LOGGER.exception("Unexpected exception: %s", err) if entry.state != ConfigEntryState.LOADED: diff --git a/homeassistant/components/matter/config_flow.py b/homeassistant/components/matter/config_flow.py index b079dcd9b54..ae71b7a1711 100644 --- a/homeassistant/components/matter/config_flow.py +++ b/homeassistant/components/matter/config_flow.py @@ -222,7 +222,7 @@ class MatterConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidServerVersion: errors["base"] = "invalid_server_version" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/meater/config_flow.py b/homeassistant/components/meater/config_flow.py index 0f2bb35755f..a7ba3ba1498 100644 --- a/homeassistant/components/meater/config_flow.py +++ b/homeassistant/components/meater/config_flow.py @@ -84,7 +84,7 @@ class MeaterConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except ServiceUnavailableError: errors["base"] = "service_unavailable_error" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown_auth_error" else: data = {"username": username, "password": password} diff --git a/homeassistant/components/medcom_ble/config_flow.py b/homeassistant/components/medcom_ble/config_flow.py index a50a5876cc7..fc5bab1734b 100644 --- a/homeassistant/components/medcom_ble/config_flow.py +++ b/homeassistant/components/medcom_ble/config_flow.py @@ -136,7 +136,7 @@ class InspectorBLEConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="cannot_connect") except AbortFlow: raise - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error occurred reading information from %s", self._discovery_info.address, diff --git a/homeassistant/components/metoffice/config_flow.py b/homeassistant/components/metoffice/config_flow.py index 8b3c10cd460..d46e537dadb 100644 --- a/homeassistant/components/metoffice/config_flow.py +++ b/homeassistant/components/metoffice/config_flow.py @@ -61,7 +61,7 @@ class MetOfficeConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/microbees/config_flow.py b/homeassistant/components/microbees/config_flow.py index c54f8939145..4d0f5b4474b 100644 --- a/homeassistant/components/microbees/config_flow.py +++ b/homeassistant/components/microbees/config_flow.py @@ -45,7 +45,7 @@ class OAuth2FlowHandler( current_user = await microbees.getMyProfile() except MicroBeesException: return self.async_abort(reason="invalid_auth") - except Exception: # pylint: disable=broad-except + except Exception: self.logger.exception("Unexpected error") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/minio/minio_helper.py b/homeassistant/components/minio/minio_helper.py index 551d0c6fa45..bd814bdf349 100644 --- a/homeassistant/components/minio/minio_helper.py +++ b/homeassistant/components/minio/minio_helper.py @@ -160,8 +160,7 @@ class MinioEventThread(threading.Thread): presigned_url = minio_client.presigned_get_object(bucket, key) # Fail gracefully. If for whatever reason this stops working, # it shouldn't prevent it from firing events. - # pylint: disable-next=broad-except - except Exception as error: + except Exception as error: # noqa: BLE001 _LOGGER.error("Failed to generate presigned url: %s", error) queue_entry = { diff --git a/homeassistant/components/moehlenhoff_alpha2/config_flow.py b/homeassistant/components/moehlenhoff_alpha2/config_flow.py index a2a43c7bc5d..3651885e4e1 100644 --- a/homeassistant/components/moehlenhoff_alpha2/config_flow.py +++ b/homeassistant/components/moehlenhoff_alpha2/config_flow.py @@ -28,7 +28,7 @@ async def validate_input(data: dict[str, Any]) -> dict[str, str]: await base.update_data() except (aiohttp.client_exceptions.ClientConnectorError, TimeoutError): return {"error": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return {"error": "unknown"} diff --git a/homeassistant/components/monoprice/config_flow.py b/homeassistant/components/monoprice/config_flow.py index 7b9113821d1..542e729dbd2 100644 --- a/homeassistant/components/monoprice/config_flow.py +++ b/homeassistant/components/monoprice/config_flow.py @@ -85,7 +85,7 @@ class MonoPriceConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_create_entry(title=user_input[CONF_PORT], data=info) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/motion_blinds/config_flow.py b/homeassistant/components/motion_blinds/config_flow.py index 3ba215a3f4c..c838825a4bd 100644 --- a/homeassistant/components/motion_blinds/config_flow.py +++ b/homeassistant/components/motion_blinds/config_flow.py @@ -97,7 +97,7 @@ class MotionBlindsFlowHandler(ConfigFlow, domain=DOMAIN): try: # key not needed for GetDeviceList request await self.hass.async_add_executor_job(gateway.GetDeviceList) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return self.async_abort(reason="not_motionblinds") if not gateway.available: diff --git a/homeassistant/components/mqtt/client.py b/homeassistant/components/mqtt/client.py index 158b1d82db9..e48a5ad3181 100644 --- a/homeassistant/components/mqtt/client.py +++ b/homeassistant/components/mqtt/client.py @@ -379,7 +379,7 @@ class EnsureJobAfterCooldown: await self._task except asyncio.CancelledError: pass - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error cleaning up task") diff --git a/homeassistant/components/mqtt/discovery.py b/homeassistant/components/mqtt/discovery.py index fdccbb14e32..702db9e508e 100644 --- a/homeassistant/components/mqtt/discovery.py +++ b/homeassistant/components/mqtt/discovery.py @@ -232,7 +232,7 @@ async def async_start( # noqa: C901 key = ORIGIN_ABBREVIATIONS.get(key, key) origin_info[key] = origin_info.pop(abbreviated_key) MQTT_ORIGIN_INFO_SCHEMA(discovery_payload[CONF_ORIGIN]) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.warning( "Unable to parse origin information " "from discovery message, got %s", diff --git a/homeassistant/components/mqtt/models.py b/homeassistant/components/mqtt/models.py index 17640c3e733..bba543893c9 100644 --- a/homeassistant/components/mqtt/models.py +++ b/homeassistant/components/mqtt/models.py @@ -375,7 +375,7 @@ class EntityTopicState: _, entity = self.subscribe_calls.popitem() try: entity.async_write_ha_state() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Exception raised when updating state of %s, topic: " "'%s' with payload: %s", diff --git a/homeassistant/components/mullvad/config_flow.py b/homeassistant/components/mullvad/config_flow.py index 0ffcc11c97e..c16f8879a7b 100644 --- a/homeassistant/components/mullvad/config_flow.py +++ b/homeassistant/components/mullvad/config_flow.py @@ -24,7 +24,7 @@ class MullvadConfigFlow(ConfigFlow, domain=DOMAIN): await self.hass.async_add_executor_job(MullvadAPI) except MullvadAPIError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" else: return self.async_create_entry(title="Mullvad VPN", data=user_input) diff --git a/homeassistant/components/mutesync/config_flow.py b/homeassistant/components/mutesync/config_flow.py index 2399cdc063e..ef03df39968 100644 --- a/homeassistant/components/mutesync/config_flow.py +++ b/homeassistant/components/mutesync/config_flow.py @@ -60,7 +60,7 @@ class MuteSyncConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" else: return self.async_create_entry( diff --git a/homeassistant/components/nam/config_flow.py b/homeassistant/components/nam/config_flow.py index efdc8f2514b..ce45b2605ca 100644 --- a/homeassistant/components/nam/config_flow.py +++ b/homeassistant/components/nam/config_flow.py @@ -96,7 +96,7 @@ class NAMFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except CannotGetMacError: return self.async_abort(reason="device_unsupported") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -130,7 +130,7 @@ class NAMFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except (ApiError, ClientConnectorError, TimeoutError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/nanoleaf/config_flow.py b/homeassistant/components/nanoleaf/config_flow.py index ff25a25caf4..080b8131b1d 100644 --- a/homeassistant/components/nanoleaf/config_flow.py +++ b/homeassistant/components/nanoleaf/config_flow.py @@ -67,7 +67,7 @@ class NanoleafConfigFlow(ConfigFlow, domain=DOMAIN): ) except Unauthorized: pass - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error connecting to Nanoleaf") return self.async_show_form( step_id="user", @@ -173,7 +173,7 @@ class NanoleafConfigFlow(ConfigFlow, domain=DOMAIN): ) except Unavailable: return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error authorizing Nanoleaf") return self.async_show_form(step_id="link", errors={"base": "unknown"}) @@ -200,7 +200,7 @@ class NanoleafConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="cannot_connect") except InvalidToken: return self.async_abort(reason="invalid_token") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Unknown error connecting with Nanoleaf at %s", self.nanoleaf.host ) diff --git a/homeassistant/components/network/util.py b/homeassistant/components/network/util.py index 55c3c2f5ead..c891904b7e9 100644 --- a/homeassistant/components/network/util.py +++ b/homeassistant/components/network/util.py @@ -144,7 +144,7 @@ def async_get_source_ip(target_ip: str) -> str | None: try: test_sock.connect((target_ip, 1)) return cast(str, test_sock.getsockname()[0]) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.debug( ( "The system could not auto detect the source ip for %s on your" diff --git a/homeassistant/components/nexia/config_flow.py b/homeassistant/components/nexia/config_flow.py index 5af4ff52fbb..6d1f4af043b 100644 --- a/homeassistant/components/nexia/config_flow.py +++ b/homeassistant/components/nexia/config_flow.py @@ -91,7 +91,7 @@ class NexiaConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/nextdns/config_flow.py b/homeassistant/components/nextdns/config_flow.py index 28fd50af2dc..4955bbb4cad 100644 --- a/homeassistant/components/nextdns/config_flow.py +++ b/homeassistant/components/nextdns/config_flow.py @@ -45,7 +45,7 @@ class NextDnsFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_api_key" except (ApiError, ClientConnectorError, TimeoutError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" else: return await self.async_step_profiles() diff --git a/homeassistant/components/nfandroidtv/config_flow.py b/homeassistant/components/nfandroidtv/config_flow.py index 83621c63789..ccb882509f6 100644 --- a/homeassistant/components/nfandroidtv/config_flow.py +++ b/homeassistant/components/nfandroidtv/config_flow.py @@ -54,7 +54,7 @@ class NFAndroidTVFlowHandler(ConfigFlow, domain=DOMAIN): except ConnectError: _LOGGER.error("Error connecting to device at %s", host) return "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return "unknown" return None diff --git a/homeassistant/components/nibe_heatpump/config_flow.py b/homeassistant/components/nibe_heatpump/config_flow.py index 913ebd6b00c..2d47d570f21 100644 --- a/homeassistant/components/nibe_heatpump/config_flow.py +++ b/homeassistant/components/nibe_heatpump/config_flow.py @@ -193,7 +193,7 @@ class NibeHeatPumpConfigFlow(ConfigFlow, domain=DOMAIN): except FieldError as exception: LOGGER.debug("Validation error %s", exception) errors[exception.field] = exception.error - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -219,7 +219,7 @@ class NibeHeatPumpConfigFlow(ConfigFlow, domain=DOMAIN): except FieldError as exception: LOGGER.exception("Validation error") errors[exception.field] = exception.error - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/nightscout/config_flow.py b/homeassistant/components/nightscout/config_flow.py index 6d2a0e6c385..0c0e8b296cd 100644 --- a/homeassistant/components/nightscout/config_flow.py +++ b/homeassistant/components/nightscout/config_flow.py @@ -56,7 +56,7 @@ class NightscoutConfigFlow(ConfigFlow, domain=DOMAIN): info = await _validate_input(user_input) except InputValidationError as error: errors["base"] = error.base - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/nina/config_flow.py b/homeassistant/components/nina/config_flow.py index 3b8b290d6c8..221a9202ae4 100644 --- a/homeassistant/components/nina/config_flow.py +++ b/homeassistant/components/nina/config_flow.py @@ -116,7 +116,7 @@ class NinaConfigFlow(ConfigFlow, domain=DOMAIN): ) except ApiError: errors["base"] = "cannot_connect" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.exception("Unexpected exception: %s", err) return self.async_abort(reason="unknown") @@ -195,7 +195,7 @@ class OptionsFlowHandler(OptionsFlow): ) except ApiError: errors["base"] = "cannot_connect" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.exception("Unexpected exception: %s", err) return self.async_abort(reason="unknown") diff --git a/homeassistant/components/notify/legacy.py b/homeassistant/components/notify/legacy.py index 2f6984e36f1..b3871d858e8 100644 --- a/homeassistant/components/notify/legacy.py +++ b/homeassistant/components/notify/legacy.py @@ -117,7 +117,7 @@ def async_setup_legacy( ) return - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Error setting up platform %s", integration_name) return diff --git a/homeassistant/components/notion/config_flow.py b/homeassistant/components/notion/config_flow.py index 9a65f922fd9..c803992c2e2 100644 --- a/homeassistant/components/notion/config_flow.py +++ b/homeassistant/components/notion/config_flow.py @@ -51,7 +51,7 @@ async def async_validate_credentials( except NotionError as err: LOGGER.error("Unknown Notion error while validation credentials: %s", err) errors["base"] = "unknown" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.exception("Unknown error while validation credentials: %s", err) errors["base"] = "unknown" diff --git a/homeassistant/components/nuheat/__init__.py b/homeassistant/components/nuheat/__init__.py index c8accd6ab73..8eeee1f3f95 100644 --- a/homeassistant/components/nuheat/__init__.py +++ b/homeassistant/components/nuheat/__init__.py @@ -52,7 +52,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: _LOGGER.error("Failed to login to nuheat: %s", ex) return False raise ConfigEntryNotReady from ex - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 _LOGGER.error("Failed to login to nuheat: %s", ex) return False diff --git a/homeassistant/components/nuheat/config_flow.py b/homeassistant/components/nuheat/config_flow.py index a75b65abccd..a5d34f7ae6c 100644 --- a/homeassistant/components/nuheat/config_flow.py +++ b/homeassistant/components/nuheat/config_flow.py @@ -76,7 +76,7 @@ class NuHeatConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except InvalidThermostat: errors["base"] = "invalid_thermostat" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/nuki/config_flow.py b/homeassistant/components/nuki/config_flow.py index 4a3e96f68a5..286395e1ff3 100644 --- a/homeassistant/components/nuki/config_flow.py +++ b/homeassistant/components/nuki/config_flow.py @@ -118,7 +118,7 @@ class NukiConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" @@ -156,7 +156,7 @@ class NukiConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/nut/config_flow.py b/homeassistant/components/nut/config_flow.py index f0126ba4894..d0a2da124a6 100644 --- a/homeassistant/components/nut/config_flow.py +++ b/homeassistant/components/nut/config_flow.py @@ -183,7 +183,7 @@ class NutConfigFlow(ConfigFlow, domain=DOMAIN): description_placeholders["error"] = str(ex) except AbortFlow: raise - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors[CONF_BASE] = "unknown" return info, errors, description_placeholders diff --git a/homeassistant/components/nws/config_flow.py b/homeassistant/components/nws/config_flow.py index 37d5bb5bf82..22a4adf3d85 100644 --- a/homeassistant/components/nws/config_flow.py +++ b/homeassistant/components/nws/config_flow.py @@ -66,7 +66,7 @@ class NWSConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_create_entry(title=info["title"], data=user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/nzbget/config_flow.py b/homeassistant/components/nzbget/config_flow.py index 2c549e4ed24..47d35f32f9f 100644 --- a/homeassistant/components/nzbget/config_flow.py +++ b/homeassistant/components/nzbget/config_flow.py @@ -63,7 +63,7 @@ class NZBGetConfigFlow(ConfigFlow, domain=DOMAIN): await self.hass.async_add_executor_job(_validate_input, user_input) except NZBGetAPIException: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") else: diff --git a/homeassistant/components/octoprint/config_flow.py b/homeassistant/components/octoprint/config_flow.py index f99a151292d..32f5fa88fff 100644 --- a/homeassistant/components/octoprint/config_flow.py +++ b/homeassistant/components/octoprint/config_flow.py @@ -82,7 +82,7 @@ class OctoPrintConfigFlow(ConfigFlow, domain=DOMAIN): raise err from None except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" if errors: @@ -120,7 +120,7 @@ class OctoPrintConfigFlow(ConfigFlow, domain=DOMAIN): except OctoprintException: _LOGGER.exception("Failed to get an application key") return self.async_show_progress_done(next_step_id="auth_failed") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Failed to get an application key") return self.async_show_progress_done(next_step_id="auth_failed") finally: diff --git a/homeassistant/components/ollama/config_flow.py b/homeassistant/components/ollama/config_flow.py index e192aeb1fca..48904d53413 100644 --- a/homeassistant/components/ollama/config_flow.py +++ b/homeassistant/components/ollama/config_flow.py @@ -93,7 +93,7 @@ class OllamaConfigFlow(ConfigFlow, domain=DOMAIN): } except (TimeoutError, httpx.ConnectError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/omnilogic/config_flow.py b/homeassistant/components/omnilogic/config_flow.py index 3f3acc3c100..229f458ceb4 100644 --- a/homeassistant/components/omnilogic/config_flow.py +++ b/homeassistant/components/omnilogic/config_flow.py @@ -53,7 +53,7 @@ class OmniLogicConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except OmniLogicException: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/oncue/config_flow.py b/homeassistant/components/oncue/config_flow.py index e423ba08105..92cd037734e 100644 --- a/homeassistant/components/oncue/config_flow.py +++ b/homeassistant/components/oncue/config_flow.py @@ -71,7 +71,7 @@ class OncueConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except LoginFailedException: errors[CONF_PASSWORD] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return errors diff --git a/homeassistant/components/openai_conversation/config_flow.py b/homeassistant/components/openai_conversation/config_flow.py index fdbbbc554df..2fde6f37690 100644 --- a/homeassistant/components/openai_conversation/config_flow.py +++ b/homeassistant/components/openai_conversation/config_flow.py @@ -88,7 +88,7 @@ class OpenAIConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except openai.AuthenticationError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/openexchangerates/config_flow.py b/homeassistant/components/openexchangerates/config_flow.py index 2fc0acea78d..df83690d2e3 100644 --- a/homeassistant/components/openexchangerates/config_flow.py +++ b/homeassistant/components/openexchangerates/config_flow.py @@ -84,7 +84,7 @@ class OpenExchangeRatesConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except TimeoutError: errors["base"] = "timeout_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/opengarage/config_flow.py b/homeassistant/components/opengarage/config_flow.py index 0b86c563783..e4576ae4b70 100644 --- a/homeassistant/components/opengarage/config_flow.py +++ b/homeassistant/components/opengarage/config_flow.py @@ -75,7 +75,7 @@ class OpenGarageConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/osoenergy/config_flow.py b/homeassistant/components/osoenergy/config_flow.py index ce0932571e5..e0afc5292ae 100644 --- a/homeassistant/components/osoenergy/config_flow.py +++ b/homeassistant/components/osoenergy/config_flow.py @@ -64,7 +64,7 @@ class OSOEnergyFlowHandler(ConfigFlow, domain=DOMAIN): websession = aiohttp_client.async_get_clientsession(self.hass) client = OSOEnergy(subscription_key, websession) return await client.get_user_email() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error occurred") return None diff --git a/homeassistant/components/ourgroceries/config_flow.py b/homeassistant/components/ourgroceries/config_flow.py index 98eae900db6..233ec381556 100644 --- a/homeassistant/components/ourgroceries/config_flow.py +++ b/homeassistant/components/ourgroceries/config_flow.py @@ -43,7 +43,7 @@ class OurGroceriesConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidLoginException: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/overkiz/config_flow.py b/homeassistant/components/overkiz/config_flow.py index eb79910d63f..79a8328f874 100644 --- a/homeassistant/components/overkiz/config_flow.py +++ b/homeassistant/components/overkiz/config_flow.py @@ -170,7 +170,7 @@ class OverkizConfigFlow(ConfigFlow, domain=DOMAIN): # the Overkiz API server. Login will return unknown user. description_placeholders["unsupported_device"] = "Somfy Protect" errors["base"] = "unsupported_hardware" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" LOGGER.exception("Unknown error") else: @@ -253,7 +253,7 @@ class OverkizConfigFlow(ConfigFlow, domain=DOMAIN): # the Overkiz API server. Login will return unknown user. description_placeholders["unsupported_device"] = "Somfy Protect" errors["base"] = "unsupported_hardware" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" LOGGER.exception("Unknown error") else: diff --git a/homeassistant/components/panasonic_viera/__init__.py b/homeassistant/components/panasonic_viera/__init__.py index 5c76a7e6900..b2f3bbba91a 100644 --- a/homeassistant/components/panasonic_viera/__init__.py +++ b/homeassistant/components/panasonic_viera/__init__.py @@ -177,7 +177,7 @@ class Remote: self._control = None self.state = STATE_OFF self.available = self._on_action is not None - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("An unknown error occurred") self._control = None self.state = STATE_OFF @@ -264,7 +264,7 @@ class Remote: self.available = self._on_action is not None await self.async_create_remote_control() return None - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("An unknown error occurred") self.state = STATE_OFF self.available = self._on_action is not None diff --git a/homeassistant/components/panasonic_viera/config_flow.py b/homeassistant/components/panasonic_viera/config_flow.py index 65a830c9b1a..9cb8fb5da83 100644 --- a/homeassistant/components/panasonic_viera/config_flow.py +++ b/homeassistant/components/panasonic_viera/config_flow.py @@ -60,7 +60,7 @@ class PanasonicVieraConfigFlow(ConfigFlow, domain=DOMAIN): except (URLError, SOAPError, OSError) as err: _LOGGER.error("Could not establish remote connection: %s", err) errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("An unknown error occurred") return self.async_abort(reason="unknown") @@ -118,7 +118,7 @@ class PanasonicVieraConfigFlow(ConfigFlow, domain=DOMAIN): except (URLError, OSError) as err: _LOGGER.error("The remote connection was lost: %s", err) return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error") return self.async_abort(reason="unknown") @@ -142,7 +142,7 @@ class PanasonicVieraConfigFlow(ConfigFlow, domain=DOMAIN): except (URLError, SOAPError, OSError) as err: _LOGGER.error("The remote connection was lost: %s", err) return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/philips_js/config_flow.py b/homeassistant/components/philips_js/config_flow.py index ed0fce05f46..a73145f7c1c 100644 --- a/homeassistant/components/philips_js/config_flow.py +++ b/homeassistant/components/philips_js/config_flow.py @@ -169,7 +169,7 @@ class PhilipsJSConfigFlow(ConfigFlow, domain=DOMAIN): except ConnectionFailure as exc: LOGGER.error(exc) errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/picnic/config_flow.py b/homeassistant/components/picnic/config_flow.py index 9712286b554..3023b5309de 100644 --- a/homeassistant/components/picnic/config_flow.py +++ b/homeassistant/components/picnic/config_flow.py @@ -102,7 +102,7 @@ class PicnicConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/plex/config_flow.py b/homeassistant/components/plex/config_flow.py index dabde0b0490..374067c94cd 100644 --- a/homeassistant/components/plex/config_flow.py +++ b/homeassistant/components/plex/config_flow.py @@ -216,7 +216,7 @@ class PlexFlowHandler(ConfigFlow, domain=DOMAIN): self.available_servers = available_servers.args[0] return await self.async_step_select_server() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error connecting to Plex server") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/plugwise/config_flow.py b/homeassistant/components/plugwise/config_flow.py index 4c33e51788f..1e0f34007c9 100644 --- a/homeassistant/components/plugwise/config_flow.py +++ b/homeassistant/components/plugwise/config_flow.py @@ -106,7 +106,7 @@ class PlugwiseConfigFlow(ConfigFlow, domain=DOMAIN): CONF_PASSWORD: config_entry.data[CONF_PASSWORD], }, ) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 self._abort_if_unique_id_configured() else: self._abort_if_unique_id_configured( @@ -188,7 +188,7 @@ class PlugwiseConfigFlow(ConfigFlow, domain=DOMAIN): errors[CONF_BASE] = "response_error" except UnsupportedDeviceError: errors[CONF_BASE] = "unsupported" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors[CONF_BASE] = "unknown" else: await self.async_set_unique_id( diff --git a/homeassistant/components/point/__init__.py b/homeassistant/components/point/__init__.py index 9f0f6e6dc7c..e1536379084 100644 --- a/homeassistant/components/point/__init__.py +++ b/homeassistant/components/point/__init__.py @@ -104,7 +104,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: except ConnectTimeout as err: _LOGGER.debug("Connection Timeout") raise ConfigEntryNotReady from err - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.error("Authentication Error") return False diff --git a/homeassistant/components/point/config_flow.py b/homeassistant/components/point/config_flow.py index acf4b3e6d34..279561b4e2b 100644 --- a/homeassistant/components/point/config_flow.py +++ b/homeassistant/components/point/config_flow.py @@ -98,7 +98,7 @@ class PointFlowHandler(ConfigFlow, domain=DOMAIN): url = await self._get_authorization_url() except TimeoutError: return self.async_abort(reason="authorize_url_timeout") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error generating auth url") return self.async_abort(reason="unknown_authorize_url_generation") return self.async_show_form( diff --git a/homeassistant/components/powerwall/config_flow.py b/homeassistant/components/powerwall/config_flow.py index 7629d83d9d6..3e2a5fdfd2d 100644 --- a/homeassistant/components/powerwall/config_flow.py +++ b/homeassistant/components/powerwall/config_flow.py @@ -176,7 +176,7 @@ class PowerwallConfigFlow(ConfigFlow, domain=DOMAIN): except AccessDeniedError as ex: errors[CONF_PASSWORD] = "invalid_auth" description_placeholders = {"error": str(ex)} - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" description_placeholders = {"error": str(ex)} diff --git a/homeassistant/components/profiler/__init__.py b/homeassistant/components/profiler/__init__.py index 455a60315b3..d0e9fc7db75 100644 --- a/homeassistant/components/profiler/__init__.py +++ b/homeassistant/components/profiler/__init__.py @@ -505,7 +505,7 @@ def _safe_repr(obj: Any) -> str: """ try: return repr(obj) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return f"Failed to serialize {type(obj)}" diff --git a/homeassistant/components/progettihwsw/config_flow.py b/homeassistant/components/progettihwsw/config_flow.py index 5a5d0de1a80..5f73fe9b1ee 100644 --- a/homeassistant/components/progettihwsw/config_flow.py +++ b/homeassistant/components/progettihwsw/config_flow.py @@ -78,7 +78,7 @@ class ProgettiHWSWConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["base"] = "unknown" else: user_input.update(info) diff --git a/homeassistant/components/prosegur/config_flow.py b/homeassistant/components/prosegur/config_flow.py index 911ae6104fd..82cf1d424c7 100644 --- a/homeassistant/components/prosegur/config_flow.py +++ b/homeassistant/components/prosegur/config_flow.py @@ -62,7 +62,7 @@ class ProsegurConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -127,7 +127,7 @@ class ProsegurConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/prusalink/config_flow.py b/homeassistant/components/prusalink/config_flow.py index b0c7cf2f756..6fa72d6a5fd 100644 --- a/homeassistant/components/prusalink/config_flow.py +++ b/homeassistant/components/prusalink/config_flow.py @@ -113,7 +113,7 @@ class PrusaLinkConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "not_supported" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/purpleair/config_flow.py b/homeassistant/components/purpleair/config_flow.py index 5ba88318a1c..050200f50d4 100644 --- a/homeassistant/components/purpleair/config_flow.py +++ b/homeassistant/components/purpleair/config_flow.py @@ -153,7 +153,7 @@ async def async_validate_api_key(hass: HomeAssistant, api_key: str) -> Validatio except PurpleAirError as err: LOGGER.error("PurpleAir error while checking API key: %s", err) errors["base"] = "unknown" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.exception("Unexpected exception while checking API key: %s", err) errors["base"] = "unknown" @@ -181,7 +181,7 @@ async def async_validate_coordinates( except PurpleAirError as err: LOGGER.error("PurpleAir error while getting nearby sensors: %s", err) errors["base"] = "unknown" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.exception("Unexpected exception while getting nearby sensors: %s", err) errors["base"] = "unknown" else: diff --git a/homeassistant/components/python_script/__init__.py b/homeassistant/components/python_script/__init__.py index 89e9eb5a9eb..9e1205f305a 100644 --- a/homeassistant/components/python_script/__init__.py +++ b/homeassistant/components/python_script/__init__.py @@ -285,7 +285,7 @@ def execute(hass, filename, source, data=None, return_response=False): raise ServiceValidationError(f"Error executing script: {err}") from err logger.error("Error executing script: %s", err) return None - except Exception as err: # pylint: disable=broad-except + except Exception as err: if return_response: raise HomeAssistantError( f"Error executing script ({type(err).__name__}): {err}" diff --git a/homeassistant/components/qnap/config_flow.py b/homeassistant/components/qnap/config_flow.py index 3e0c524f59e..75f41a27f69 100644 --- a/homeassistant/components/qnap/config_flow.py +++ b/homeassistant/components/qnap/config_flow.py @@ -70,7 +70,7 @@ class QnapConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except TypeError: errors["base"] = "invalid_auth" - except Exception as error: # pylint: disable=broad-except + except Exception as error: # noqa: BLE001 _LOGGER.error(error) errors["base"] = "unknown" else: diff --git a/homeassistant/components/rabbitair/config_flow.py b/homeassistant/components/rabbitair/config_flow.py index 6bf48995412..1bee69219b0 100644 --- a/homeassistant/components/rabbitair/config_flow.py +++ b/homeassistant/components/rabbitair/config_flow.py @@ -73,7 +73,7 @@ class RabbitAirConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_host" except TimeoutConnect: errors["base"] = "timeout_connect" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.debug("Unexpected exception: %s", err) errors["base"] = "unknown" else: diff --git a/homeassistant/components/rachio/config_flow.py b/homeassistant/components/rachio/config_flow.py index d0a311db60e..77fe20946b4 100644 --- a/homeassistant/components/rachio/config_flow.py +++ b/homeassistant/components/rachio/config_flow.py @@ -80,7 +80,7 @@ class RachioConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/radiotherm/config_flow.py b/homeassistant/components/radiotherm/config_flow.py index a8de05d9963..e9904318ae9 100644 --- a/homeassistant/components/radiotherm/config_flow.py +++ b/homeassistant/components/radiotherm/config_flow.py @@ -94,7 +94,7 @@ class RadioThermConfigFlow(ConfigFlow, domain=DOMAIN): init_data = await validate_connection(self.hass, user_input[CONF_HOST]) except CannotConnect: errors[CONF_HOST] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/rainforest_eagle/config_flow.py b/homeassistant/components/rainforest_eagle/config_flow.py index b48c1329695..b1867fae333 100644 --- a/homeassistant/components/rainforest_eagle/config_flow.py +++ b/homeassistant/components/rainforest_eagle/config_flow.py @@ -59,7 +59,7 @@ class RainforestEagleConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except data.InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/recorder/auto_repairs/schema.py b/homeassistant/components/recorder/auto_repairs/schema.py index 97b624e3c6b..1373f466bc2 100644 --- a/homeassistant/components/recorder/auto_repairs/schema.py +++ b/homeassistant/components/recorder/auto_repairs/schema.py @@ -55,7 +55,7 @@ def validate_table_schema_supports_utf8( schema_errors = _validate_table_schema_supports_utf8( instance, table_object, columns ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error when validating DB schema") _log_schema_errors(table_object, schema_errors) @@ -76,7 +76,7 @@ def validate_table_schema_has_correct_collation( schema_errors = _validate_table_schema_has_correct_collation( instance, table_object ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error when validating DB schema") _log_schema_errors(table_object, schema_errors) @@ -158,7 +158,7 @@ def validate_db_schema_precision( return schema_errors try: schema_errors = _validate_db_schema_precision(instance, table_object) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error when validating DB schema") _log_schema_errors(table_object, schema_errors) diff --git a/homeassistant/components/recorder/core.py b/homeassistant/components/recorder/core.py index 281b130486f..108cc721466 100644 --- a/homeassistant/components/recorder/core.py +++ b/homeassistant/components/recorder/core.py @@ -702,7 +702,7 @@ class Recorder(threading.Thread): self.is_running = True try: self._run() - except Exception: # pylint: disable=broad-exception-caught + except Exception: _LOGGER.exception( "Recorder._run threw unexpected exception, recorder shutting down" ) @@ -905,7 +905,7 @@ class Recorder(threading.Thread): _LOGGER.debug("Processing task: %s", task) try: self._process_one_task_or_event_or_recover(task) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error while processing event %s", task) def _process_one_task_or_event_or_recover(self, task: RecorderTask | Event) -> None: @@ -946,7 +946,7 @@ class Recorder(threading.Thread): return migration.initialize_database(self.get_session) except UnsupportedDialect: break - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error during connection setup: (retrying in %s seconds)", self.db_retry_wait, @@ -990,7 +990,7 @@ class Recorder(threading.Thread): return True _LOGGER.exception("Database error during schema migration") return False - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error during schema migration") return False else: @@ -1481,7 +1481,7 @@ class Recorder(threading.Thread): self.recorder_runs_manager.end(self.event_session) try: self._commit_event_session_or_retry() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error saving the event session during shutdown") self.event_session.close() diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index 8724846def5..561b446f493 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -183,7 +183,7 @@ def get_schema_version(session_maker: Callable[[], Session]) -> int | None: try: with session_scope(session=session_maker(), read_only=True) as session: return _get_schema_version(session) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error when determining DB schema version") return None @@ -1788,7 +1788,7 @@ def initialize_database(session_maker: Callable[[], Session]) -> bool: with session_scope(session=session_maker()) as session: return _initialize_database(session) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error when initialise database") return False diff --git a/homeassistant/components/recorder/util.py b/homeassistant/components/recorder/util.py index ad96833b1d7..bb5446debc1 100644 --- a/homeassistant/components/recorder/util.py +++ b/homeassistant/components/recorder/util.py @@ -142,7 +142,7 @@ def session_scope( if session.get_transaction() and not read_only: need_rollback = True session.commit() - except Exception as err: # pylint: disable=broad-except + except Exception as err: _LOGGER.exception("Error executing query") if need_rollback: session.rollback() diff --git a/homeassistant/components/renson/config_flow.py b/homeassistant/components/renson/config_flow.py index ec380f5a513..311317bb397 100644 --- a/homeassistant/components/renson/config_flow.py +++ b/homeassistant/components/renson/config_flow.py @@ -55,7 +55,7 @@ class RensonConfigFlow(ConfigFlow, domain=DOMAIN): info = await self.validate_input(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/reolink/config_flow.py b/homeassistant/components/reolink/config_flow.py index b62a7b7f709..773c4f3bc30 100644 --- a/homeassistant/components/reolink/config_flow.py +++ b/homeassistant/components/reolink/config_flow.py @@ -200,7 +200,7 @@ class ReolinkFlowHandler(ConfigFlow, domain=DOMAIN): except (ReolinkError, ReolinkException) as err: placeholders["error"] = str(err) errors[CONF_HOST] = "cannot_connect" - except Exception as err: # pylint: disable=broad-except + except Exception as err: _LOGGER.exception("Unexpected exception") placeholders["error"] = str(err) errors[CONF_HOST] = "unknown" diff --git a/homeassistant/components/reolink/host.py b/homeassistant/components/reolink/host.py index 4f5487a6a04..fe8b1596e74 100644 --- a/homeassistant/components/reolink/host.py +++ b/homeassistant/components/reolink/host.py @@ -652,7 +652,7 @@ class ReolinkHost: message = data.decode("utf-8") channels = await self._api.ONVIF_event_callback(message) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error processing ONVIF event for Reolink %s", self._api.nvr_name ) diff --git a/homeassistant/components/ring/config_flow.py b/homeassistant/components/ring/config_flow.py index 4762017c5bc..6239105580d 100644 --- a/homeassistant/components/ring/config_flow.py +++ b/homeassistant/components/ring/config_flow.py @@ -70,7 +70,7 @@ class RingConfigFlow(ConfigFlow, domain=DOMAIN): return await self.async_step_2fa() except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -126,7 +126,7 @@ class RingConfigFlow(ConfigFlow, domain=DOMAIN): return await self.async_step_2fa() except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/risco/config_flow.py b/homeassistant/components/risco/config_flow.py index 21761e23d09..735880df09b 100644 --- a/homeassistant/components/risco/config_flow.py +++ b/homeassistant/components/risco/config_flow.py @@ -159,7 +159,7 @@ class RiscoConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except UnauthorizedError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -197,7 +197,7 @@ class RiscoConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except UnauthorizedError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/rituals_perfume_genie/config_flow.py b/homeassistant/components/rituals_perfume_genie/config_flow.py index 7bff52fb864..4f108d9bc22 100644 --- a/homeassistant/components/rituals_perfume_genie/config_flow.py +++ b/homeassistant/components/rituals_perfume_genie/config_flow.py @@ -48,7 +48,7 @@ class RitualsPerfumeGenieConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except AuthenticationException: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/roborock/config_flow.py b/homeassistant/components/roborock/config_flow.py index 5715aba3bba..c7347178612 100644 --- a/homeassistant/components/roborock/config_flow.py +++ b/homeassistant/components/roborock/config_flow.py @@ -72,7 +72,7 @@ class RoborockFlowHandler(ConfigFlow, domain=DOMAIN): except RoborockException: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown_roborock" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return errors @@ -95,7 +95,7 @@ class RoborockFlowHandler(ConfigFlow, domain=DOMAIN): except RoborockException: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown_roborock" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/roku/config_flow.py b/homeassistant/components/roku/config_flow.py index 07c1afae9e2..7757cc53e1c 100644 --- a/homeassistant/components/roku/config_flow.py +++ b/homeassistant/components/roku/config_flow.py @@ -75,7 +75,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN): _LOGGER.debug("Roku Error", exc_info=True) errors["base"] = ERROR_CANNOT_CONNECT return self._show_form(errors) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error trying to connect") return self.async_abort(reason=ERROR_UNKNOWN) @@ -100,7 +100,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN): except RokuError: _LOGGER.debug("Roku Error", exc_info=True) return self.async_abort(reason=ERROR_CANNOT_CONNECT) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error trying to connect") return self.async_abort(reason=ERROR_UNKNOWN) @@ -134,7 +134,7 @@ class RokuConfigFlow(ConfigFlow, domain=DOMAIN): except RokuError: _LOGGER.debug("Roku Error", exc_info=True) return self.async_abort(reason=ERROR_CANNOT_CONNECT) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error trying to connect") return self.async_abort(reason=ERROR_UNKNOWN) diff --git a/homeassistant/components/roon/config_flow.py b/homeassistant/components/roon/config_flow.py index 2dc0bf71cd4..f555cc52dd1 100644 --- a/homeassistant/components/roon/config_flow.py +++ b/homeassistant/components/roon/config_flow.py @@ -166,7 +166,7 @@ class RoonConfigFlow(ConfigFlow, domain=DOMAIN): except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/ruckus_unleashed/config_flow.py b/homeassistant/components/ruckus_unleashed/config_flow.py index 1a75b8ae139..d2f27e4ef05 100644 --- a/homeassistant/components/ruckus_unleashed/config_flow.py +++ b/homeassistant/components/ruckus_unleashed/config_flow.py @@ -78,7 +78,7 @@ class RuckusUnleashedConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/ruuvi_gateway/config_flow.py b/homeassistant/components/ruuvi_gateway/config_flow.py index 825f57b2cf2..c22f100e87a 100644 --- a/homeassistant/components/ruuvi_gateway/config_flow.py +++ b/homeassistant/components/ruuvi_gateway/config_flow.py @@ -59,7 +59,7 @@ class RuuviConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return (None, errors) diff --git a/homeassistant/components/rympro/config_flow.py b/homeassistant/components/rympro/config_flow.py index f30e47f09a1..be35c48ac5b 100644 --- a/homeassistant/components/rympro/config_flow.py +++ b/homeassistant/components/rympro/config_flow.py @@ -67,7 +67,7 @@ class RymproConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except UnauthorizedError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/schlage/config_flow.py b/homeassistant/components/schlage/config_flow.py index 217cacedc41..a6104702396 100644 --- a/homeassistant/components/schlage/config_flow.py +++ b/homeassistant/components/schlage/config_flow.py @@ -104,7 +104,7 @@ def _authenticate(username: str, password: str) -> tuple[str | None, dict[str, s auth.authenticate() except NotAuthorizedError: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unknown error") errors["base"] = "unknown" else: diff --git a/homeassistant/components/scsgate/__init__.py b/homeassistant/components/scsgate/__init__.py index 7f00f8abe84..db96ccb688a 100644 --- a/homeassistant/components/scsgate/__init__.py +++ b/homeassistant/components/scsgate/__init__.py @@ -37,7 +37,7 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool: try: scsgate = SCSGate(device=device, logger=_LOGGER) scsgate.start() - except Exception as exception: # pylint: disable=broad-except + except Exception as exception: # noqa: BLE001 _LOGGER.error("Cannot setup SCSGate component: %s", exception) return False @@ -94,7 +94,7 @@ class SCSGate: try: self._devices[message.entity].process_event(message) - except Exception as exception: # pylint: disable=broad-except + except Exception as exception: # noqa: BLE001 msg = f"Exception while processing event: {exception}" self._logger.error(msg) else: diff --git a/homeassistant/components/sense/config_flow.py b/homeassistant/components/sense/config_flow.py index e5880675d2b..25c6898aec8 100644 --- a/homeassistant/components/sense/config_flow.py +++ b/homeassistant/components/sense/config_flow.py @@ -81,7 +81,7 @@ class SenseConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except SenseAuthenticationException: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -98,7 +98,7 @@ class SenseConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except SenseAuthenticationException: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/sentry/config_flow.py b/homeassistant/components/sentry/config_flow.py index b10409caf38..59cd1f3f0e9 100644 --- a/homeassistant/components/sentry/config_flow.py +++ b/homeassistant/components/sentry/config_flow.py @@ -64,7 +64,7 @@ class SentryConfigFlow(ConfigFlow, domain=DOMAIN): Dsn(user_input["dsn"]) except BadDsn: errors["base"] = "bad_dsn" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/shelly/config_flow.py b/homeassistant/components/shelly/config_flow.py index 46cea4e49a4..4e775e384fb 100644 --- a/homeassistant/components/shelly/config_flow.py +++ b/homeassistant/components/shelly/config_flow.py @@ -155,7 +155,7 @@ class ShellyConfigFlow(ConfigFlow, domain=DOMAIN): self.info = await self._async_get_info(host, port) except DeviceConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -174,7 +174,7 @@ class ShellyConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except CustomPortNotSupported: errors["base"] = "custom_port_not_supported" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -211,7 +211,7 @@ class ShellyConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except DeviceConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/sia/config_flow.py b/homeassistant/components/sia/config_flow.py index 4329154b069..cb451133d41 100644 --- a/homeassistant/components/sia/config_flow.py +++ b/homeassistant/components/sia/config_flow.py @@ -77,7 +77,7 @@ def validate_input(data: dict[str, Any]) -> dict[str, str] | None: return {"base": "invalid_account_format"} except InvalidAccountLengthError: return {"base": "invalid_account_length"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception from SIAAccount") return {"base": "unknown"} if not 1 <= data[CONF_PING_INTERVAL] <= 1440: diff --git a/homeassistant/components/simplisafe/__init__.py b/homeassistant/components/simplisafe/__init__.py index cdeb6910aa5..29f53eafffb 100644 --- a/homeassistant/components/simplisafe/__init__.py +++ b/homeassistant/components/simplisafe/__init__.py @@ -503,7 +503,7 @@ class SimpliSafe: raise except WebsocketError as err: LOGGER.error("Failed to connect to websocket: %s", err) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.error("Unknown exception while connecting to websocket: %s", err) LOGGER.info("Reconnecting to websocket") diff --git a/homeassistant/components/skybell/config_flow.py b/homeassistant/components/skybell/config_flow.py index 26602e81882..385f3dc39d7 100644 --- a/homeassistant/components/skybell/config_flow.py +++ b/homeassistant/components/skybell/config_flow.py @@ -100,6 +100,6 @@ class SkybellFlowHandler(ConfigFlow, domain=DOMAIN): return None, "invalid_auth" except exceptions.SkybellException: return None, "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return None, "unknown" return skybell.user_id, None diff --git a/homeassistant/components/slack/config_flow.py b/homeassistant/components/slack/config_flow.py index 03f3683e5a9..7f6d7288606 100644 --- a/homeassistant/components/slack/config_flow.py +++ b/homeassistant/components/slack/config_flow.py @@ -68,7 +68,7 @@ class SlackFlowHandler(ConfigFlow, domain=DOMAIN): if ex.response["error"] == "invalid_auth": return "invalid_auth", None return "cannot_connect", None - except Exception: # pylint:disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return "unknown", None return None, info diff --git a/homeassistant/components/sma/config_flow.py b/homeassistant/components/sma/config_flow.py index dcf1084f161..3bfb66c4849 100644 --- a/homeassistant/components/sma/config_flow.py +++ b/homeassistant/components/sma/config_flow.py @@ -71,7 +71,7 @@ class SmaConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except pysma.exceptions.SmaReadException: errors["base"] = "cannot_retrieve_device_info" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/smart_meter_texas/config_flow.py b/homeassistant/components/smart_meter_texas/config_flow.py index f2fab31caaa..bbe1361b795 100644 --- a/homeassistant/components/smart_meter_texas/config_flow.py +++ b/homeassistant/components/smart_meter_texas/config_flow.py @@ -63,7 +63,7 @@ class SMTConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/smartthings/config_flow.py b/homeassistant/components/smartthings/config_flow.py index 85f350b8fb3..2ecc3375026 100644 --- a/homeassistant/components/smartthings/config_flow.py +++ b/homeassistant/components/smartthings/config_flow.py @@ -159,7 +159,7 @@ class SmartThingsFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "app_setup_error" _LOGGER.exception("Unexpected error setting up the SmartApp") return self._show_step_pat(errors) - except Exception: # pylint:disable=broad-except + except Exception: errors["base"] = "app_setup_error" _LOGGER.exception("Unexpected error setting up the SmartApp") return self._show_step_pat(errors) diff --git a/homeassistant/components/smartthings/smartapp.py b/homeassistant/components/smartthings/smartapp.py index 1c18a39b1e6..e2593dd7b10 100644 --- a/homeassistant/components/smartthings/smartapp.py +++ b/homeassistant/components/smartthings/smartapp.py @@ -326,7 +326,7 @@ async def smartapp_sync_subscriptions( _LOGGER.debug( "Created subscription for '%s' under app '%s'", target, installed_app_id ) - except Exception as error: # pylint:disable=broad-except + except Exception as error: # noqa: BLE001 _LOGGER.error( "Failed to create subscription for '%s' under app '%s': %s", target, @@ -345,7 +345,7 @@ async def smartapp_sync_subscriptions( sub.capability, installed_app_id, ) - except Exception as error: # pylint:disable=broad-except + except Exception as error: # noqa: BLE001 _LOGGER.error( "Failed to remove subscription for '%s' under app '%s': %s", sub.capability, diff --git a/homeassistant/components/sms/config_flow.py b/homeassistant/components/sms/config_flow.py index ff509bbbb97..aec9674da9d 100644 --- a/homeassistant/components/sms/config_flow.py +++ b/homeassistant/components/sms/config_flow.py @@ -66,7 +66,7 @@ class SMSFlowHandler(ConfigFlow, domain=DOMAIN): imei = await get_imei_from_config(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/snmp/sensor.py b/homeassistant/components/snmp/sensor.py index 972b9131935..939cb13ae35 100644 --- a/homeassistant/components/snmp/sensor.py +++ b/homeassistant/components/snmp/sensor.py @@ -289,8 +289,7 @@ class SnmpData: try: decoded_value, _ = decoder.decode(bytes(value)) return str(decoded_value) - # pylint: disable=broad-except - except Exception as decode_exception: + except Exception as decode_exception: # noqa: BLE001 _LOGGER.error( "SNMP error in decoding opaque type: %s", decode_exception ) diff --git a/homeassistant/components/solax/config_flow.py b/homeassistant/components/solax/config_flow.py index 4055f1c46ae..e6c60667869 100644 --- a/homeassistant/components/solax/config_flow.py +++ b/homeassistant/components/solax/config_flow.py @@ -56,7 +56,7 @@ class SolaxConfigFlow(ConfigFlow, domain=DOMAIN): serial_number = await validate_api(user_input) except (ConnectionError, DiscoveryError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/somfy_mylink/config_flow.py b/homeassistant/components/somfy_mylink/config_flow.py index 6e68be45dff..a13f036210d 100644 --- a/homeassistant/components/somfy_mylink/config_flow.py +++ b/homeassistant/components/somfy_mylink/config_flow.py @@ -95,7 +95,7 @@ class SomfyConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/sonarr/config_flow.py b/homeassistant/components/sonarr/config_flow.py index 9e84d040ad1..84bae85571e 100644 --- a/homeassistant/components/sonarr/config_flow.py +++ b/homeassistant/components/sonarr/config_flow.py @@ -109,7 +109,7 @@ class SonarrConfigFlow(ConfigFlow, domain=DOMAIN): errors = {"base": "invalid_auth"} except ArrException: errors = {"base": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") else: diff --git a/homeassistant/components/spotify/config_flow.py b/homeassistant/components/spotify/config_flow.py index 0c60959362d..58c7e612a35 100644 --- a/homeassistant/components/spotify/config_flow.py +++ b/homeassistant/components/spotify/config_flow.py @@ -40,7 +40,7 @@ class SpotifyFlowHandler( try: current_user = await self.hass.async_add_executor_job(spotify.current_user) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return self.async_abort(reason="connection_error") name = data["id"] = current_user["id"] diff --git a/homeassistant/components/squeezebox/config_flow.py b/homeassistant/components/squeezebox/config_flow.py index effa4f2c970..c793019d0da 100644 --- a/homeassistant/components/squeezebox/config_flow.py +++ b/homeassistant/components/squeezebox/config_flow.py @@ -122,7 +122,7 @@ class SqueezeboxConfigFlow(ConfigFlow, domain=DOMAIN): if server.http_status == HTTPStatus.UNAUTHORIZED: return "invalid_auth" return "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return "unknown" if "uuid" in status: diff --git a/homeassistant/components/srp_energy/config_flow.py b/homeassistant/components/srp_energy/config_flow.py index 8ec53a20cc8..a91b1f46b40 100644 --- a/homeassistant/components/srp_energy/config_flow.py +++ b/homeassistant/components/srp_energy/config_flow.py @@ -78,7 +78,7 @@ class SRPEnergyConfigFlow(ConfigFlow, domain=DOMAIN): except InvalidAuth: errors["base"] = "invalid_auth" return self._show_form(errors) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/ssdp/__init__.py b/homeassistant/components/ssdp/__init__.py index 1678daf4059..27d96d6ff09 100644 --- a/homeassistant/components/ssdp/__init__.py +++ b/homeassistant/components/ssdp/__init__.py @@ -234,7 +234,7 @@ def _async_process_callbacks( hass.async_run_hass_job( callback, discovery_info, ssdp_change, background=True ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Failed to callback info: %s", discovery_info) diff --git a/homeassistant/components/starline/account.py b/homeassistant/components/starline/account.py index d260ba3503e..6122ccbb3c2 100644 --- a/homeassistant/components/starline/account.py +++ b/homeassistant/components/starline/account.py @@ -74,7 +74,7 @@ class StarlineAccount: DATA_USER_ID: user_id, }, ) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.error("Error updating SLNet token: %s", err) def _update_data(self): diff --git a/homeassistant/components/starline/config_flow.py b/homeassistant/components/starline/config_flow.py index 402a94c46b0..c13586d0bc3 100644 --- a/homeassistant/components/starline/config_flow.py +++ b/homeassistant/components/starline/config_flow.py @@ -182,7 +182,7 @@ class StarlineFlowHandler(ConfigFlow, domain=DOMAIN): self._auth.get_app_token, self._app_id, self._app_secret, self._app_code ) return self._async_form_auth_user(error) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.error("Error auth StarLine: %s", err) return self._async_form_auth_app(ERROR_AUTH_APP) @@ -216,7 +216,7 @@ class StarlineFlowHandler(ConfigFlow, domain=DOMAIN): # pylint: disable=broad-exception-raised raise Exception(data) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.error("Error auth user: %s", err) return self._async_form_auth_user(ERROR_AUTH_USER) diff --git a/homeassistant/components/steam_online/config_flow.py b/homeassistant/components/steam_online/config_flow.py index bd38e79b133..3f10b17d805 100644 --- a/homeassistant/components/steam_online/config_flow.py +++ b/homeassistant/components/steam_online/config_flow.py @@ -66,7 +66,7 @@ class SteamFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" if "403" in str(ex): errors["base"] = "invalid_auth" - except Exception as ex: # pylint:disable=broad-except + except Exception as ex: # noqa: BLE001 LOGGER.exception("Unknown exception: %s", ex) errors["base"] = "unknown" if not errors: diff --git a/homeassistant/components/steamist/config_flow.py b/homeassistant/components/steamist/config_flow.py index 9d2fa5c6c42..b5cb6527fa3 100644 --- a/homeassistant/components/steamist/config_flow.py +++ b/homeassistant/components/steamist/config_flow.py @@ -168,7 +168,7 @@ class SteamistConfigFlow(ConfigFlow, domain=DOMAIN): await Steamist(host, websession).async_get_status() except CONNECTION_EXCEPTIONS: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/streamlabswater/config_flow.py b/homeassistant/components/streamlabswater/config_flow.py index 327e5dcdae3..99352082d68 100644 --- a/homeassistant/components/streamlabswater/config_flow.py +++ b/homeassistant/components/streamlabswater/config_flow.py @@ -41,7 +41,7 @@ class StreamlabsConfigFlow(ConfigFlow, domain=DOMAIN): await validate_input(self.hass, user_input[CONF_API_KEY]) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -64,7 +64,7 @@ class StreamlabsConfigFlow(ConfigFlow, domain=DOMAIN): await validate_input(self.hass, user_input[CONF_API_KEY]) except CannotConnect: return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/stt/legacy.py b/homeassistant/components/stt/legacy.py index 997835ef9f8..7bb0d84c289 100644 --- a/homeassistant/components/stt/legacy.py +++ b/homeassistant/components/stt/legacy.py @@ -86,7 +86,7 @@ def async_setup_legacy( provider.hass = hass providers[provider.name] = provider - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error setting up platform: %s", p_type) return diff --git a/homeassistant/components/suez_water/config_flow.py b/homeassistant/components/suez_water/config_flow.py index f3bfda91c3c..833981d8ed6 100644 --- a/homeassistant/components/suez_water/config_flow.py +++ b/homeassistant/components/suez_water/config_flow.py @@ -63,7 +63,7 @@ class SuezWaterConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -85,7 +85,7 @@ class SuezWaterConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="cannot_connect") except InvalidAuth: return self.async_abort(reason="invalid_auth") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") return self.async_create_entry(title=user_input[CONF_USERNAME], data=user_input) diff --git a/homeassistant/components/surepetcare/config_flow.py b/homeassistant/components/surepetcare/config_flow.py index dc11631de81..6626b1d6dee 100644 --- a/homeassistant/components/surepetcare/config_flow.py +++ b/homeassistant/components/surepetcare/config_flow.py @@ -66,7 +66,7 @@ class SurePetCareConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except SurePetcareError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -103,7 +103,7 @@ class SurePetCareConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except SurePetcareError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/swiss_public_transport/config_flow.py b/homeassistant/components/swiss_public_transport/config_flow.py index 6c5de3c7883..5687e968318 100644 --- a/homeassistant/components/swiss_public_transport/config_flow.py +++ b/homeassistant/components/swiss_public_transport/config_flow.py @@ -54,7 +54,7 @@ class SwissPublicTransportConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except OpendataTransportError: errors["base"] = "bad_config" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unknown error") errors["base"] = "unknown" else: @@ -87,7 +87,7 @@ class SwissPublicTransportConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="cannot_connect") except OpendataTransportError: return self.async_abort(reason="bad_config") - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.error( "Unknown error raised by python-opendata-transport for '%s %s', check at http://transport.opendata.ch/examples/stationboard.html if your station names and your parameters are valid", import_input[CONF_START], diff --git a/homeassistant/components/switchbee/config_flow.py b/homeassistant/components/switchbee/config_flow.py index 9b5139340b1..c8d3d58ee09 100644 --- a/homeassistant/components/switchbee/config_flow.py +++ b/homeassistant/components/switchbee/config_flow.py @@ -75,7 +75,7 @@ class SwitchBeeConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/switchbot_cloud/config_flow.py b/homeassistant/components/switchbot_cloud/config_flow.py index c01699b8c5d..eafe823bc0b 100644 --- a/homeassistant/components/switchbot_cloud/config_flow.py +++ b/homeassistant/components/switchbot_cloud/config_flow.py @@ -40,7 +40,7 @@ class SwitchBotCloudConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/system_bridge/config_flow.py b/homeassistant/components/system_bridge/config_flow.py index ff24a2c730f..ab1eeb09611 100644 --- a/homeassistant/components/system_bridge/config_flow.py +++ b/homeassistant/components/system_bridge/config_flow.py @@ -115,7 +115,7 @@ async def _async_get_info( errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/system_health/__init__.py b/homeassistant/components/system_health/__init__.py index bb050d5052e..ca1d4026ea9 100644 --- a/homeassistant/components/system_health/__init__.py +++ b/homeassistant/components/system_health/__init__.py @@ -89,7 +89,7 @@ async def get_integration_info( data = await registration.info_callback(hass) except TimeoutError: data = {"error": {"type": "failed", "error": "timeout"}} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error fetching info") data = {"error": {"type": "failed", "error": "unknown"}} diff --git a/homeassistant/components/system_log/__init__.py b/homeassistant/components/system_log/__init__.py index c99048ef65a..369ca283495 100644 --- a/homeassistant/components/system_log/__init__.py +++ b/homeassistant/components/system_log/__init__.py @@ -152,10 +152,10 @@ def _safe_get_message(record: logging.LogRecord) -> str: """ try: return record.getMessage() - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 try: return f"Bad logger message: {record.msg} ({record.args})" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return f"Bad logger message: {ex}" diff --git a/homeassistant/components/tado/config_flow.py b/homeassistant/components/tado/config_flow.py index 2074b62b8d0..38110f6749e 100644 --- a/homeassistant/components/tado/config_flow.py +++ b/homeassistant/components/tado/config_flow.py @@ -89,7 +89,7 @@ class TadoConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except NoHomes: errors["base"] = "no_homes" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/tailwind/config_flow.py b/homeassistant/components/tailwind/config_flow.py index 7204e9c9202..1cb94625266 100644 --- a/homeassistant/components/tailwind/config_flow.py +++ b/homeassistant/components/tailwind/config_flow.py @@ -61,7 +61,7 @@ class TailwindFlowHandler(ConfigFlow, domain=DOMAIN): errors[CONF_TOKEN] = "invalid_auth" except TailwindConnectionError: errors[CONF_HOST] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -127,7 +127,7 @@ class TailwindFlowHandler(ConfigFlow, domain=DOMAIN): errors[CONF_TOKEN] = "invalid_auth" except TailwindConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" @@ -167,7 +167,7 @@ class TailwindFlowHandler(ConfigFlow, domain=DOMAIN): errors[CONF_TOKEN] = "invalid_auth" except TailwindConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/tami4/config_flow.py b/homeassistant/components/tami4/config_flow.py index 3f70d0a99ca..83d426f47de 100644 --- a/homeassistant/components/tami4/config_flow.py +++ b/homeassistant/components/tami4/config_flow.py @@ -50,7 +50,7 @@ class Tami4ConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_phone" except exceptions.Tami4EdgeAPIException: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -78,7 +78,7 @@ class Tami4ConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except exceptions.Tami4EdgeAPIException: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py index f672ae1547f..4c1eb8ff795 100644 --- a/homeassistant/components/telegram_bot/__init__.py +++ b/homeassistant/components/telegram_bot/__init__.py @@ -379,7 +379,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: _LOGGER.error("Failed to initialize Telegram bot %s", p_type) return False - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error setting up platform %s", p_type) return False diff --git a/homeassistant/components/tellduslive/config_flow.py b/homeassistant/components/tellduslive/config_flow.py index 4537abcdece..6f1318ca61e 100644 --- a/homeassistant/components/tellduslive/config_flow.py +++ b/homeassistant/components/tellduslive/config_flow.py @@ -97,7 +97,7 @@ class FlowHandler(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="unknown_authorize_url_generation") except TimeoutError: return self.async_abort(reason="authorize_url_timeout") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error generating auth url") return self.async_abort(reason="unknown_authorize_url_generation") diff --git a/homeassistant/components/template/template_entity.py b/homeassistant/components/template/template_entity.py index c95543eeb60..bed9ead7922 100644 --- a/homeassistant/components/template/template_entity.py +++ b/homeassistant/components/template/template_entity.py @@ -438,7 +438,7 @@ class TemplateEntity(Entity): try: calculated_state = self._async_calculate_state() validate_state(calculated_state.state) - except Exception as err: # pylint: disable=broad-exception-caught + except Exception as err: # noqa: BLE001 self._preview_callback(None, None, None, str(err)) else: assert self._template_result_info @@ -534,7 +534,7 @@ class TemplateEntity(Entity): self._async_setup_templates() try: self._async_template_startup(None, log_template_error) - except Exception as err: # pylint: disable=broad-exception-caught + except Exception as err: # noqa: BLE001 preview_callback(None, None, None, str(err)) return self._call_on_remove_callbacks diff --git a/homeassistant/components/tesla_wall_connector/config_flow.py b/homeassistant/components/tesla_wall_connector/config_flow.py index 44848cb1dfe..8390b26b182 100644 --- a/homeassistant/components/tesla_wall_connector/config_flow.py +++ b/homeassistant/components/tesla_wall_connector/config_flow.py @@ -104,7 +104,7 @@ class TeslaWallConnectorConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except WallConnectorError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/todoist/config_flow.py b/homeassistant/components/todoist/config_flow.py index 745f1775e87..2d17cf9e7d4 100644 --- a/homeassistant/components/todoist/config_flow.py +++ b/homeassistant/components/todoist/config_flow.py @@ -46,7 +46,7 @@ class TodoistConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_api_key" else: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/tomorrowio/config_flow.py b/homeassistant/components/tomorrowio/config_flow.py index 1a8cd328045..90bb488a7c2 100644 --- a/homeassistant/components/tomorrowio/config_flow.py +++ b/homeassistant/components/tomorrowio/config_flow.py @@ -160,7 +160,7 @@ class TomorrowioConfigFlow(ConfigFlow, domain=DOMAIN): errors[CONF_API_KEY] = "invalid_api_key" except RateLimitedException: errors[CONF_API_KEY] = "rate_limited" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/tplink_omada/config_flow.py b/homeassistant/components/tplink_omada/config_flow.py index 4666968924d..5ea56a9ad9f 100644 --- a/homeassistant/components/tplink_omada/config_flow.py +++ b/homeassistant/components/tplink_omada/config_flow.py @@ -218,7 +218,7 @@ class TpLinkOmadaConfigFlow(ConfigFlow, domain=DOMAIN): except OmadaClientException as ex: _LOGGER.error("Unexpected API error: %s", ex) errors["base"] = "unknown" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return None diff --git a/homeassistant/components/traccar_server/config_flow.py b/homeassistant/components/traccar_server/config_flow.py index 678bcc461e7..45a43c08685 100644 --- a/homeassistant/components/traccar_server/config_flow.py +++ b/homeassistant/components/traccar_server/config_flow.py @@ -146,7 +146,7 @@ class TraccarServerConfigFlow(ConfigFlow, domain=DOMAIN): except TraccarException as exception: LOGGER.error("Unable to connect to Traccar Server: %s", exception) errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/trace/__init__.py b/homeassistant/components/trace/__init__.py index 03b1845d6a8..6193f06ff4f 100644 --- a/homeassistant/components/trace/__init__.py +++ b/homeassistant/components/trace/__init__.py @@ -185,7 +185,7 @@ async def async_restore_traces(hass: HomeAssistant) -> None: try: trace = RestoredTrace(json_trace) # Catch any exception to not blow up if the stored trace is invalid - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Failed to restore trace") continue _async_store_restored_trace(hass, trace) diff --git a/homeassistant/components/tractive/config_flow.py b/homeassistant/components/tractive/config_flow.py index a6b0d43a2b7..5859a0c719e 100644 --- a/homeassistant/components/tractive/config_flow.py +++ b/homeassistant/components/tractive/config_flow.py @@ -58,7 +58,7 @@ class TractiveConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -88,7 +88,7 @@ class TractiveConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/trafikverket_camera/__init__.py b/homeassistant/components/trafikverket_camera/__init__.py index 3186e803087..938bfce2318 100644 --- a/homeassistant/components/trafikverket_camera/__init__.py +++ b/homeassistant/components/trafikverket_camera/__init__.py @@ -50,7 +50,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: try: camera_info = await camera_api.async_get_camera(location) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.error( "Could not migrate the config entry. No connection to the api" ) @@ -76,7 +76,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: try: camera_info = await camera_api.async_get_camera(location) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.error( "Could not migrate the config entry. No connection to the api" ) diff --git a/homeassistant/components/trafikverket_ferry/config_flow.py b/homeassistant/components/trafikverket_ferry/config_flow.py index 3b79cc0f0bd..17ba9196758 100644 --- a/homeassistant/components/trafikverket_ferry/config_flow.py +++ b/homeassistant/components/trafikverket_ferry/config_flow.py @@ -85,7 +85,7 @@ class TVFerryConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except NoFerryFound: errors["base"] = "invalid_route" - except Exception: # pylint: disable=broad-exception-caught + except Exception: # noqa: BLE001 errors["base"] = "cannot_connect" else: self.hass.config_entries.async_update_entry( @@ -129,7 +129,7 @@ class TVFerryConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except NoFerryFound: errors["base"] = "invalid_route" - except Exception: # pylint: disable=broad-exception-caught + except Exception: # noqa: BLE001 errors["base"] = "cannot_connect" else: if not errors: diff --git a/homeassistant/components/trafikverket_train/config_flow.py b/homeassistant/components/trafikverket_train/config_flow.py index 48e603eff02..6795a566246 100644 --- a/homeassistant/components/trafikverket_train/config_flow.py +++ b/homeassistant/components/trafikverket_train/config_flow.py @@ -114,7 +114,7 @@ async def validate_input( except UnknownError as error: _LOGGER.error("Unknown error occurred during validation %s", str(error)) errors["base"] = "cannot_connect" - except Exception as error: # pylint: disable=broad-exception-caught + except Exception as error: # noqa: BLE001 _LOGGER.error("Unknown exception occurred during validation %s", str(error)) errors["base"] = "cannot_connect" diff --git a/homeassistant/components/trafikverket_weatherstation/config_flow.py b/homeassistant/components/trafikverket_weatherstation/config_flow.py index 05be4fc460e..cf7ca905acb 100644 --- a/homeassistant/components/trafikverket_weatherstation/config_flow.py +++ b/homeassistant/components/trafikverket_weatherstation/config_flow.py @@ -53,7 +53,7 @@ class TVWeatherConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_station" except MultipleWeatherStationsFound: errors["base"] = "more_stations" - except Exception: # pylint: disable=broad-exception-caught + except Exception: # noqa: BLE001 errors["base"] = "cannot_connect" else: return self.async_create_entry( @@ -102,7 +102,7 @@ class TVWeatherConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_station" except MultipleWeatherStationsFound: errors["base"] = "more_stations" - except Exception: # pylint: disable=broad-exception-caught + except Exception: # noqa: BLE001 errors["base"] = "cannot_connect" else: self.hass.config_entries.async_update_entry( diff --git a/homeassistant/components/tts/legacy.py b/homeassistant/components/tts/legacy.py index 88249ed107b..e36a1227603 100644 --- a/homeassistant/components/tts/legacy.py +++ b/homeassistant/components/tts/legacy.py @@ -148,7 +148,7 @@ async def async_setup_legacy( return tts.async_register_legacy_engine(p_type, provider, p_config) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error setting up platform: %s", p_type) return diff --git a/homeassistant/components/upb/config_flow.py b/homeassistant/components/upb/config_flow.py index 18a427a40bd..1db0b0b6fe3 100644 --- a/homeassistant/components/upb/config_flow.py +++ b/homeassistant/components/upb/config_flow.py @@ -93,7 +93,7 @@ class UPBConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidUpbFile: errors["base"] = "invalid_upb_file" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/uptimerobot/config_flow.py b/homeassistant/components/uptimerobot/config_flow.py index feb747c6b9e..ffe3c3e4563 100644 --- a/homeassistant/components/uptimerobot/config_flow.py +++ b/homeassistant/components/uptimerobot/config_flow.py @@ -50,7 +50,7 @@ class UptimeRobotConfigFlow(ConfigFlow, domain=DOMAIN): except UptimeRobotException as exception: LOGGER.error(exception) errors["base"] = "cannot_connect" - except Exception as exception: # pylint: disable=broad-except + except Exception as exception: # noqa: BLE001 LOGGER.exception(exception) errors["base"] = "unknown" else: diff --git a/homeassistant/components/v2c/config_flow.py b/homeassistant/components/v2c/config_flow.py index 4d798795cbe..7a08c34834e 100644 --- a/homeassistant/components/v2c/config_flow.py +++ b/homeassistant/components/v2c/config_flow.py @@ -44,7 +44,7 @@ class V2CConfigFlow(ConfigFlow, domain=DOMAIN): await evse.get_data() except TrydanError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/vallox/config_flow.py b/homeassistant/components/vallox/config_flow.py index 4812097d4e0..86253838879 100644 --- a/homeassistant/components/vallox/config_flow.py +++ b/homeassistant/components/vallox/config_flow.py @@ -62,7 +62,7 @@ class ValloxConfigFlow(ConfigFlow, domain=DOMAIN): errors[CONF_HOST] = "invalid_host" except ValloxApiException: errors[CONF_HOST] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors[CONF_HOST] = "unknown" else: diff --git a/homeassistant/components/velux/config_flow.py b/homeassistant/components/velux/config_flow.py index 679af4bd20a..c0d4ec8035b 100644 --- a/homeassistant/components/velux/config_flow.py +++ b/homeassistant/components/velux/config_flow.py @@ -67,7 +67,7 @@ class VeluxConfigFlow(ConfigFlow, domain=DOMAIN): except (PyVLXException, ConnectionError): create_repair("cannot_connect") return self.async_abort(reason="cannot_connect") - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 create_repair("unknown") return self.async_abort(reason="unknown") @@ -95,7 +95,7 @@ class VeluxConfigFlow(ConfigFlow, domain=DOMAIN): except (PyVLXException, ConnectionError) as err: errors["base"] = "cannot_connect" LOGGER.debug("Cannot connect: %s", err) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.exception("Unexpected exception: %s", err) errors["base"] = "unknown" else: diff --git a/homeassistant/components/venstar/config_flow.py b/homeassistant/components/venstar/config_flow.py index 5a193568c87..289f7936676 100644 --- a/homeassistant/components/venstar/config_flow.py +++ b/homeassistant/components/venstar/config_flow.py @@ -65,7 +65,7 @@ class VenstarConfigFlow(ConfigFlow, domain=DOMAIN): title = await validate_input(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/vilfo/config_flow.py b/homeassistant/components/vilfo/config_flow.py index 47e45aecadd..b21c63bfb97 100644 --- a/homeassistant/components/vilfo/config_flow.py +++ b/homeassistant/components/vilfo/config_flow.py @@ -111,7 +111,7 @@ class DomainConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.error("Unexpected exception: %s", err) errors["base"] = "unknown" else: diff --git a/homeassistant/components/vlc_telnet/config_flow.py b/homeassistant/components/vlc_telnet/config_flow.py index 67325686282..6ccb92e5b8b 100644 --- a/homeassistant/components/vlc_telnet/config_flow.py +++ b/homeassistant/components/vlc_telnet/config_flow.py @@ -94,7 +94,7 @@ class VLCTelnetConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -127,7 +127,7 @@ class VLCTelnetConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -180,7 +180,7 @@ class VLCTelnetConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="cannot_connect") except InvalidAuth: return self.async_abort(reason="invalid_auth") - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/vodafone_station/config_flow.py b/homeassistant/components/vodafone_station/config_flow.py index ed7f63b6c39..6b6adb6a18d 100644 --- a/homeassistant/components/vodafone_station/config_flow.py +++ b/homeassistant/components/vodafone_station/config_flow.py @@ -92,7 +92,7 @@ class VodafoneStationConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except aiovodafone_exceptions.ModelNotSupported: errors["base"] = "model_not_supported" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -127,7 +127,7 @@ class VodafoneStationConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except aiovodafone_exceptions.CannotAuthenticate: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/volumio/config_flow.py b/homeassistant/components/volumio/config_flow.py index e86fcd4417d..8edda1d20b0 100644 --- a/homeassistant/components/volumio/config_flow.py +++ b/homeassistant/components/volumio/config_flow.py @@ -79,7 +79,7 @@ class VolumioConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, self._host, self._port) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" diff --git a/homeassistant/components/volvooncall/config_flow.py b/homeassistant/components/volvooncall/config_flow.py index 1cb434e49bc..80358a28ced 100644 --- a/homeassistant/components/volvooncall/config_flow.py +++ b/homeassistant/components/volvooncall/config_flow.py @@ -60,7 +60,7 @@ class VolvoOnCallConfigFlow(ConfigFlow, domain=DOMAIN): await self.is_valid(user_input) except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unhandled exception in user step") errors["base"] = "unknown" if not errors: diff --git a/homeassistant/components/vulcan/config_flow.py b/homeassistant/components/vulcan/config_flow.py index ae44c507c6a..560d777b517 100644 --- a/homeassistant/components/vulcan/config_flow.py +++ b/homeassistant/components/vulcan/config_flow.py @@ -73,7 +73,7 @@ class VulcanFlowHandler(ConfigFlow, domain=DOMAIN): except ClientConnectionError as err: errors = {"base": "cannot_connect"} _LOGGER.error("Connection error: %s", err) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors = {"base": "unknown"} if not errors: @@ -156,7 +156,7 @@ class VulcanFlowHandler(ConfigFlow, domain=DOMAIN): return await self.async_step_select_saved_credentials( errors={"base": "cannot_connect"} ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") return await self.async_step_auth(errors={"base": "unknown"}) if len(students) == 1: @@ -268,7 +268,7 @@ class VulcanFlowHandler(ConfigFlow, domain=DOMAIN): except ClientConnectionError as err: errors["base"] = "cannot_connect" _LOGGER.error("Connection error: %s", err) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" if not errors: diff --git a/homeassistant/components/waqi/config_flow.py b/homeassistant/components/waqi/config_flow.py index e7e7a536654..51ba801c92e 100644 --- a/homeassistant/components/waqi/config_flow.py +++ b/homeassistant/components/waqi/config_flow.py @@ -45,7 +45,7 @@ async def get_by_station_number( measuring_station = await client.get_by_station_number(station_number) except WAQIConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return measuring_station, errors @@ -76,7 +76,7 @@ class WAQIConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except WAQIConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -118,7 +118,7 @@ class WAQIConfigFlow(ConfigFlow, domain=DOMAIN): ) except WAQIConnectionError: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/watttime/config_flow.py b/homeassistant/components/watttime/config_flow.py index 549f6fc7679..db68738b302 100644 --- a/homeassistant/components/watttime/config_flow.py +++ b/homeassistant/components/watttime/config_flow.py @@ -97,7 +97,7 @@ class WattTimeConfigFlow(ConfigFlow, domain=DOMAIN): errors={"base": "invalid_auth"}, description_placeholders={CONF_USERNAME: username}, ) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.exception("Unexpected exception while logging in: %s", err) return self.async_show_form( step_id=error_step_id, @@ -156,7 +156,7 @@ class WattTimeConfigFlow(ConfigFlow, domain=DOMAIN): data_schema=STEP_COORDINATES_DATA_SCHEMA, errors={CONF_LATITUDE: "unknown_coordinates"}, ) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 LOGGER.exception("Unexpected exception while getting region: %s", err) return self.async_show_form( step_id="coordinates", diff --git a/homeassistant/components/webhook/__init__.py b/homeassistant/components/webhook/__init__.py index 0076c85e268..04234b2ac42 100644 --- a/homeassistant/components/webhook/__init__.py +++ b/homeassistant/components/webhook/__init__.py @@ -178,7 +178,7 @@ async def async_handle_webhook( response: Response | None = await webhook["handler"](hass, webhook_id, request) if response is None: response = Response(status=HTTPStatus.OK) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error processing webhook %s", webhook_id) return Response(status=HTTPStatus.OK) return response diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index 0f52685ca2d..fb540183df4 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -300,7 +300,7 @@ async def handle_call_service( translation_key=err.translation_key, translation_placeholders=err.translation_placeholders, ) - except Exception as err: # pylint: disable=broad-except + except Exception as err: connection.logger.exception("Unexpected exception") connection.send_error(msg["id"], const.ERR_UNKNOWN_ERROR, str(err)) diff --git a/homeassistant/components/websocket_api/connection.py b/homeassistant/components/websocket_api/connection.py index 3c0743601dd..bd2eb9ff59c 100644 --- a/homeassistant/components/websocket_api/connection.py +++ b/homeassistant/components/websocket_api/connection.py @@ -171,7 +171,7 @@ class ActiveConnection: try: handler(self.hass, self, payload) - except Exception: # pylint: disable=broad-except + except Exception: self.logger.exception("Error handling binary message") self.binary_handlers[index] = None @@ -227,7 +227,7 @@ class ActiveConnection: handler(self.hass, self, msg) else: handler(self.hass, self, schema(msg)) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 self.async_handle_exception(msg, err) self.last_id = cur_id @@ -238,7 +238,7 @@ class ActiveConnection: for unsub in self.subscriptions.values(): try: unsub() - except Exception: # pylint: disable=broad-except + except Exception: # If one fails, make sure we still try the rest self.logger.exception( "Error unsubscribing from subscription: %s", unsub diff --git a/homeassistant/components/websocket_api/decorators.py b/homeassistant/components/websocket_api/decorators.py index cd977e1767f..71ababbc236 100644 --- a/homeassistant/components/websocket_api/decorators.py +++ b/homeassistant/components/websocket_api/decorators.py @@ -25,7 +25,7 @@ async def _handle_async_response( """Create a response and handle exception.""" try: await func(hass, connection, msg) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 connection.async_handle_exception(msg, err) diff --git a/homeassistant/components/websocket_api/http.py b/homeassistant/components/websocket_api/http.py index f4543f943a9..ef5b010171a 100644 --- a/homeassistant/components/websocket_api/http.py +++ b/homeassistant/components/websocket_api/http.py @@ -426,7 +426,7 @@ class WebSocketHandler: except Disconnect as ex: debug("%s: Connection closed by client: %s", self.description, ex) - except Exception: # pylint: disable=broad-except + except Exception: self._logger.exception( "%s: Unexpected error inside websocket API", self.description ) diff --git a/homeassistant/components/wemo/wemo_device.py b/homeassistant/components/wemo/wemo_device.py index 7326e0b42f5..8b99203e280 100644 --- a/homeassistant/components/wemo/wemo_device.py +++ b/homeassistant/components/wemo/wemo_device.py @@ -210,7 +210,7 @@ class DeviceCoordinator(DataUpdateCoordinator[None]): # pylint: disable=hass-en if self.last_update_success: _LOGGER.exception("Subscription callback failed") self.last_update_success = False - except Exception as err: # pylint: disable=broad-except + except Exception as err: self.last_exception = err self.last_update_success = False _LOGGER.exception("Unexpected error fetching %s data", self.name) diff --git a/homeassistant/components/whirlpool/config_flow.py b/homeassistant/components/whirlpool/config_flow.py index 5e1cb102d77..13bfd121c63 100644 --- a/homeassistant/components/whirlpool/config_flow.py +++ b/homeassistant/components/whirlpool/config_flow.py @@ -127,7 +127,7 @@ class WhirlpoolConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except NoAppliances: errors["base"] = "no_appliances" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/wirelesstag/__init__.py b/homeassistant/components/wirelesstag/__init__.py index 78d22bb79d9..710255153c2 100644 --- a/homeassistant/components/wirelesstag/__init__.py +++ b/homeassistant/components/wirelesstag/__init__.py @@ -119,7 +119,7 @@ class WirelessTagPlatform: ), tag, ) - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 _LOGGER.error( "Unable to handle tag update: %s error: %s", str(tag), diff --git a/homeassistant/components/wiz/config_flow.py b/homeassistant/components/wiz/config_flow.py index 3220856b89d..71bc0a9aaa8 100644 --- a/homeassistant/components/wiz/config_flow.py +++ b/homeassistant/components/wiz/config_flow.py @@ -168,7 +168,7 @@ class WizConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except WizLightConnectionError: errors["base"] = "no_wiz_light" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/wolflink/config_flow.py b/homeassistant/components/wolflink/config_flow.py index bfa66648b4b..6e218bfd1ce 100644 --- a/homeassistant/components/wolflink/config_flow.py +++ b/homeassistant/components/wolflink/config_flow.py @@ -43,7 +43,7 @@ class WolfLinkConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/workday/repairs.py b/homeassistant/components/workday/repairs.py index 1221514da42..5f05cb1ffbd 100644 --- a/homeassistant/components/workday/repairs.py +++ b/homeassistant/components/workday/repairs.py @@ -139,7 +139,7 @@ class HolidayFixFlow(RepairsFlow): await self.hass.async_add_executor_job( validate_custom_dates, new_options ) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 errors["remove_holidays"] = "remove_holiday_error" else: self.hass.config_entries.async_update_entry( diff --git a/homeassistant/components/ws66i/config_flow.py b/homeassistant/components/ws66i/config_flow.py index 0cf0b557f35..b0cf6717e4d 100644 --- a/homeassistant/components/ws66i/config_flow.py +++ b/homeassistant/components/ws66i/config_flow.py @@ -102,7 +102,7 @@ class WS66iConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except CannotConnect: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/wyoming/satellite.py b/homeassistant/components/wyoming/satellite.py index 9569c420a1e..b2f92f765c0 100644 --- a/homeassistant/components/wyoming/satellite.py +++ b/homeassistant/components/wyoming/satellite.py @@ -88,7 +88,7 @@ class WyomingSatellite: await self._connect_and_loop() except asyncio.CancelledError: raise # don't restart - except Exception as err: # pylint: disable=broad-exception-caught + except Exception as err: # noqa: BLE001 _LOGGER.debug("%s: %s", err.__class__.__name__, str(err)) # Ensure sensor is off (before restart) diff --git a/homeassistant/components/xiaomi_miio/config_flow.py b/homeassistant/components/xiaomi_miio/config_flow.py index e2a129e147d..c689ede27eb 100644 --- a/homeassistant/components/xiaomi_miio/config_flow.py +++ b/homeassistant/components/xiaomi_miio/config_flow.py @@ -243,7 +243,7 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "cloud_login_error" except MiCloudAccessDenied: errors["base"] = "cloud_login_error" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception in Miio cloud login") return self.async_abort(reason="unknown") @@ -256,7 +256,7 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN): devices_raw = await self.hass.async_add_executor_job( miio_cloud.get_devices, cloud_country ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception in Miio cloud get devices") return self.async_abort(reason="unknown") @@ -353,7 +353,7 @@ class XiaomiMiioFlowHandler(ConfigFlow, domain=DOMAIN): except SetupException: if self.model is None: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception in connect Xiaomi device") return self.async_abort(reason="unknown") diff --git a/homeassistant/components/yalexs_ble/config_flow.py b/homeassistant/components/yalexs_ble/config_flow.py index 3ec7f675d7a..c0df4e26821 100644 --- a/homeassistant/components/yalexs_ble/config_flow.py +++ b/homeassistant/components/yalexs_ble/config_flow.py @@ -57,7 +57,7 @@ async def async_validate_lock_or_error( return {CONF_KEY: "invalid_auth"} except BleakError: return {"base": "cannot_connect"} - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error") return {"base": "unknown"} return {} diff --git a/homeassistant/components/yamaha_musiccast/config_flow.py b/homeassistant/components/yamaha_musiccast/config_flow.py index 34d352b790e..a074f34c782 100644 --- a/homeassistant/components/yamaha_musiccast/config_flow.py +++ b/homeassistant/components/yamaha_musiccast/config_flow.py @@ -51,7 +51,7 @@ class MusicCastFlowHandler(ConfigFlow, domain=DOMAIN): ) except (MusicCastConnectionException, ClientConnectorError): errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/yardian/config_flow.py b/homeassistant/components/yardian/config_flow.py index e23ca536d4e..0a947537db0 100644 --- a/homeassistant/components/yardian/config_flow.py +++ b/homeassistant/components/yardian/config_flow.py @@ -57,7 +57,7 @@ class YardianConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except NetworkException: errors["base"] = "cannot_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/youtube/config_flow.py b/homeassistant/components/youtube/config_flow.py index 025ed8780e6..32b37b93eb2 100644 --- a/homeassistant/components/youtube/config_flow.py +++ b/homeassistant/components/youtube/config_flow.py @@ -111,7 +111,7 @@ class OAuth2FlowHandler( reason="access_not_configured", description_placeholders={"message": error}, ) - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 LOGGER.error("Unknown error occurred: %s", ex.args) return self.async_abort(reason="unknown") self._title = own_channel.snippet.title diff --git a/homeassistant/components/zeversolar/config_flow.py b/homeassistant/components/zeversolar/config_flow.py index e4deae47c8f..1f2357c224f 100644 --- a/homeassistant/components/zeversolar/config_flow.py +++ b/homeassistant/components/zeversolar/config_flow.py @@ -48,7 +48,7 @@ class ZeverSolarConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except zeversolar.ZeverSolarTimeout: errors["base"] = "timeout_connect" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/components/zha/core/device.py b/homeassistant/components/zha/core/device.py index e2c725ee529..163674d614c 100644 --- a/homeassistant/components/zha/core/device.py +++ b/homeassistant/components/zha/core/device.py @@ -619,7 +619,7 @@ class ZHADevice(LogMixin): for endpoint in self._endpoints.values(): try: await endpoint.async_initialize(from_cache) - except Exception: # pylint: disable=broad-exception-caught + except Exception: # noqa: BLE001 self.debug("Failed to initialize endpoint", exc_info=True) self.debug("power source: %s", self.power_source) diff --git a/homeassistant/components/zha/core/helpers.py b/homeassistant/components/zha/core/helpers.py index 3f8090f4080..a47d8ec8bf0 100644 --- a/homeassistant/components/zha/core/helpers.py +++ b/homeassistant/components/zha/core/helpers.py @@ -98,7 +98,7 @@ async def safe_read( only_cache=only_cache, manufacturer=manufacturer, ) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 return {} return result diff --git a/homeassistant/components/zha/repairs/wrong_silabs_firmware.py b/homeassistant/components/zha/repairs/wrong_silabs_firmware.py index 4ee10c7bb93..3cd22c99ec7 100644 --- a/homeassistant/components/zha/repairs/wrong_silabs_firmware.py +++ b/homeassistant/components/zha/repairs/wrong_silabs_firmware.py @@ -85,7 +85,7 @@ async def probe_silabs_firmware_type( try: await flasher.probe_app_type() - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 _LOGGER.debug("Failed to probe application type", exc_info=True) return flasher.app_type diff --git a/homeassistant/components/zwave_js/__init__.py b/homeassistant/components/zwave_js/__init__.py index 090a5ecfdf8..13238cc0a6c 100644 --- a/homeassistant/components/zwave_js/__init__.py +++ b/homeassistant/components/zwave_js/__init__.py @@ -921,7 +921,7 @@ async def client_listen( should_reload = False except BaseZwaveJSServerError as err: LOGGER.error("Failed to listen: %s", err) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 # We need to guard against unknown exceptions to not crash this task. LOGGER.exception("Unexpected exception: %s", err) diff --git a/homeassistant/components/zwave_js/config_flow.py b/homeassistant/components/zwave_js/config_flow.py index 3470f64f79f..069d9f6d003 100644 --- a/homeassistant/components/zwave_js/config_flow.py +++ b/homeassistant/components/zwave_js/config_flow.py @@ -477,7 +477,7 @@ class ZWaveJSConfigFlow(BaseZwaveJSFlow, ConfigFlow, domain=DOMAIN): version_info = await validate_input(self.hass, user_input) except InvalidInput as err: errors["base"] = err.error - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: @@ -743,7 +743,7 @@ class OptionsFlowHandler(BaseZwaveJSFlow, OptionsFlow): version_info = await validate_input(self.hass, user_input) except InvalidInput as err: errors["base"] = err.error - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/homeassistant/config.py b/homeassistant/config.py index abb29f6a1a1..96a8d2d8555 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -995,7 +995,7 @@ def _identify_config_schema(module: ComponentProtocol) -> str | None: key = next(k for k in schema if k == module.DOMAIN) except (TypeError, AttributeError, StopIteration): return None - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected error identifying config schema") return None @@ -1465,7 +1465,7 @@ async def _async_load_and_validate_platform_integration( p_integration.integration.documentation, ) config_exceptions.append(exc_info) - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: # noqa: BLE001 exc_info = ConfigExceptionInfo( exc, ConfigErrorTranslationKey.PLATFORM_SCHEMA_VALIDATOR_ERR, @@ -1549,7 +1549,7 @@ async def async_process_component_config( ) config_exceptions.append(exc_info) return IntegrationConfigInfo(None, config_exceptions) - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: # noqa: BLE001 exc_info = ConfigExceptionInfo( exc, ConfigErrorTranslationKey.CONFIG_VALIDATOR_UNKNOWN_ERR, @@ -1574,7 +1574,7 @@ async def async_process_component_config( ) config_exceptions.append(exc_info) return IntegrationConfigInfo(None, config_exceptions) - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: # noqa: BLE001 exc_info = ConfigExceptionInfo( exc, ConfigErrorTranslationKey.CONFIG_SCHEMA_UNKNOWN_ERR, @@ -1609,7 +1609,7 @@ async def async_process_component_config( ) config_exceptions.append(exc_info) continue - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: # noqa: BLE001 exc_info = ConfigExceptionInfo( exc, ConfigErrorTranslationKey.PLATFORM_SCHEMA_VALIDATOR_ERR, diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 40f55ec58f8..3741f6638b5 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -781,7 +781,7 @@ class ConfigEntry(Generic[_DataT]): self._async_set_state(hass, ConfigEntryState.NOT_LOADED, None) await self._async_process_on_unload(hass) - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: _LOGGER.exception( "Error unloading entry %s for %s", self.title, integration.domain ) @@ -812,7 +812,7 @@ class ConfigEntry(Generic[_DataT]): return try: await component.async_remove_entry(hass, self) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error calling entry remove callback %s for %s", self.title, @@ -888,7 +888,7 @@ class ConfigEntry(Generic[_DataT]): return False if result: hass.config_entries._async_schedule_save() # noqa: SLF001 - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error migrating entry %s for %s", self.title, self.domain ) diff --git a/homeassistant/core.py b/homeassistant/core.py index 5a75f0ce049..5635ca2e0a3 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -1203,7 +1203,7 @@ class HomeAssistant: _LOGGER.exception( "Task %s could not be canceled during final shutdown stage", task ) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Task %s error during final shutdown stage", task) # Prevent run_callback_threadsafe from scheduling any additional @@ -1542,7 +1542,7 @@ class EventBus: try: if event_data is None or not event_filter(event_data): continue - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error in event filter") continue @@ -1557,7 +1557,7 @@ class EventBus: try: self._hass.async_run_hass_job(job, event) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error running job: %s", job) def listen( @@ -2751,7 +2751,7 @@ class ServiceRegistry: ) except asyncio.CancelledError: _LOGGER.debug("Service was cancelled: %s", service_call) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error executing service: %s", service_call) async def _execute_service( diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 0bd494992b6..652f836e96a 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -501,7 +501,7 @@ class FlowManager(abc.ABC, Generic[_FlowResultT, _HandlerT]): flow.async_cancel_progress_task() try: flow.async_remove() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error removing %s flow", flow.handler) async def _async_handle_step( diff --git a/homeassistant/helpers/check_config.py b/homeassistant/helpers/check_config.py index 78dddb12381..0626e0033c4 100644 --- a/homeassistant/helpers/check_config.py +++ b/homeassistant/helpers/check_config.py @@ -220,7 +220,7 @@ async def async_check_ha_config_file( # noqa: C901 except (vol.Invalid, HomeAssistantError) as ex: _comp_error(ex, domain, config, config[domain]) continue - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 logging.getLogger(__name__).exception( "Unexpected error validating config" ) diff --git a/homeassistant/helpers/debounce.py b/homeassistant/helpers/debounce.py index de8f5eb4d53..18ee9a56225 100644 --- a/homeassistant/helpers/debounce.py +++ b/homeassistant/helpers/debounce.py @@ -138,7 +138,7 @@ class Debouncer(Generic[_R_co]): self._job, background=self._background ): await task - except Exception: # pylint: disable=broad-except + except Exception: self.logger.exception("Unexpected exception from %s", self.function) finally: # Schedule a new timer to prevent new runs during cooldown diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 3d6623a37f8..54fd1aafaeb 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -950,7 +950,7 @@ class Entity( if force_refresh: try: await self.async_device_update() - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Update for %s fails", self.entity_id) return elif not self._async_update_ha_state_reported: diff --git a/homeassistant/helpers/entity_platform.py b/homeassistant/helpers/entity_platform.py index 2b93bb7242c..6d55417c05e 100644 --- a/homeassistant/helpers/entity_platform.py +++ b/homeassistant/helpers/entity_platform.py @@ -407,7 +407,7 @@ class EntityPlatform: SLOW_SETUP_MAX_WAIT, ) return False - except Exception: # pylint: disable=broad-except + except Exception: logger.exception( "Error while setting up %s platform for %s", self.platform_name, @@ -429,7 +429,7 @@ class EntityPlatform: return await translation.async_get_translations( self.hass, language, category, {integration} ) - except Exception as err: # pylint: disable=broad-exception-caught + except Exception as err: # noqa: BLE001 _LOGGER.debug( "Could not load translations for %s", integration, @@ -579,7 +579,7 @@ class EntityPlatform: for idx, coro in enumerate(coros): try: await coro - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: entity = entities[idx] self.logger.exception( "Error adding entity %s for domain %s with platform %s", @@ -708,7 +708,7 @@ class EntityPlatform: if update_before_add: try: await entity.async_device_update(warning=False) - except Exception: # pylint: disable=broad-except + except Exception: self.logger.exception("%s: Error on device update!", self.platform_name) entity.add_to_platform_abort() return @@ -911,7 +911,7 @@ class EntityPlatform: for entity in list(self.entities.values()): try: await entity.async_remove() - except Exception: # pylint: disable=broad-except + except Exception: self.logger.exception( "Error while removing entity %s", entity.entity_id ) diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index 5c026064c28..ace819a2734 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -325,7 +325,7 @@ def _async_dispatch_entity_id_event( for job in callbacks_list.copy(): try: hass.async_run_hass_job(job, event) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error while dispatching event for %s to %s", event.data["entity_id"], @@ -455,7 +455,7 @@ def _async_dispatch_old_entity_id_or_entity_id_event( for job in callbacks_list.copy(): try: hass.async_run_hass_job(job, event) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error while dispatching event for %s to %s", event.data.get("old_entity_id", event.data["entity_id"]), @@ -523,7 +523,7 @@ def _async_dispatch_device_id_event( for job in callbacks_list.copy(): try: hass.async_run_hass_job(job, event) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error while dispatching event for %s to %s", event.data["device_id"], @@ -567,7 +567,7 @@ def _async_dispatch_domain_event( for job in callbacks.get(domain, []) + callbacks.get(MATCH_ALL, []): try: hass.async_run_hass_job(job, event) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception( "Error while processing event %s for domain %s", event, domain ) diff --git a/homeassistant/helpers/instance_id.py b/homeassistant/helpers/instance_id.py index 8bad8f90b9c..3c9790ad13d 100644 --- a/homeassistant/helpers/instance_id.py +++ b/homeassistant/helpers/instance_id.py @@ -29,7 +29,7 @@ async def async_get(hass: HomeAssistant) -> str: hass.config.path(LEGACY_UUID_FILE), store, ) - except Exception: # pylint: disable=broad-exception-caught + except Exception: _LOGGER.exception( ( "Could not read hass instance ID from '%s' or '%s', a new instance ID " diff --git a/homeassistant/helpers/intent.py b/homeassistant/helpers/intent.py index 119142ec14a..2a7d57dfd37 100644 --- a/homeassistant/helpers/intent.py +++ b/homeassistant/helpers/intent.py @@ -622,7 +622,7 @@ class DynamicServiceIntentHandler(IntentHandler): try: await service_coro success_results.append(target) - except Exception: # pylint: disable=broad-except + except Exception: failed_results.append(target) _LOGGER.exception("Service call failed for %s", state.entity_id) diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 8707711585a..c246597cb07 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -500,7 +500,7 @@ class _ScriptRun: handler = f"_async_{action}_step" try: await getattr(self, handler)() - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 self._handle_exception( ex, continue_on_error, self._log_exceptions or log_exceptions ) diff --git a/homeassistant/helpers/storage.py b/homeassistant/helpers/storage.py index 8c907dfa54a..1013115fd01 100644 --- a/homeassistant/helpers/storage.py +++ b/homeassistant/helpers/storage.py @@ -218,7 +218,7 @@ class _StoreManager: try: if storage_file.is_file(): data_preload[key] = json_util.load_json(storage_file) - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 _LOGGER.debug("Error loading %s: %s", key, ex) def _initialize_files(self) -> None: diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index d25f1e6eae8..9e4f116e546 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -666,7 +666,7 @@ class Template: _render_with_context(self.template, compiled, **kwargs) except TimeoutError: pass - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 self._exc_info = sys.exc_info() finally: self.hass.loop.call_soon_threadsafe(finish_event.set) diff --git a/homeassistant/helpers/update_coordinator.py b/homeassistant/helpers/update_coordinator.py index 17a690dfc37..ab635840b73 100644 --- a/homeassistant/helpers/update_coordinator.py +++ b/homeassistant/helpers/update_coordinator.py @@ -380,7 +380,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]): self.last_exception = err raise - except Exception as err: # pylint: disable=broad-except + except Exception as err: self.last_exception = err self.last_update_success = False self.logger.exception("Unexpected error fetching %s data", self.name) diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 716a1053f71..9ecb468a8a8 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -1296,7 +1296,7 @@ def _resolve_integrations_from_root( for domain in domains: try: integration = Integration.resolve_from_root(hass, root_module, domain) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error loading integration: %s", domain) else: if integration: diff --git a/homeassistant/requirements.py b/homeassistant/requirements.py index e29e0c34ece..c0e92610b6e 100644 --- a/homeassistant/requirements.py +++ b/homeassistant/requirements.py @@ -243,7 +243,7 @@ class RequirementsManager: or ex.domain not in integration.after_dependencies ): exceptions.append(ex) - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # noqa: BLE001 exceptions.insert(0, ex) if exceptions: diff --git a/homeassistant/scripts/check_config.py b/homeassistant/scripts/check_config.py index 843be7ef8a9..568e8c84a30 100644 --- a/homeassistant/scripts/check_config.py +++ b/homeassistant/scripts/check_config.py @@ -236,7 +236,7 @@ def check(config_dir, secrets=False): if err.config: res["warn"].setdefault(domain, []).append(err.config) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 print(color("red", "Fatal error while loading config:"), str(err)) res["except"].setdefault(ERROR_STR, []).append(str(err)) finally: diff --git a/homeassistant/setup.py b/homeassistant/setup.py index b3ce02905d3..802902e8dec 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -592,7 +592,7 @@ def _async_when_setup( """Call the callback.""" try: await when_setup_cb(hass, component) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Error handling when_setup callback for %s", component) if component in hass.config.components: diff --git a/homeassistant/util/async_.py b/homeassistant/util/async_.py index 19c20207e1d..292a21eb1fc 100644 --- a/homeassistant/util/async_.py +++ b/homeassistant/util/async_.py @@ -61,7 +61,7 @@ def run_callback_threadsafe( """Run callback and store result.""" try: future.set_result(callback(*args)) - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: # noqa: BLE001 if future.set_running_or_notify_cancel(): future.set_exception(exc) else: diff --git a/homeassistant/util/logging.py b/homeassistant/util/logging.py index ab163578846..dbae5794927 100644 --- a/homeassistant/util/logging.py +++ b/homeassistant/util/logging.py @@ -106,7 +106,7 @@ async def _async_wrapper( """Catch and log exception.""" try: await async_func(*args) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 log_exception(format_err, *args) @@ -116,7 +116,7 @@ def _sync_wrapper( """Catch and log exception.""" try: func(*args) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 log_exception(format_err, *args) @@ -127,7 +127,7 @@ def _callback_wrapper( """Catch and log exception.""" try: func(*args) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 log_exception(format_err, *args) @@ -179,7 +179,7 @@ def catch_log_coro_exception( """Catch and log exception.""" try: return await target - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 log_exception(format_err, *args) return None diff --git a/homeassistant/util/thread.py b/homeassistant/util/thread.py index 7673d962d74..a016f192142 100644 --- a/homeassistant/util/thread.py +++ b/homeassistant/util/thread.py @@ -31,7 +31,7 @@ def deadlock_safe_shutdown() -> None: for thread in remaining_threads: try: thread.join(timeout_per_thread) - except Exception as err: # pylint: disable=broad-except + except Exception as err: # noqa: BLE001 _LOGGER.warning("Failed to join thread: %s", err) diff --git a/pyproject.toml b/pyproject.toml index 2378c82982f..2755740484e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -310,6 +310,7 @@ disable = [ "no-else-continue", # RET507 "no-else-raise", # RET506 "no-else-return", # RET505 + "broad-except", # BLE001 "protected-access", # SLF001 # "no-self-use", # PLR6301 # Optional plugin, not enabled @@ -676,6 +677,7 @@ select = [ "B032", # Possible unintentional type annotation (using :). Did you mean to assign (using =)? "B904", # Use raise from to specify exception cause "B905", # zip() without an explicit strict= parameter + "BLE", "C", # complexity "COM818", # Trailing comma on bare tuple prohibited "D", # docstrings diff --git a/script/scaffold/templates/config_flow/integration/config_flow.py b/script/scaffold/templates/config_flow/integration/config_flow.py index 797ca5c7066..0bff976f288 100644 --- a/script/scaffold/templates/config_flow/integration/config_flow.py +++ b/script/scaffold/templates/config_flow/integration/config_flow.py @@ -85,7 +85,7 @@ class ConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: diff --git a/tests/components/demo/test_init.py b/tests/components/demo/test_init.py index 05532d7503b..2d60f7caf94 100644 --- a/tests/components/demo/test_init.py +++ b/tests/components/demo/test_init.py @@ -34,7 +34,7 @@ async def test_setting_up_demo(mock_history, hass: HomeAssistant) -> None: # non-JSON-serializable data in the state machine. try: json.dumps(hass.states.async_all(), cls=JSONEncoder) - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 pytest.fail( "Unable to convert all demo entities to JSON. Wrong data in state machine!" ) diff --git a/tests/components/emulated_hue/test_upnp.py b/tests/components/emulated_hue/test_upnp.py index f69bd1b0651..b7acaf4ea8b 100644 --- a/tests/components/emulated_hue/test_upnp.py +++ b/tests/components/emulated_hue/test_upnp.py @@ -164,7 +164,7 @@ async def test_description_xml(hass: HomeAssistant, hue_client) -> None: root = ET.fromstring(await result.text()) ns = {"s": "urn:schemas-upnp-org:device-1-0"} assert root.find("./s:device/s:serialNumber", ns).text == "001788FFFE23BFC2" - except Exception: # pylint: disable=broad-except + except Exception: # noqa: BLE001 pytest.fail("description.xml is not valid XML!") diff --git a/tests/components/system_log/test_init.py b/tests/components/system_log/test_init.py index e3550101dcc..e9a50f62cee 100644 --- a/tests/components/system_log/test_init.py +++ b/tests/components/system_log/test_init.py @@ -36,7 +36,7 @@ async def get_error_log(hass_ws_client): def _generate_and_log_exception(exception, log): try: raise Exception(exception) - except Exception: # pylint: disable=broad-except + except Exception: _LOGGER.exception(log)