From 79b52a2b41747e4df62a993bee83ce187fd59584 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 20 Jan 2023 13:47:55 +0100 Subject: [PATCH] Stricter pylint message control (#86154) --- homeassistant/__main__.py | 8 ++++---- homeassistant/bootstrap.py | 2 +- .../components/androidtv/media_player.py | 3 ++- homeassistant/components/browser/__init__.py | 2 +- homeassistant/components/cast/media_player.py | 2 +- .../components/configurator/__init__.py | 3 +-- homeassistant/components/decora/light.py | 2 +- .../components/emulated_hue/__init__.py | 2 +- homeassistant/components/eufy/light.py | 2 +- homeassistant/components/frontend/__init__.py | 2 +- homeassistant/components/generic/config_flow.py | 2 +- .../components/google_assistant/helpers.py | 4 ++-- .../silabs_multiprotocol_addon.py | 3 +-- homeassistant/components/http/__init__.py | 2 +- homeassistant/components/http/auth.py | 2 +- homeassistant/components/http/ban.py | 2 +- homeassistant/components/http/cors.py | 2 +- homeassistant/components/light/__init__.py | 2 +- homeassistant/components/minio/minio_helper.py | 4 ++-- homeassistant/components/mqtt/__init__.py | 2 +- homeassistant/components/onboarding/views.py | 6 +++--- homeassistant/components/pushover/notify.py | 2 +- .../components/python_script/__init__.py | 2 +- .../components/qrcode/image_processing.py | 1 - homeassistant/components/recorder/util.py | 2 -- homeassistant/components/samsungtv/bridge.py | 2 +- .../components/shell_command/__init__.py | 2 +- homeassistant/components/skybeacon/sensor.py | 2 +- homeassistant/components/stream/__init__.py | 6 +++--- homeassistant/components/stream/core.py | 4 ++-- homeassistant/components/template/trigger.py | 4 ++-- homeassistant/components/uvc/camera.py | 3 +-- .../components/websocket_api/commands.py | 10 +++++----- homeassistant/config.py | 4 ++-- homeassistant/config_entries.py | 2 +- homeassistant/core.py | 2 +- homeassistant/helpers/aiohttp_client.py | 2 +- homeassistant/helpers/config_validation.py | 16 ++++++++-------- homeassistant/helpers/device_registry.py | 2 +- homeassistant/helpers/script.py | 4 ++-- homeassistant/helpers/template.py | 2 +- homeassistant/loader.py | 2 +- homeassistant/runner.py | 2 +- homeassistant/scripts/benchmark/__init__.py | 2 +- homeassistant/scripts/check_config.py | 2 +- homeassistant/util/__init__.py | 2 +- homeassistant/util/aiohttp.py | 2 +- script/lint_and_test.py | 2 +- tests/common.py | 2 +- tests/components/ecobee/test_config_flow.py | 6 ++---- tests/components/geocaching/test_config_flow.py | 8 ++++---- .../google_assistant/test_smart_home.py | 1 - tests/components/homeassistant/test_init.py | 1 - tests/components/hyperion/__init__.py | 2 +- tests/components/hyperion/test_config_flow.py | 2 +- tests/components/influxdb/test_init.py | 2 +- tests/components/insteon/test_init.py | 2 +- tests/components/konnected/test_panel.py | 6 ------ tests/components/lametric/test_config_flow.py | 16 ++++++++-------- tests/components/lyric/test_config_flow.py | 2 +- tests/components/melnor/test_sensor.py | 2 +- tests/components/mfi/test_switch.py | 8 ++++---- tests/components/smartthings/test_cover.py | 4 ++-- tests/components/smartthings/test_scene.py | 1 - tests/components/smhi/common.py | 1 - tests/components/spotify/test_config_flow.py | 8 ++++---- tests/components/toon/test_config_flow.py | 12 ++++++------ tests/components/vera/test_common.py | 1 - tests/components/withings/common.py | 2 +- tests/components/withings/test_common.py | 1 + tests/components/withings/test_config_flow.py | 2 +- tests/components/yolink/test_config_flow.py | 2 +- tests/components/zha/test_device.py | 4 ---- 73 files changed, 112 insertions(+), 133 deletions(-) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index e7f38db5e37..f7ba18d3d75 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -35,7 +35,7 @@ def validate_python() -> None: def ensure_config_path(config_dir: str) -> None: """Validate the configuration directory.""" - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from . import config as config_util lib_dir = os.path.join(config_dir, "deps") @@ -77,7 +77,7 @@ def ensure_config_path(config_dir: str) -> None: def get_arguments() -> argparse.Namespace: """Get parsed passed in arguments.""" - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from . import config as config_util parser = argparse.ArgumentParser( @@ -184,7 +184,7 @@ def main() -> int: validate_os() if args.script is not None: - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from . import scripts return scripts.run(args.script) @@ -192,7 +192,7 @@ def main() -> int: config_dir = os.path.abspath(os.path.join(os.getcwd(), args.config)) ensure_config_path(config_dir) - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from . import runner runtime_conf = runner.RuntimeConfig( diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index bda54021a4a..e821d0de10e 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -346,7 +346,7 @@ def async_enable_logging( if not log_no_color: try: - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from colorlog import ColoredFormatter # basicConfig must be called after importing colorlog in order to diff --git a/homeassistant/components/androidtv/media_player.py b/homeassistant/components/androidtv/media_player.py index 572aa426105..e51e8eefb1b 100644 --- a/homeassistant/components/androidtv/media_player.py +++ b/homeassistant/components/androidtv/media_player.py @@ -170,7 +170,6 @@ def adb_decorator( self: _ADBDeviceT, *args: _P.args, **kwargs: _P.kwargs ) -> _R | None: """Call an ADB-related method and catch exceptions.""" - # pylint: disable=protected-access if not self.available and not override_available: return None @@ -192,12 +191,14 @@ def adb_decorator( err, ) await self.aftv.adb_close() + # pylint: disable-next=protected-access self._attr_available = False return None except Exception: # An unforeseen exception occurred. Close the ADB connection so that # it doesn't happen over and over again, then raise the exception. await self.aftv.adb_close() + # pylint: disable-next=protected-access self._attr_available = False raise diff --git a/homeassistant/components/browser/__init__.py b/homeassistant/components/browser/__init__.py index f8c1278fbd9..954621ed66f 100644 --- a/homeassistant/components/browser/__init__.py +++ b/homeassistant/components/browser/__init__.py @@ -15,7 +15,7 @@ SERVICE_BROWSE_URL = "browse_url" SERVICE_BROWSE_URL_SCHEMA = vol.Schema( { - # pylint: disable=no-value-for-parameter + # pylint: disable-next=no-value-for-parameter vol.Required(ATTR_URL, default=ATTR_URL_DEFAULT): vol.Url() } ) diff --git a/homeassistant/components/cast/media_player.py b/homeassistant/components/cast/media_player.py index b18c2ccb133..5791fb6b8b9 100644 --- a/homeassistant/components/cast/media_player.py +++ b/homeassistant/components/cast/media_player.py @@ -375,7 +375,7 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity): tts_base_url = None url_description = "" if "tts" in self.hass.config.components: - # pylint: disable=[import-outside-toplevel] + # pylint: disable-next=[import-outside-toplevel] from homeassistant.components import tts with suppress(KeyError): # base_url not configured diff --git a/homeassistant/components/configurator/__init__.py b/homeassistant/components/configurator/__init__.py index 5de212d03a5..be4151c3d80 100644 --- a/homeassistant/components/configurator/__init__.py +++ b/homeassistant/components/configurator/__init__.py @@ -219,8 +219,7 @@ class Configurator: if not self._validate_request_id(request_id): return - # pylint: disable=unused-variable - entity_id, fields, callback = self._requests[request_id] + _, _, callback = self._requests[request_id] # field validation goes here? if callback: diff --git a/homeassistant/components/decora/light.py b/homeassistant/components/decora/light.py index c6fae73bc28..0e9aac0e8d8 100644 --- a/homeassistant/components/decora/light.py +++ b/homeassistant/components/decora/light.py @@ -82,7 +82,7 @@ def retry( "Decora connect error for device %s. Reconnecting", device.name, ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access device._switch.connect() return wrapper_retry diff --git a/homeassistant/components/emulated_hue/__init__.py b/homeassistant/components/emulated_hue/__init__.py index ec06f70a3cc..86102242b31 100644 --- a/homeassistant/components/emulated_hue/__init__.py +++ b/homeassistant/components/emulated_hue/__init__.py @@ -134,7 +134,7 @@ async def async_setup(hass: HomeAssistant, yaml_config: ConfigType) -> bool: # We misunderstood the startup signal. You're not allowed to change # anything during startup. Temp workaround. - # pylint: disable=protected-access + # pylint: disable-next=protected-access app._on_startup.freeze() await app.startup() diff --git a/homeassistant/components/eufy/light.py b/homeassistant/components/eufy/light.py index 55098f5df5e..625b5cda0ba 100644 --- a/homeassistant/components/eufy/light.py +++ b/homeassistant/components/eufy/light.py @@ -134,7 +134,7 @@ class EufyHomeLight(LightEntity): """Turn the specified light on.""" brightness = kwargs.get(ATTR_BRIGHTNESS) colortemp = kwargs.get(ATTR_COLOR_TEMP) - # pylint: disable=invalid-name + # pylint: disable-next=invalid-name hs = kwargs.get(ATTR_HS_COLOR) if brightness is not None: diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 750801f3ddf..b152b2d65d8 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -313,7 +313,7 @@ def _frontend_root(dev_repo_path: str | None) -> pathlib.Path: if dev_repo_path is not None: return pathlib.Path(dev_repo_path) / "hass_frontend" # Keep import here so that we can import frontend without installing reqs - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel import hass_frontend return hass_frontend.where() diff --git a/homeassistant/components/generic/config_flow.py b/homeassistant/components/generic/config_flow.py index 6fa01ba369e..94a885a7c5d 100644 --- a/homeassistant/components/generic/config_flow.py +++ b/homeassistant/components/generic/config_flow.py @@ -221,7 +221,7 @@ async def async_test_stream( return {} # Import from stream.worker as stream cannot reexport from worker # without forcing the av dependency on default_config - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.components.stream.worker import StreamWorkerError if not isinstance(stream_source, template_helper.Template): diff --git a/homeassistant/components/google_assistant/helpers.py b/homeassistant/components/google_assistant/helpers.py index 3f9c90d40e1..e1e63f98ec3 100644 --- a/homeassistant/components/google_assistant/helpers.py +++ b/homeassistant/components/google_assistant/helpers.py @@ -197,7 +197,7 @@ class AbstractConfig(ABC): def async_enable_report_state(self): """Enable proactive mode.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .report_state import async_enable_report_state if self._unsub_report_state is None: @@ -338,7 +338,7 @@ class AbstractConfig(ABC): async def _handle_local_webhook(self, hass, webhook_id, request): """Handle an incoming local SDK message.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from . import smart_home self._local_last_active = utcnow() diff --git a/homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py b/homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py index 921521c182a..a84200e43d6 100644 --- a/homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py +++ b/homeassistant/components/homeassistant_hardware/silabs_multiprotocol_addon.py @@ -243,8 +243,7 @@ class OptionsFlowHandler(BaseMultiPanFlow, config_entries.OptionsFlow): }, ) - # pylint: disable=unreachable - + # pylint: disable-next=unreachable return await self.async_step_on_supervisor() # type: ignore[unreachable] async def async_step_on_supervisor( diff --git a/homeassistant/components/http/__init__.py b/homeassistant/components/http/__init__.py index a9661737337..55b7226b119 100644 --- a/homeassistant/components/http/__init__.py +++ b/homeassistant/components/http/__init__.py @@ -459,7 +459,7 @@ class HomeAssistantHTTP: # However in Home Assistant components can be discovered after boot. # This will now raise a RunTimeError. # To work around this we now prevent the router from getting frozen - # pylint: disable=protected-access + # pylint: disable-next=protected-access self.app._router.freeze = lambda: None # type: ignore[assignment] self.runner = web.AppRunner(self.app) diff --git a/homeassistant/components/http/auth.py b/homeassistant/components/http/auth.py index 7c6f445ce80..197c4f34dad 100644 --- a/homeassistant/components/http/auth.py +++ b/homeassistant/components/http/auth.py @@ -99,7 +99,7 @@ def async_user_not_allowed_do_auth( return "No request available to validate local access" if "cloud" in hass.config.components: - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from hass_nabucasa import remote if remote.is_cloud_request.get(): diff --git a/homeassistant/components/http/ban.py b/homeassistant/components/http/ban.py index 9f300aa9db9..892d3d26689 100644 --- a/homeassistant/components/http/ban.py +++ b/homeassistant/components/http/ban.py @@ -141,7 +141,7 @@ async def process_wrong_login(request: Request) -> None: # Supervisor IP should never be banned if "hassio" in hass.config.components: - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.components import hassio if hassio.get_supervisor_ip() == str(remote_addr): diff --git a/homeassistant/components/http/cors.py b/homeassistant/components/http/cors.py index 97a0530b703..7eb1a5f84fe 100644 --- a/homeassistant/components/http/cors.py +++ b/homeassistant/components/http/cors.py @@ -31,7 +31,7 @@ def setup_cors(app: Application, origins: list[str]) -> None: """Set up CORS.""" # This import should remain here. That way the HTTP integration can always # be imported by other integrations without it's requirements being installed. - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel import aiohttp_cors cors = aiohttp_cors.setup( diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 24368ccc1a3..61582976bc0 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -434,7 +434,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: ): profiles.apply_default(light.entity_id, light.is_on, params) - # pylint: disable=protected-access + # pylint: disable-next=protected-access legacy_supported_color_modes = light._light_internal_supported_color_modes supported_color_modes = light.supported_color_modes diff --git a/homeassistant/components/minio/minio_helper.py b/homeassistant/components/minio/minio_helper.py index 75a8d003aeb..379ff41ae51 100644 --- a/homeassistant/components/minio/minio_helper.py +++ b/homeassistant/components/minio/minio_helper.py @@ -44,7 +44,7 @@ def get_minio_notification_response( ): """Start listening to minio events. Copied from minio-py.""" query = {"prefix": prefix, "suffix": suffix, "events": events} - # pylint: disable=protected-access + # pylint: disable-next=protected-access return minio_client._url_open( "GET", bucket_name=bucket_name, query=query, preload_content=False ) @@ -159,7 +159,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=broad-except + # pylint: disable-next=broad-except except Exception as error: _LOGGER.error("Failed to generate presigned url: %s", error) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 066f3be3736..34c457f395a 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -486,7 +486,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: entity.async_remove() for mqtt_platform in mqtt_platforms for entity in mqtt_platform.entities.values() - # pylint: disable=protected-access + # pylint: disable-next=protected-access if not entity._discovery_data # type: ignore[attr-defined] if mqtt_platform.config_entry and mqtt_platform.domain in RELOADABLE_PLATFORMS diff --git a/homeassistant/components/onboarding/views.py b/homeassistant/components/onboarding/views.py index 43d942c8912..51817be35b8 100644 --- a/homeassistant/components/onboarding/views.py +++ b/homeassistant/components/onboarding/views.py @@ -166,7 +166,7 @@ class UserOnboardingView(_BaseOnboardingView): # Return authorization code for fetching tokens and connect # during onboarding. - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.components.auth import create_auth_code auth_code = create_auth_code(hass, data["client_id"], credentials) @@ -195,7 +195,7 @@ class CoreConfigOnboardingView(_BaseOnboardingView): # Integrations to set up when finishing onboarding onboard_integrations = ["met", "radio_browser"] - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.components import hassio if ( @@ -255,7 +255,7 @@ class IntegrationOnboardingView(_BaseOnboardingView): ) # Return authorization code so we can redirect user and log them in - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.components.auth import create_auth_code auth_code = create_auth_code( diff --git a/homeassistant/components/pushover/notify.py b/homeassistant/components/pushover/notify.py index fa4b35da2fa..9d6ae4b080d 100644 --- a/homeassistant/components/pushover/notify.py +++ b/homeassistant/components/pushover/notify.py @@ -103,7 +103,7 @@ class PushoverNotificationService(BaseNotificationService): if self._hass.config.is_allowed_path(data[ATTR_ATTACHMENT]): # try to open it as a normal file. try: - # pylint: disable=consider-using-with + # pylint: disable-next=consider-using-with file_handle = open(data[ATTR_ATTACHMENT], "rb") # Replace the attachment identifier with file object. image = file_handle diff --git a/homeassistant/components/python_script/__init__.py b/homeassistant/components/python_script/__init__.py index 1dd6e3d3799..bbb262ac7db 100644 --- a/homeassistant/components/python_script/__init__.py +++ b/homeassistant/components/python_script/__init__.py @@ -220,7 +220,7 @@ def execute(hass, filename, source, data=None): try: _LOGGER.info("Executing %s: %s", filename, data) - # pylint: disable=exec-used + # pylint: disable-next=exec-used exec(compiled.code, restricted_globals) except ScriptError as err: logger.error("Error executing script: %s", err) diff --git a/homeassistant/components/qrcode/image_processing.py b/homeassistant/components/qrcode/image_processing.py index bc9bae421ed..06fe92e5b1d 100644 --- a/homeassistant/components/qrcode/image_processing.py +++ b/homeassistant/components/qrcode/image_processing.py @@ -20,7 +20,6 @@ def setup_platform( discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the QR code image processing platform.""" - # pylint: disable=unused-argument entities = [] for camera in config[CONF_SOURCE]: entities.append(QrEntity(camera[CONF_ENTITY_ID], camera.get(CONF_NAME))) diff --git a/homeassistant/components/recorder/util.py b/homeassistant/components/recorder/util.py index 8bffe7fc088..2ed4612bb55 100644 --- a/homeassistant/components/recorder/util.py +++ b/homeassistant/components/recorder/util.py @@ -404,8 +404,6 @@ def build_mysqldb_conv() -> dict: # Late imports since we only call this if they are using mysqldb # pylint: disable=import-outside-toplevel,import-error from MySQLdb.constants import FIELD_TYPE - - # pylint: disable=import-outside-toplevel,import-error from MySQLdb.converters import conversions return {**conversions, FIELD_TYPE.DATETIME: _datetime_or_none} diff --git a/homeassistant/components/samsungtv/bridge.py b/homeassistant/components/samsungtv/bridge.py index 20a4765957a..8d04efe8859 100644 --- a/homeassistant/components/samsungtv/bridge.py +++ b/homeassistant/components/samsungtv/bridge.py @@ -522,7 +522,7 @@ class SamsungTVWSBridge( return RESULT_AUTH_MISSING except (ConnectionFailure, OSError, AsyncioTimeoutError) as err: LOGGER.debug("Failing config: %s, %s error: %s", config, type(err), err) - # pylint: disable=useless-else-on-loop + # pylint: disable-next=useless-else-on-loop else: if result: return result diff --git a/homeassistant/components/shell_command/__init__.py b/homeassistant/components/shell_command/__init__.py index ac47830f840..d4a0a3ac1d5 100644 --- a/homeassistant/components/shell_command/__init__.py +++ b/homeassistant/components/shell_command/__init__.py @@ -91,7 +91,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: with suppress(TypeError): process.kill() # https://bugs.python.org/issue43884 - # pylint: disable=protected-access + # pylint: disable-next=protected-access process._transport.close() # type: ignore[attr-defined] del process diff --git a/homeassistant/components/skybeacon/sensor.py b/homeassistant/components/skybeacon/sensor.py index 0ff6ebd41cd..17bf8a3ab7f 100644 --- a/homeassistant/components/skybeacon/sensor.py +++ b/homeassistant/components/skybeacon/sensor.py @@ -158,7 +158,7 @@ class Monitor(threading.Thread, SensorEntity): ) if SKIP_HANDLE_LOOKUP: # HACK: inject handle mapping collected offline - # pylint: disable=protected-access + # pylint: disable-next=protected-access device._characteristics[UUID(BLE_TEMP_UUID)] = cached_char # Magic: writing this makes device happy device.char_write_handle(0x1B, bytearray([255]), False) diff --git a/homeassistant/components/stream/__init__.py b/homeassistant/components/stream/__init__.py index 02aad1126f8..6073494ae1a 100644 --- a/homeassistant/components/stream/__init__.py +++ b/homeassistant/components/stream/__init__.py @@ -220,7 +220,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: filter_libav_logging() # Keep import here so that we can import stream integration without installing reqs - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .recorder import async_setup_recorder hass.data[DOMAIN] = {} @@ -405,7 +405,7 @@ class Stream: def _run_worker(self) -> None: """Handle consuming streams and restart keepalive streams.""" # Keep import here so that we can import stream integration without installing reqs - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .worker import StreamState, StreamWorkerError, stream_worker stream_state = StreamState(self.hass, self.outputs, self._diagnostics) @@ -501,7 +501,7 @@ class Stream: """Make a .mp4 recording from a provided stream.""" # Keep import here so that we can import stream integration without installing reqs - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .recorder import RecorderOutput # Check for file access diff --git a/homeassistant/components/stream/core.py b/homeassistant/components/stream/core.py index a21a9f17d96..2ae4fc5b31c 100644 --- a/homeassistant/components/stream/core.py +++ b/homeassistant/components/stream/core.py @@ -438,7 +438,7 @@ class KeyFrameConverter: """Initialize.""" # Keep import here so that we can import stream integration without installing reqs - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.components.camera.img_util import TurboJPEGSingleton self.packet: Packet = None @@ -461,7 +461,7 @@ class KeyFrameConverter: return # Keep import here so that we can import stream integration without installing reqs - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from av import CodecContext self._codec_context = CodecContext.create(codec_context.name, "r") diff --git a/homeassistant/components/template/trigger.py b/homeassistant/components/template/trigger.py index e6266a07077..0cc53d5fb2d 100644 --- a/homeassistant/components/template/trigger.py +++ b/homeassistant/components/template/trigger.py @@ -73,7 +73,7 @@ async def async_attach_trigger( return if delay_cancel: - # pylint: disable=not-callable + # pylint: disable-next=not-callable delay_cancel() delay_cancel = None @@ -149,7 +149,7 @@ async def async_attach_trigger( """Remove state listeners async.""" unsub() if delay_cancel: - # pylint: disable=not-callable + # pylint: disable-next=not-callable delay_cancel() return async_remove diff --git a/homeassistant/components/uvc/camera.py b/homeassistant/components/uvc/camera.py index 2417908ecec..cecec49b36b 100644 --- a/homeassistant/components/uvc/camera.py +++ b/homeassistant/components/uvc/camera.py @@ -246,9 +246,8 @@ class UnifiVideoCamera(Camera): ( uri for i, uri in enumerate(channel["rtspUris"]) - # pylint: disable=protected-access + # pylint: disable-next=protected-access if re.search(self._nvr._host, uri) - # pylint: enable=protected-access ) ) return uri diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index b83d81d13e5..d163db55b25 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -94,7 +94,7 @@ def handle_subscribe_events( ) -> None: """Handle subscribe events command.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .permissions import SUBSCRIBE_ALLOWLIST event_type = msg["event_type"] @@ -561,7 +561,7 @@ async def handle_subscribe_trigger( ) -> None: """Handle subscribe trigger command.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.helpers import trigger trigger_config = await trigger.async_validate_trigger_config(hass, msg["trigger"]) @@ -612,7 +612,7 @@ async def handle_test_condition( ) -> None: """Handle test condition command.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.helpers import condition # Do static + dynamic validation of the condition @@ -638,7 +638,7 @@ async def handle_execute_script( ) -> None: """Handle execute script command.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.helpers.script import Script context = connection.context(msg) @@ -680,7 +680,7 @@ async def handle_validate_config( ) -> None: """Handle validate config command.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.helpers import condition, script, trigger result = {} diff --git a/homeassistant/config.py b/homeassistant/config.py index dab44c6ce52..0828084ce77 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -976,7 +976,7 @@ async def async_check_ha_config_file(hass: HomeAssistant) -> str | None: This method is a coroutine. """ - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .helpers import check_config res = await check_config.async_check_ha_config_file(hass) @@ -994,7 +994,7 @@ def async_notify_setup_error( This method must be run in the event loop. """ - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .components import persistent_notification if (errors := hass.data.get(DATA_PERSISTENT_ERRORS)) is None: diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index c908f1916e4..553ef31bc2e 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -627,7 +627,7 @@ class ConfigEntry: ) return False if result: - # pylint: disable=protected-access + # pylint: disable-next=protected-access hass.config_entries._async_schedule_save() # https://github.com/python/mypy/issues/11839 return result # type: ignore[no-any-return] diff --git a/homeassistant/core.py b/homeassistant/core.py index 771943ba7ef..6aeeecedb2d 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -335,7 +335,7 @@ class HomeAssistant: await self.async_start() if attach_signals: - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .helpers.signal import async_register_signal_handling async_register_signal_handling(self) diff --git a/homeassistant/helpers/aiohttp_client.py b/homeassistant/helpers/aiohttp_client.py index ca615bb323b..0437dfc4e84 100644 --- a/homeassistant/helpers/aiohttp_client.py +++ b/homeassistant/helpers/aiohttp_client.py @@ -123,7 +123,7 @@ def _async_create_clientsession( # It's important that we identify as Home Assistant # If a package requires a different user agent, override it by passing a headers # dictionary to the request method. - # pylint: disable=protected-access + # pylint: disable-next=protected-access clientsession._default_headers = MappingProxyType( # type: ignore[assignment] {USER_AGENT: SERVER_SOFTWARE}, ) diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index e7fcf672318..22022fbfa73 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -1074,7 +1074,7 @@ def make_entity_service_schema( SCRIPT_VARIABLES_SCHEMA = vol.All( vol.Schema({str: template_complex}), - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda lambda val: script_variables_helper.ScriptVariables(val), ) @@ -1267,7 +1267,7 @@ AND_CONDITION_SCHEMA = vol.Schema( vol.Required(CONF_CONDITION): "and", vol.Required(CONF_CONDITIONS): vol.All( ensure_list, - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda [lambda value: CONDITION_SCHEMA(value)], ), } @@ -1278,7 +1278,7 @@ AND_CONDITION_SHORTHAND_SCHEMA = vol.Schema( **CONDITION_BASE_SCHEMA, vol.Required("and"): vol.All( ensure_list, - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda [lambda value: CONDITION_SCHEMA(value)], ), } @@ -1290,7 +1290,7 @@ OR_CONDITION_SCHEMA = vol.Schema( vol.Required(CONF_CONDITION): "or", vol.Required(CONF_CONDITIONS): vol.All( ensure_list, - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda [lambda value: CONDITION_SCHEMA(value)], ), } @@ -1301,7 +1301,7 @@ OR_CONDITION_SHORTHAND_SCHEMA = vol.Schema( **CONDITION_BASE_SCHEMA, vol.Required("or"): vol.All( ensure_list, - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda [lambda value: CONDITION_SCHEMA(value)], ), } @@ -1313,7 +1313,7 @@ NOT_CONDITION_SCHEMA = vol.Schema( vol.Required(CONF_CONDITION): "not", vol.Required(CONF_CONDITIONS): vol.All( ensure_list, - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda [lambda value: CONDITION_SCHEMA(value)], ), } @@ -1324,7 +1324,7 @@ NOT_CONDITION_SHORTHAND_SCHEMA = vol.Schema( **CONDITION_BASE_SCHEMA, vol.Required("not"): vol.All( ensure_list, - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda [lambda value: CONDITION_SCHEMA(value)], ), } @@ -1356,7 +1356,7 @@ CONDITION_SHORTHAND_SCHEMA = vol.Schema( **CONDITION_BASE_SCHEMA, vol.Required(CONF_CONDITION): vol.All( ensure_list, - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda [lambda value: CONDITION_SCHEMA(value)], ), } diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index b63814b8960..a586a14d161 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -450,7 +450,7 @@ class DeviceRegistry: ) -> DeviceEntry | None: """Update device attributes.""" # Circular dep - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from . import area_registry as ar old = self.devices[device_id] diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 66a042dbb3d..1d45954e0a7 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -375,7 +375,7 @@ class _ScriptRun: self._script._changed() # pylint: disable=protected-access async def _async_get_condition(self, config): - # pylint: disable=protected-access + # pylint: disable-next=protected-access return await self._script._async_get_condition(config) def _log( @@ -786,7 +786,7 @@ class _ScriptRun: repeat_vars["item"] = item self._variables["repeat"] = repeat_vars - # pylint: disable=protected-access + # pylint: disable-next=protected-access script = self._script._get_repeat_script(self._step) async def async_run_sequence(iteration, extra_msg=""): diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index 5445d14c097..d938b9771a4 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -1085,7 +1085,7 @@ def integration_entities(hass: HomeAssistant, entry_name: str) -> Iterable[str]: return [entry.entity_id for entry in entries] # fallback to just returning all entities for a domain - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .entity import entity_sources return [ diff --git a/homeassistant/loader.py b/homeassistant/loader.py index a41fb582ee1..ef44f43f818 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -229,7 +229,7 @@ async def async_get_config_flows( type_filter: Literal["device", "helper", "hub", "service"] | None = None, ) -> set[str]: """Return cached list of config flows.""" - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from .generated.config_flows import FLOWS integrations = await async_get_custom_components(hass) diff --git a/homeassistant/runner.py b/homeassistant/runner.py index c64e570280e..702a5c04501 100644 --- a/homeassistant/runner.py +++ b/homeassistant/runner.py @@ -112,7 +112,7 @@ async def setup_and_run_hass(runtime_config: RuntimeConfig) -> int: return 1 # threading._shutdown can deadlock forever - # pylint: disable=protected-access + # pylint: disable-next=protected-access threading._shutdown = deadlock_safe_shutdown # type: ignore[attr-defined] return await hass.async_run() diff --git a/homeassistant/scripts/benchmark/__init__.py b/homeassistant/scripts/benchmark/__init__.py index 76af064f3b8..3627e4096d3 100644 --- a/homeassistant/scripts/benchmark/__init__.py +++ b/homeassistant/scripts/benchmark/__init__.py @@ -353,7 +353,7 @@ def _create_state_changed_event_from_old_new( row.old_state_id = old_state and 1 row.state_id = new_state and 1 - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from homeassistant.components import logbook return logbook.LazyEventPartialState(row, {}) diff --git a/homeassistant/scripts/check_config.py b/homeassistant/scripts/check_config.py index cff40d2535c..85d0e77a4e3 100644 --- a/homeassistant/scripts/check_config.py +++ b/homeassistant/scripts/check_config.py @@ -40,7 +40,7 @@ ERROR_STR = "General Errors" def color(the_color, *args, reset=None): """Color helper.""" - # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from colorlog.escape_codes import escape_codes, parse_colors try: diff --git a/homeassistant/util/__init__.py b/homeassistant/util/__init__.py index 19372bd765b..0a4b156fc8c 100644 --- a/homeassistant/util/__init__.py +++ b/homeassistant/util/__init__.py @@ -170,7 +170,7 @@ class Throttle: else: host = args[0] if args else wrapper - # pylint: disable=protected-access # to _throttle + # pylint: disable=protected-access if not hasattr(host, "_throttle"): host._throttle = {} diff --git a/homeassistant/util/aiohttp.py b/homeassistant/util/aiohttp.py index 05ade335a53..8248864fd0e 100644 --- a/homeassistant/util/aiohttp.py +++ b/homeassistant/util/aiohttp.py @@ -84,7 +84,7 @@ def serialize_response(response: web.Response) -> dict[str, Any]: if (body := response.body) is None: body_decoded = None elif isinstance(body, payload.StringPayload): - # pylint: disable=protected-access + # pylint: disable-next=protected-access body_decoded = body._value.decode(body.encoding) elif isinstance(body, bytes): body_decoded = body.decode(response.charset or "utf-8") diff --git a/script/lint_and_test.py b/script/lint_and_test.py index 97108e1c630..d7b6bc19e23 100755 --- a/script/lint_and_test.py +++ b/script/lint_and_test.py @@ -39,7 +39,7 @@ def printc(the_color, *args): def validate_requirements_ok(): """Validate requirements, returns True of ok.""" - # pylint: disable=import-error,import-outside-toplevel + # pylint: disable-next=import-error,import-outside-toplevel from gen_requirements_all import main as req_main return req_main(True) == 0 diff --git a/tests/common.py b/tests/common.py index 3e947b60d3a..43d6a218dab 100644 --- a/tests/common.py +++ b/tests/common.py @@ -140,7 +140,7 @@ def get_test_home_assistant(): def run_loop(): """Run event loop.""" - # pylint: disable=protected-access + # pylint: disable-next=protected-access loop._thread_ident = threading.get_ident() loop.run_forever() loop_stop_event.set() diff --git a/tests/components/ecobee/test_config_flow.py b/tests/components/ecobee/test_config_flow.py index 0c80f20859f..eb1a6c3458a 100644 --- a/tests/components/ecobee/test_config_flow.py +++ b/tests/components/ecobee/test_config_flow.py @@ -86,9 +86,8 @@ async def test_token_request_succeeds(hass): mock_ecobee.request_tokens.return_value = True mock_ecobee.api_key = "test-api-key" mock_ecobee.refresh_token = "test-token" - # pylint: disable=protected-access + # pylint: disable-next=protected-access flow._ecobee = mock_ecobee - # pylint: enable=protected-access result = await flow.async_step_authorize(user_input={}) @@ -110,9 +109,8 @@ async def test_token_request_fails(hass): mock_ecobee = mock_ecobee.return_value mock_ecobee.request_tokens.return_value = False mock_ecobee.pin = "test-pin" - # pylint: disable=protected-access + # pylint: disable-next=protected-access flow._ecobee = mock_ecobee - # pylint: enable=protected-access result = await flow.async_step_authorize(user_input={}) diff --git a/tests/components/geocaching/test_config_flow.py b/tests/components/geocaching/test_config_flow.py index f4be02d4318..6901764a3b9 100644 --- a/tests/components/geocaching/test_config_flow.py +++ b/tests/components/geocaching/test_config_flow.py @@ -53,7 +53,7 @@ async def test_full_flow( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -109,7 +109,7 @@ async def test_existing_entry( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -150,7 +150,7 @@ async def test_oauth_error( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -207,7 +207,7 @@ async def test_reauthentication( result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {}) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { diff --git a/tests/components/google_assistant/test_smart_home.py b/tests/components/google_assistant/test_smart_home.py index 29c2927b157..8308cda31af 100644 --- a/tests/components/google_assistant/test_smart_home.py +++ b/tests/components/google_assistant/test_smart_home.py @@ -897,7 +897,6 @@ async def test_raising_error_trait(hass): async def test_serialize_input_boolean(hass): """Test serializing an input boolean entity.""" state = State("input_boolean.bla", "on") - # pylint: disable=protected-access entity = sh.GoogleEntity(hass, BASIC_CONFIG, state) result = entity.sync_serialize(None, "mock-uuid") assert result == { diff --git a/tests/components/homeassistant/test_init.py b/tests/components/homeassistant/test_init.py index 0c980bcf07e..f279bc33a10 100644 --- a/tests/components/homeassistant/test_init.py +++ b/tests/components/homeassistant/test_init.py @@ -114,7 +114,6 @@ def reload_core_config(hass): class TestComponentsCore(unittest.TestCase): """Test homeassistant.components module.""" - # pylint: disable=invalid-name def setUp(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() diff --git a/tests/components/hyperion/__init__.py b/tests/components/hyperion/__init__.py index 0789a344ec6..80a585f9740 100644 --- a/tests/components/hyperion/__init__.py +++ b/tests/components/hyperion/__init__.py @@ -151,7 +151,7 @@ async def setup_test_config_entry( config_entry = config_entry or add_test_config_entry(hass, options=options) hyperion_client = hyperion_client or create_mock_client() - # pylint: disable=attribute-defined-outside-init + # pylint: disable-next=attribute-defined-outside-init hyperion_client.instances = [TEST_INSTANCE_1] with patch( diff --git a/tests/components/hyperion/test_config_flow.py b/tests/components/hyperion/test_config_flow.py index 27f6f25856d..ad71f392bc6 100644 --- a/tests/components/hyperion/test_config_flow.py +++ b/tests/components/hyperion/test_config_flow.py @@ -765,7 +765,7 @@ async def test_options_priority(hass: HomeAssistant) -> None: {ATTR_ENTITY_ID: TEST_ENTITY_ID_1}, blocking=True, ) - # pylint: disable=unsubscriptable-object + # pylint: disable-next=unsubscriptable-object assert client.async_send_set_color.call_args[1][CONF_PRIORITY] == new_priority diff --git a/tests/components/influxdb/test_init.py b/tests/components/influxdb/test_init.py index 78648852803..3ea9fd35d0d 100644 --- a/tests/components/influxdb/test_init.py +++ b/tests/components/influxdb/test_init.py @@ -72,7 +72,7 @@ def get_mock_call_fixture(request): if request.param == influxdb.API_VERSION_2: return lambda body, precision=None: v2_call(body, precision) - # pylint: disable=unnecessary-lambda + # pylint: disable-next=unnecessary-lambda return lambda body, precision=None: call(body, time_precision=precision) diff --git a/tests/components/insteon/test_init.py b/tests/components/insteon/test_init.py index eb821f15cb5..83bc5814a3b 100644 --- a/tests/components/insteon/test_init.py +++ b/tests/components/insteon/test_init.py @@ -73,7 +73,7 @@ async def test_setup_entry(hass: HomeAssistant): await hass.async_block_till_done() hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP) await hass.async_block_till_done() - # pylint: disable=no-member + # pylint: disable-next=no-member assert insteon.devices.async_save.call_count == 1 assert mock_close.called diff --git a/tests/components/konnected/test_panel.py b/tests/components/konnected/test_panel.py index e7e5784ba71..676ebd18726 100644 --- a/tests/components/konnected/test_panel.py +++ b/tests/components/konnected/test_panel.py @@ -135,12 +135,10 @@ async def test_create_and_setup(hass, mock_panel): await device.update_switch("1", 0) # confirm the correct api is used - # pylint: disable=no-member assert mock_panel.put_device.call_count == 1 assert mock_panel.put_zone.call_count == 0 # confirm the settings are sent to the panel - # pylint: disable=no-member assert mock_panel.put_settings.call_args_list[0][1] == { "sensors": [{"pin": "1"}, {"pin": "2"}, {"pin": "5"}], "actuators": [{"trigger": 0, "pin": "8"}, {"trigger": 1, "pin": "9"}], @@ -288,12 +286,10 @@ async def test_create_and_setup_pro(hass, mock_panel): await device.update_switch("2", 1) # confirm the correct api is used - # pylint: disable=no-member assert mock_panel.put_device.call_count == 0 assert mock_panel.put_zone.call_count == 1 # confirm the settings are sent to the panel - # pylint: disable=no-member assert mock_panel.put_settings.call_args_list[0][1] == { "sensors": [{"zone": "2"}, {"zone": "6"}, {"zone": "10"}, {"zone": "11"}], "actuators": [ @@ -483,12 +479,10 @@ async def test_default_options(hass, mock_panel): await device.update_switch("1", 0) # confirm the correct api is used - # pylint: disable=no-member assert mock_panel.put_device.call_count == 1 assert mock_panel.put_zone.call_count == 0 # confirm the settings are sent to the panel - # pylint: disable=no-member assert mock_panel.put_settings.call_args_list[0][1] == { "sensors": [{"pin": "1"}, {"pin": "2"}, {"pin": "5"}], "actuators": [{"trigger": 0, "pin": "8"}, {"trigger": 1, "pin": "9"}], diff --git a/tests/components/lametric/test_config_flow.py b/tests/components/lametric/test_config_flow.py index f09b48af9fb..bd6beb5c65e 100644 --- a/tests/components/lametric/test_config_flow.py +++ b/tests/components/lametric/test_config_flow.py @@ -66,7 +66,7 @@ async def test_full_cloud_import_flow_multiple_devices( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -147,7 +147,7 @@ async def test_full_cloud_import_flow_single_device( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -267,7 +267,7 @@ async def test_full_ssdp_with_cloud_import( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -411,7 +411,7 @@ async def test_cloud_import_updates_existing_entry( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -518,7 +518,7 @@ async def test_cloud_abort_no_devices( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -637,7 +637,7 @@ async def test_cloud_errors( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -769,7 +769,7 @@ async def test_reauth_cloud_import( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -835,7 +835,7 @@ async def test_reauth_cloud_abort_device_not_found( flow_id, user_input={"next_step_id": "pick_implementation"} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { diff --git a/tests/components/lyric/test_config_flow.py b/tests/components/lyric/test_config_flow.py index 7faa63c2b1b..5186ed7c985 100644 --- a/tests/components/lyric/test_config_flow.py +++ b/tests/components/lyric/test_config_flow.py @@ -120,7 +120,7 @@ async def test_reauthentication_flow( result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {}) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { diff --git a/tests/components/melnor/test_sensor.py b/tests/components/melnor/test_sensor.py index 778acbc96d9..b01843bfbcb 100644 --- a/tests/components/melnor/test_sensor.py +++ b/tests/components/melnor/test_sensor.py @@ -47,7 +47,7 @@ async def test_minutes_remaining_sensor(hass): end_time = now + dt_util.dt.timedelta(minutes=10) # we control this mock - # pylint: disable=protected-access + # pylint: disable-next=protected-access device.zone1._end_time = (end_time).timestamp() with freeze_time(now), patch_async_ble_device_from_address(), patch_melnor_device( diff --git a/tests/components/mfi/test_switch.py b/tests/components/mfi/test_switch.py index c61585898de..17a59b6bd8d 100644 --- a/tests/components/mfi/test_switch.py +++ b/tests/components/mfi/test_switch.py @@ -74,13 +74,13 @@ async def test_update(port, switch): async def test_update_with_target_state(port, switch): """Test update with target state.""" - # pylint: disable=protected-access + # pylint: disable-next=protected-access switch._target_state = True port.data = {} port.data["output"] = "stale" switch.update() assert port.data["output"] == 1.0 - # pylint: disable=protected-access + # pylint: disable-next=protected-access assert switch._target_state is None port.data["output"] = "untouched" switch.update() @@ -92,7 +92,7 @@ async def test_turn_on(port, switch): switch.turn_on() assert port.control.call_count == 1 assert port.control.call_args == mock.call(True) - # pylint: disable=protected-access + # pylint: disable-next=protected-access assert switch._target_state @@ -101,5 +101,5 @@ async def test_turn_off(port, switch): switch.turn_off() assert port.control.call_count == 1 assert port.control.call_args == mock.call(False) - # pylint: disable=protected-access + # pylint: disable-next=protected-access assert not switch._target_state diff --git a/tests/components/smartthings/test_cover.py b/tests/components/smartthings/test_cover.py index 4111d21b25b..2de399c0df0 100644 --- a/tests/components/smartthings/test_cover.py +++ b/tests/components/smartthings/test_cover.py @@ -124,7 +124,7 @@ async def test_set_cover_position(hass, device_factory): assert state.attributes[ATTR_BATTERY_LEVEL] == 95 assert state.attributes[ATTR_CURRENT_POSITION] == 10 # Ensure API called - # pylint: disable=protected-access + # pylint: disable-next=protected-access assert device._api.post_device_command.call_count == 1 # type: ignore @@ -147,7 +147,7 @@ async def test_set_cover_position_unsupported(hass, device_factory): assert ATTR_CURRENT_POSITION not in state.attributes # Ensure API was not called - # pylint: disable=protected-access + # pylint: disable-next=protected-access assert device._api.post_device_command.call_count == 0 # type: ignore diff --git a/tests/components/smartthings/test_scene.py b/tests/components/smartthings/test_scene.py index 288fae046f5..ccb47144676 100644 --- a/tests/components/smartthings/test_scene.py +++ b/tests/components/smartthings/test_scene.py @@ -37,7 +37,6 @@ async def test_scene_activate(hass, scene): assert state.attributes["icon"] == scene.icon assert state.attributes["color"] == scene.color assert state.attributes["location_id"] == scene.location_id - # pylint: disable=protected-access assert scene.execute.call_count == 1 # type: ignore diff --git a/tests/components/smhi/common.py b/tests/components/smhi/common.py index 6f215840324..8a12cf651b7 100644 --- a/tests/components/smhi/common.py +++ b/tests/components/smhi/common.py @@ -5,7 +5,6 @@ from unittest.mock import Mock class AsyncMock(Mock): """Implements Mock async.""" - # pylint: disable=useless-super-delegation async def __call__(self, *args, **kwargs): """Hack for async support for Mock.""" return super().__call__(*args, **kwargs) diff --git a/tests/components/spotify/test_config_flow.py b/tests/components/spotify/test_config_flow.py index 8f3b5799374..5fbf6b5b086 100644 --- a/tests/components/spotify/test_config_flow.py +++ b/tests/components/spotify/test_config_flow.py @@ -84,7 +84,7 @@ async def test_full_flow( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -151,7 +151,7 @@ async def test_abort_if_spotify_error( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -213,7 +213,7 @@ async def test_reauthentication( result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {}) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -279,7 +279,7 @@ async def test_reauth_account_mismatch( flows = hass.config_entries.flow.async_progress() result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {}) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { diff --git a/tests/components/toon/test_config_flow.py b/tests/components/toon/test_config_flow.py index 3d7a0613269..371dd187c20 100644 --- a/tests/components/toon/test_config_flow.py +++ b/tests/components/toon/test_config_flow.py @@ -54,7 +54,7 @@ async def test_full_flow_implementation( assert result["type"] == data_entry_flow.FlowResultType.FORM assert result["step_id"] == "pick_implementation" - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -114,7 +114,7 @@ async def test_no_agreements( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -154,7 +154,7 @@ async def test_multiple_agreements( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -205,7 +205,7 @@ async def test_agreement_already_set_up( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -244,7 +244,7 @@ async def test_toon_abort( result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { @@ -306,7 +306,7 @@ async def test_import_migration( assert len(flows) == 1 assert flows[0]["context"][CONF_MIGRATE] == old_entry.entry_id - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { diff --git a/tests/components/vera/test_common.py b/tests/components/vera/test_common.py index 3832daf0710..100a788313d 100644 --- a/tests/components/vera/test_common.py +++ b/tests/components/vera/test_common.py @@ -12,7 +12,6 @@ from tests.common import async_fire_time_changed async def test_subscription_registry(hass: HomeAssistant) -> None: """Test subscription registry polling.""" subscription_registry = SubscriptionRegistry(hass) - # pylint: disable=protected-access subscription_registry.poll_server_once = poll_server_once_mock = MagicMock() poll_server_once_mock.return_value = True diff --git a/tests/components/withings/common.py b/tests/components/withings/common.py index 96a35d10c40..95a3d4c9fc5 100644 --- a/tests/components/withings/common.py +++ b/tests/components/withings/common.py @@ -198,7 +198,7 @@ class ComponentFactory: const.DOMAIN, context={"source": SOURCE_USER} ) assert result - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( self._hass, { diff --git a/tests/components/withings/test_common.py b/tests/components/withings/test_common.py index 3917c894b60..0fe27d86781 100644 --- a/tests/components/withings/test_common.py +++ b/tests/components/withings/test_common.py @@ -166,6 +166,7 @@ async def test_data_manager_webhook_subscription( # pylint: disable=protected-access data_manager._notify_subscribe_delay = datetime.timedelta(seconds=0) data_manager._notify_unsubscribe_delay = datetime.timedelta(seconds=0) + # pylint: enable=protected-access api.notify_list.return_value = NotifyListResponse( profiles=( diff --git a/tests/components/withings/test_config_flow.py b/tests/components/withings/test_config_flow.py index 9fcc84dbe83..474b6950ba8 100644 --- a/tests/components/withings/test_config_flow.py +++ b/tests/components/withings/test_config_flow.py @@ -80,7 +80,7 @@ async def test_config_reauth_profile( {}, ) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { diff --git a/tests/components/yolink/test_config_flow.py b/tests/components/yolink/test_config_flow.py index f809596e816..061f9cd78a8 100644 --- a/tests/components/yolink/test_config_flow.py +++ b/tests/components/yolink/test_config_flow.py @@ -172,7 +172,7 @@ async def test_reauthentication( result = await hass.config_entries.flow.async_configure(flows[0]["flow_id"], {}) - # pylint: disable=protected-access + # pylint: disable-next=protected-access state = config_entry_oauth2_flow._encode_jwt( hass, { diff --git a/tests/components/zha/test_device.py b/tests/components/zha/test_device.py index b6fa5d2f884..eca9adbc6d8 100644 --- a/tests/components/zha/test_device.py +++ b/tests/components/zha/test_device.py @@ -130,8 +130,6 @@ async def test_check_available_success( hass, device_with_basic_channel, zha_device_restored ): """Check device availability success on 1st try.""" - - # pylint: disable=protected-access zha_device = await zha_device_restored(device_with_basic_channel) await async_enable_traffic(hass, [zha_device]) basic_ch = device_with_basic_channel.endpoints[3].basic @@ -185,7 +183,6 @@ async def test_check_available_unsuccessful( ): """Check device availability all tries fail.""" - # pylint: disable=protected-access zha_device = await zha_device_restored(device_with_basic_channel) await async_enable_traffic(hass, [zha_device]) basic_ch = device_with_basic_channel.endpoints[3].basic @@ -228,7 +225,6 @@ async def test_check_available_no_basic_channel( ): """Check device availability for a device without basic cluster.""" - # pylint: disable=protected-access zha_device = await zha_device_restored(device_without_basic_channel) await async_enable_traffic(hass, [zha_device])