diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index b416b1f98d3..d2903370f49 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -272,7 +272,6 @@ def cmdline() -> List[str]: async def setup_and_run_hass(config_dir: str, args: argparse.Namespace) -> int: """Set up HASS and run.""" - # pylint: disable=redefined-outer-name from homeassistant import bootstrap, core hass = core.HomeAssistant() diff --git a/homeassistant/auth/mfa_modules/__init__.py b/homeassistant/auth/mfa_modules/__init__.py index 9d49f67df82..9020b0b321e 100644 --- a/homeassistant/auth/mfa_modules/__init__.py +++ b/homeassistant/auth/mfa_modules/__init__.py @@ -42,7 +42,7 @@ class MultiFactorAuthModule: self.config = config @property - def id(self) -> str: # pylint: disable=invalid-name + def id(self) -> str: """Return id of the auth module. Default is same as type diff --git a/homeassistant/auth/permissions/__init__.py b/homeassistant/auth/permissions/__init__.py index f0e093953e1..36cf9c4f420 100644 --- a/homeassistant/auth/permissions/__init__.py +++ b/homeassistant/auth/permissions/__init__.py @@ -58,15 +58,12 @@ class PolicyPermissions(AbstractPermissions): def __eq__(self, other: Any) -> bool: """Equals check.""" - # pylint: disable=protected-access return isinstance(other, PolicyPermissions) and other._policy == self._policy class _OwnerPermissions(AbstractPermissions): """Owner permissions.""" - # pylint: disable=no-self-use - def access_all_entities(self, key: str) -> bool: """Check if we have a certain access to all entities.""" return True diff --git a/homeassistant/auth/providers/__init__.py b/homeassistant/auth/providers/__init__.py index 3e25003ad00..cbce3152902 100644 --- a/homeassistant/auth/providers/__init__.py +++ b/homeassistant/auth/providers/__init__.py @@ -48,7 +48,7 @@ class AuthProvider: self.config = config @property - def id(self) -> Optional[str]: # pylint: disable=invalid-name + def id(self) -> Optional[str]: """Return id of the auth provider. Optional, can be None. diff --git a/homeassistant/components/abode/config_flow.py b/homeassistant/components/abode/config_flow.py index bf48e4546b3..b8e8548db31 100644 --- a/homeassistant/components/abode/config_flow.py +++ b/homeassistant/components/abode/config_flow.py @@ -10,7 +10,7 @@ from homeassistant import config_entries from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.core import callback -from .const import DOMAIN, DEFAULT_CACHEDB # pylint: disable=W0611 +from .const import DOMAIN, DEFAULT_CACHEDB # pylint: disable=unused-import CONF_POLLING = "polling" diff --git a/homeassistant/components/alarm_control_panel/__init__.py b/homeassistant/components/alarm_control_panel/__init__.py index 36cb8650ace..2a335651d96 100644 --- a/homeassistant/components/alarm_control_panel/__init__.py +++ b/homeassistant/components/alarm_control_panel/__init__.py @@ -101,7 +101,6 @@ async def async_unload_entry(hass, entry): return await hass.data[DOMAIN].async_unload_entry(entry) -# pylint: disable=no-self-use class AlarmControlPanel(Entity): """An abstract class for alarm control devices.""" diff --git a/homeassistant/components/apache_kafka/__init__.py b/homeassistant/components/apache_kafka/__init__.py index e0c8b824913..7bd23630bd0 100644 --- a/homeassistant/components/apache_kafka/__init__.py +++ b/homeassistant/components/apache_kafka/__init__.py @@ -64,7 +64,7 @@ class DateTimeJSONEncoder(json.JSONEncoder): Additionally add encoding for datetime objects as isoformat. """ - def default(self, o): # pylint: disable=E0202 + def default(self, o): # pylint: disable=method-hidden """Implement encoding logic.""" if isinstance(o, datetime): return o.isoformat() diff --git a/homeassistant/components/brunt/cover.py b/homeassistant/components/brunt/cover.py index 7d4279cf5b2..373c3339441 100644 --- a/homeassistant/components/brunt/cover.py +++ b/homeassistant/components/brunt/cover.py @@ -36,7 +36,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the brunt platform.""" - # pylint: disable=no-name-in-module username = config[CONF_USERNAME] password = config[CONF_PASSWORD] diff --git a/homeassistant/components/cast/helpers.py b/homeassistant/components/cast/helpers.py index ea5c77ebc1a..e82f6c9e4ed 100644 --- a/homeassistant/components/cast/helpers.py +++ b/homeassistant/components/cast/helpers.py @@ -150,7 +150,6 @@ class CastStatusListener: chromecast.register_status_listener(self) chromecast.socket_client.media_controller.register_status_listener(self) chromecast.register_connection_listener(self) - # pylint: disable=protected-access if cast_device._cast_info.is_audio_group: self._mz_mgr.add_multizone(chromecast) else: diff --git a/homeassistant/components/cups/sensor.py b/homeassistant/components/cups/sensor.py index 4af51e911a1..17a246561a5 100644 --- a/homeassistant/components/cups/sensor.py +++ b/homeassistant/components/cups/sensor.py @@ -306,7 +306,6 @@ class MarkerSensor(Entity): self._attributes = self.data.attributes -# pylint: disable=no-name-in-module class CupsData: """Get the latest data from CUPS and update the state.""" diff --git a/homeassistant/components/decora_wifi/light.py b/homeassistant/components/decora_wifi/light.py index 77f3a6387ed..6171f65ef24 100644 --- a/homeassistant/components/decora_wifi/light.py +++ b/homeassistant/components/decora_wifi/light.py @@ -28,7 +28,7 @@ NOTIFICATION_TITLE = "myLeviton Decora Setup" def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Decora WiFi platform.""" - # pylint: disable=import-error, no-name-in-module + # pylint: disable=import-error from decora_wifi import DecoraWiFiSession from decora_wifi.models.person import Person from decora_wifi.models.residential_account import ResidentialAccount diff --git a/homeassistant/components/doorbird/__init__.py b/homeassistant/components/doorbird/__init__.py index ff0bbd71194..3127dabd66d 100644 --- a/homeassistant/components/doorbird/__init__.py +++ b/homeassistant/components/doorbird/__init__.py @@ -264,7 +264,6 @@ class DoorBirdRequestView(HomeAssistantView): name = API_URL[1:].replace("/", ":") extra_urls = [API_URL + "/{event}"] - # pylint: disable=no-self-use async def get(self, request, event): """Respond to requests from the device.""" from aiohttp import web diff --git a/homeassistant/components/enocean/__init__.py b/homeassistant/components/enocean/__init__.py index b75c8f001c0..d01af51c7e3 100644 --- a/homeassistant/components/enocean/__init__.py +++ b/homeassistant/components/enocean/__init__.py @@ -84,7 +84,6 @@ class EnOceanDevice(Entity): def value_changed(self, packet): """Update the internal state of the device when a packet arrives.""" - # pylint: disable=no-self-use def send_command(self, data, optional, packet_type): """Send a command via the EnOcean dongle.""" from enocean.protocol.packet import Packet diff --git a/homeassistant/components/eq3btsmart/climate.py b/homeassistant/components/eq3btsmart/climate.py index 8499a0de5a0..cee05997294 100644 --- a/homeassistant/components/eq3btsmart/climate.py +++ b/homeassistant/components/eq3btsmart/climate.py @@ -190,7 +190,7 @@ class EQ3BTSmartThermostat(ClimateDevice): def update(self): """Update the data from the thermostat.""" - # pylint: disable=import-error,no-name-in-module + # pylint: disable=import-error from bluepy.btle import BTLEException try: diff --git a/homeassistant/components/esphome/fan.py b/homeassistant/components/esphome/fan.py index cddb75b41bf..8b9b4b4922c 100644 --- a/homeassistant/components/esphome/fan.py +++ b/homeassistant/components/esphome/fan.py @@ -81,7 +81,6 @@ class EsphomeFan(EsphomeEntity, FanEntity): data["speed"] = _fan_speeds.from_hass(speed) await self._client.fan_command(**data) - # pylint: disable=arguments-differ async def async_turn_off(self, **kwargs) -> None: """Turn off the fan.""" await self._client.fan_command(key=self._static_info.key, state=False) diff --git a/homeassistant/components/evohome/__init__.py b/homeassistant/components/evohome/__init__.py index 29f89dc08d6..3d903e86e30 100644 --- a/homeassistant/components/evohome/__init__.py +++ b/homeassistant/components/evohome/__init__.py @@ -237,11 +237,7 @@ class EvoBroker: loc_idx = params[CONF_LOCATION_IDX] self.config = client.installation_info[loc_idx][GWS][0][TCS][0] - self.tcs = ( - client.locations[loc_idx] # pylint: disable=protected-access - ._gateways[0] - ._control_systems[0] - ) + self.tcs = client.locations[loc_idx]._gateways[0]._control_systems[0] self.temps = None async def save_auth_tokens(self) -> None: diff --git a/homeassistant/components/google_assistant/helpers.py b/homeassistant/components/google_assistant/helpers.py index 96b9b93d70a..0f3a3dcf039 100644 --- a/homeassistant/components/google_assistant/helpers.py +++ b/homeassistant/components/google_assistant/helpers.py @@ -77,7 +77,6 @@ class AbstractConfig: @property def should_report_state(self): """Return if states should be proactively reported.""" - # pylint: disable=no-self-use return False @property diff --git a/homeassistant/components/google_assistant/http.py b/homeassistant/components/google_assistant/http.py index 90fa1ced157..ce5eff7afef 100644 --- a/homeassistant/components/google_assistant/http.py +++ b/homeassistant/components/google_assistant/http.py @@ -102,7 +102,6 @@ class GoogleConfig(AbstractConfig): @property def should_report_state(self): """Return if states should be proactively reported.""" - # pylint: disable=no-self-use return self._config.get(CONF_REPORT_STATE) def should_expose(self, state) -> bool: diff --git a/homeassistant/components/google_pubsub/__init__.py b/homeassistant/components/google_pubsub/__init__.py index e108d249797..c4136c3b9cb 100644 --- a/homeassistant/components/google_pubsub/__init__.py +++ b/homeassistant/components/google_pubsub/__init__.py @@ -57,7 +57,9 @@ def setup(hass: HomeAssistant, yaml_config: Dict[str, Any]): service_principal_path ) - topic_path = publisher.topic_path(project_id, topic_name) # pylint: disable=E1101 + topic_path = publisher.topic_path( # pylint: disable=no-member + project_id, topic_name + ) encoder = DateTimeJSONEncoder() @@ -87,7 +89,7 @@ class DateTimeJSONEncoder(json.JSONEncoder): Additionally add encoding for datetime objects as isoformat. """ - def default(self, o): # pylint: disable=E0202 + def default(self, o): # pylint: disable=method-hidden """Implement encoding logic.""" if isinstance(o, datetime.datetime): return o.isoformat() diff --git a/homeassistant/components/group/__init__.py b/homeassistant/components/group/__init__.py index 29126c82d44..b4688229073 100644 --- a/homeassistant/components/group/__init__.py +++ b/homeassistant/components/group/__init__.py @@ -656,7 +656,6 @@ class Group(Entity): if gr_on is None: return - # pylint: disable=too-many-boolean-expressions if tr_state is None or ( (gr_state == gr_on and tr_state.state == gr_off) or (gr_state == gr_off and tr_state.state == gr_on) diff --git a/homeassistant/components/harmony/remote.py b/homeassistant/components/harmony/remote.py index 118af7fe34a..d5c1c2d82bc 100644 --- a/homeassistant/components/harmony/remote.py +++ b/homeassistant/components/harmony/remote.py @@ -316,7 +316,6 @@ class HarmonyRemote(remote.RemoteDevice): except aioexc.TimeOut: _LOGGER.error("%s: Powering off timed-out", self.name) - # pylint: disable=arguments-differ async def async_send_command(self, command, **kwargs): """Send a list of commands to one device.""" _LOGGER.debug("%s: Send Command", self.name) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index bb525271cec..525c091e177 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -362,8 +362,7 @@ class HomeKit: return self.status = STATUS_WAIT - # pylint: disable=unused-import - from . import ( # noqa: F401 + from . import ( # noqa: F401 pylint: disable=unused-import type_covers, type_fans, type_lights, diff --git a/homeassistant/components/homekit_controller/__init__.py b/homeassistant/components/homekit_controller/__init__.py index 4ca54099d24..6b53301e877 100644 --- a/homeassistant/components/homekit_controller/__init__.py +++ b/homeassistant/components/homekit_controller/__init__.py @@ -109,7 +109,6 @@ class HomeKitEntity(Entity): setup_fn = getattr(self, f"_setup_{setup_fn_name}", None) if not setup_fn: return - # pylint: disable=not-callable setup_fn(char) @callback @@ -132,7 +131,6 @@ class HomeKitEntity(Entity): if not update_fn: continue - # pylint: disable=not-callable update_fn(result["value"]) self.async_write_ha_state() diff --git a/homeassistant/components/honeywell/climate.py b/homeassistant/components/honeywell/climate.py index 15efac87587..42f4778eb4f 100644 --- a/homeassistant/components/honeywell/climate.py +++ b/homeassistant/components/honeywell/climate.py @@ -160,9 +160,7 @@ class HoneywellUSThermostat(ClimateDevice): self._username = username self._password = password - _LOGGER.debug( - "latestData = %s ", device._data # pylint: disable=protected-access - ) + _LOGGER.debug("latestData = %s ", device._data) # not all honeywell HVACs support all modes mappings = [v for k, v in HVAC_MODE_TO_HW_MODE.items() if device.raw_ui_data[k]] @@ -174,13 +172,13 @@ class HoneywellUSThermostat(ClimateDevice): | SUPPORT_TARGET_TEMPERATURE_RANGE ) - if device._data["canControlHumidification"]: # pylint: disable=protected-access + if device._data["canControlHumidification"]: self._supported_features |= SUPPORT_TARGET_HUMIDITY if device.raw_ui_data["SwitchEmergencyHeatAllowed"]: self._supported_features |= SUPPORT_AUX_HEAT - if not device._data["hasFan"]: # pylint: disable=protected-access + if not device._data["hasFan"]: return # not all honeywell fans support all modes diff --git a/homeassistant/components/http/static.py b/homeassistant/components/http/static.py index e6a70c9f643..7d84be0f6dd 100644 --- a/homeassistant/components/http/static.py +++ b/homeassistant/components/http/static.py @@ -13,8 +13,6 @@ CACHE_TIME = 31 * 86400 # = 1 month CACHE_HEADERS = {hdrs.CACHE_CONTROL: f"public, max-age={CACHE_TIME}"} -# https://github.com/PyCQA/astroid/issues/633 -# pylint: disable=duplicate-bases class CachingStaticResource(StaticResource): """Static Resource handler that will add cache headers.""" diff --git a/homeassistant/components/input_datetime/__init__.py b/homeassistant/components/input_datetime/__init__.py index 85fac4130a3..c366be90b14 100644 --- a/homeassistant/components/input_datetime/__init__.py +++ b/homeassistant/components/input_datetime/__init__.py @@ -87,7 +87,6 @@ async def async_setup(hass, config): time = call.data.get(ATTR_TIME) date = call.data.get(ATTR_DATE) dttm = call.data.get(ATTR_DATETIME) - # pylint: disable=too-many-boolean-expressions if ( dttm and (date or time) diff --git a/homeassistant/components/isy994/binary_sensor.py b/homeassistant/components/isy994/binary_sensor.py index 0c4fb80be8c..eed5f1a81a0 100644 --- a/homeassistant/components/isy994/binary_sensor.py +++ b/homeassistant/components/isy994/binary_sensor.py @@ -110,7 +110,6 @@ class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice): self._negative_node = None self._heartbeat_device = None self._device_class_from_type = _detect_device_type(self._node) - # pylint: disable=protected-access if _is_val_unknown(self._node.status._val): self._computed_state = None self._status_was_unknown = True diff --git a/homeassistant/components/mobile_app/webhook.py b/homeassistant/components/mobile_app/webhook.py index 66188500fd6..416f6cd2ffe 100644 --- a/homeassistant/components/mobile_app/webhook.py +++ b/homeassistant/components/mobile_app/webhook.py @@ -148,7 +148,6 @@ async def handle_webhook( blocking=True, context=context, ) - # noqa: E722 pylint: disable=broad-except except (vol.Invalid, ServiceNotFound, Exception) as ex: _LOGGER.error( "Error when calling service during mobile_app " @@ -174,7 +173,6 @@ async def handle_webhook( tpl = item[ATTR_TEMPLATE] attach(hass, tpl) resp[key] = tpl.async_render(item.get(ATTR_TEMPLATE_VARIABLES)) - # noqa: E722 pylint: disable=broad-except except TemplateError as ex: resp[key] = {"error": str(ex)} diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 70523a840a3..498114732df 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -335,7 +335,6 @@ MQTT_PUBLISH_SCHEMA = vol.Schema( ) -# pylint: disable=invalid-name SubscribePayloadType = Union[str, bytes] # Only bytes if encoding is None diff --git a/homeassistant/components/mqtt/models.py b/homeassistant/components/mqtt/models.py index 5f014aadd08..46aaa23732f 100644 --- a/homeassistant/components/mqtt/models.py +++ b/homeassistant/components/mqtt/models.py @@ -3,7 +3,6 @@ from typing import Union, Callable import attr -# pylint: disable=invalid-name PublishPayloadType = Union[str, bytes, int, float, None] diff --git a/homeassistant/components/plex/server.py b/homeassistant/components/plex/server.py index 69838fbf27f..c9aee9e8dad 100644 --- a/homeassistant/components/plex/server.py +++ b/homeassistant/components/plex/server.py @@ -192,7 +192,7 @@ class PlexServer: @property def url_in_use(self): """Return URL used for connected Plex server.""" - return self._plex_server._baseurl # pylint: disable=W0212 + return self._plex_server._baseurl # pylint: disable=protected-access @property def use_episode_art(self): diff --git a/homeassistant/components/python_script/__init__.py b/homeassistant/components/python_script/__init__.py index af0865bc685..046649fce79 100644 --- a/homeassistant/components/python_script/__init__.py +++ b/homeassistant/components/python_script/__init__.py @@ -147,7 +147,6 @@ def execute(hass, filename, source, data=None): def protected_getattr(obj, name, default=None): """Restricted method to get attributes.""" - # pylint: disable=too-many-boolean-expressions if name.startswith("async_"): raise ScriptError("Not allowed to access async methods") if ( diff --git a/homeassistant/components/rachio/__init__.py b/homeassistant/components/rachio/__init__.py index 2030512ab31..28614d22110 100644 --- a/homeassistant/components/rachio/__init__.py +++ b/homeassistant/components/rachio/__init__.py @@ -284,7 +284,6 @@ class RachioWebhookView(HomeAssistantView): url = WEBHOOK_PATH name = url[1:].replace("/", ":") - # pylint: disable=no-self-use @asyncio.coroutine async def post(self, request) -> web.Response: """Handle webhook calls from the server.""" diff --git a/homeassistant/components/rainbird/__init__.py b/homeassistant/components/rainbird/__init__.py index 0b51be1f258..83c358c480b 100644 --- a/homeassistant/components/rainbird/__init__.py +++ b/homeassistant/components/rainbird/__init__.py @@ -75,7 +75,7 @@ def _setup_controller(hass, controller_config, config): position = len(hass.data[DATA_RAINBIRD]) try: controller.get_serial_number() - except Exception as exc: # pylint: disable=W0703 + except Exception as exc: # pylint: disable=broad-except _LOGGER.error("Unable to setup controller: %s", exc) return False hass.data[DATA_RAINBIRD].append(controller) diff --git a/homeassistant/components/recorder/util.py b/homeassistant/components/recorder/util.py index 8cfcafea79d..693d88ae795 100644 --- a/homeassistant/components/recorder/util.py +++ b/homeassistant/components/recorder/util.py @@ -28,7 +28,7 @@ def session_scope(*, hass=None, session=None): if session.transaction: need_rollback = True session.commit() - except Exception as err: # pylint: disable=broad-except + except Exception as err: _LOGGER.error("Error executing query: %s", err) if need_rollback: session.rollback() diff --git a/homeassistant/components/script/__init__.py b/homeassistant/components/script/__init__.py index 5a3223a8508..9659cc625c0 100644 --- a/homeassistant/components/script/__init__.py +++ b/homeassistant/components/script/__init__.py @@ -207,7 +207,7 @@ class ScriptEntity(ToggleEntity): ) try: await self.script.async_run(kwargs.get(ATTR_VARIABLES), context) - except Exception as err: # pylint: disable=broad-except + except Exception as err: self.script.async_log_exception( _LOGGER, f"Error executing script {self.entity_id}", err ) diff --git a/homeassistant/components/sisyphus/media_player.py b/homeassistant/components/sisyphus/media_player.py index e06b84b4ac5..5f02418f7e0 100644 --- a/homeassistant/components/sisyphus/media_player.py +++ b/homeassistant/components/sisyphus/media_player.py @@ -43,7 +43,6 @@ SUPPORTED_FEATURES = ( ) -# pylint: disable=unused-argument async def async_setup_platform(hass, config, add_entities, discovery_info=None): """Set up a media player entity for a Sisyphus table.""" host = discovery_info[CONF_HOST] diff --git a/homeassistant/components/sonos/media_player.py b/homeassistant/components/sonos/media_player.py index 2baa02d0a5d..9ce72d87dfe 100644 --- a/homeassistant/components/sonos/media_player.py +++ b/homeassistant/components/sonos/media_player.py @@ -1056,7 +1056,6 @@ class SonosEntity(MediaPlayerDevice): def restore(self): """Restore a snapshotted state to a player.""" try: - # pylint: disable=protected-access self._soco_snapshot.restore() except (TypeError, AttributeError, SoCoException) as ex: # Can happen if restoring a coordinator onto a current slave diff --git a/homeassistant/components/switchmate/switch.py b/homeassistant/components/switchmate/switch.py index 6abbfd5fae5..ddb0db3feee 100644 --- a/homeassistant/components/switchmate/switch.py +++ b/homeassistant/components/switchmate/switch.py @@ -2,7 +2,7 @@ from datetime import timedelta import logging -# pylint: disable=import-error, no-member, no-value-for-parameter +# pylint: disable=import-error, no-member import switchmate import voluptuous as vol diff --git a/homeassistant/components/system_health/__init__.py b/homeassistant/components/system_health/__init__.py index c6b48350959..778ddf601dc 100644 --- a/homeassistant/components/system_health/__init__.py +++ b/homeassistant/components/system_health/__init__.py @@ -44,7 +44,7 @@ async def _info_wrapper(hass, info_callback): return await info_callback(hass) except asyncio.TimeoutError: return {"error": "Fetching info timed out"} - except Exception as err: # pylint: disable=W0703 + except Exception as err: # pylint: disable=broad-except _LOGGER.exception("Error fetching info") return {"error": str(err)} diff --git a/homeassistant/components/telegram_bot/polling.py b/homeassistant/components/telegram_bot/polling.py index 314cb31a373..cf3d13d5edc 100644 --- a/homeassistant/components/telegram_bot/polling.py +++ b/homeassistant/components/telegram_bot/polling.py @@ -55,7 +55,7 @@ def message_handler(handler): """Initialize the messages handler instance.""" super().__init__(handler) - def check_update(self, update): # pylint: disable=no-self-use + def check_update(self, update): """Check is update valid.""" return isinstance(update, Update) diff --git a/homeassistant/components/tensorflow/image_processing.py b/homeassistant/components/tensorflow/image_processing.py index c9c1b00aae4..5f576f176e8 100644 --- a/homeassistant/components/tensorflow/image_processing.py +++ b/homeassistant/components/tensorflow/image_processing.py @@ -104,8 +104,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): try: # Display warning that PIL will be used if no OpenCV is found. - # pylint: disable=unused-import,unused-variable - import cv2 # noqa: F401 + import cv2 # noqa: F401 pylint: disable=unused-import except ImportError: _LOGGER.warning( "No OpenCV library found. TensorFlow will process image with " diff --git a/homeassistant/components/timer/__init__.py b/homeassistant/components/timer/__init__.py index 3ac41b84d82..c6cc0a8c3c9 100644 --- a/homeassistant/components/timer/__init__.py +++ b/homeassistant/components/timer/__init__.py @@ -162,7 +162,6 @@ class Timer(RestoreEntity): event = EVENT_TIMER_RESTARTED self._state = STATUS_ACTIVE - # pylint: disable=redefined-outer-name start = dt_util.utcnow() if self._remaining and newduration is None: self._end = start + self._remaining diff --git a/homeassistant/components/toon/__init__.py b/homeassistant/components/toon/__init__.py index ed627fdc924..19466ba49c4 100644 --- a/homeassistant/components/toon/__init__.py +++ b/homeassistant/components/toon/__init__.py @@ -139,7 +139,7 @@ class ToonData: """Update all Toon data and notify entities.""" # Ignore the TTL meganism from client library # It causes a lots of issues, hence we take control over caching - self._toon._clear_cache() # pylint: disable=W0212 + self._toon._clear_cache() # pylint: disable=protected-access # Gather data from client library (single API call) self.gas = self._toon.gas diff --git a/homeassistant/components/updater/__init__.py b/homeassistant/components/updater/__init__.py index 22c11d0c38e..08f08e1bb64 100644 --- a/homeassistant/components/updater/__init__.py +++ b/homeassistant/components/updater/__init__.py @@ -2,7 +2,7 @@ import asyncio from datetime import timedelta -# pylint: disable=import-error,no-name-in-module +# pylint: disable=import-error from distutils.version import StrictVersion import json import logging diff --git a/homeassistant/components/upnp/device.py b/homeassistant/components/upnp/device.py index b87c3dc96b6..fffee57b411 100644 --- a/homeassistant/components/upnp/device.py +++ b/homeassistant/components/upnp/device.py @@ -150,7 +150,6 @@ class Device: async def async_get_total_packets_received(self): """Get total packets received.""" - # pylint: disable=invalid-name return await self._igd_device.async_get_total_packets_received() async def async_get_total_packets_sent(self): diff --git a/homeassistant/components/verisure/alarm_control_panel.py b/homeassistant/components/verisure/alarm_control_panel.py index b7cc822bd43..78a09e439d7 100644 --- a/homeassistant/components/verisure/alarm_control_panel.py +++ b/homeassistant/components/verisure/alarm_control_panel.py @@ -37,7 +37,6 @@ def set_arm_state(state, code=None): while "result" not in transaction: sleep(0.5) transaction = hub.session.get_arm_state_transaction(transaction_id) - # pylint: disable=unexpected-keyword-arg hub.update_overview(no_throttle=True) diff --git a/homeassistant/components/withings/common.py b/homeassistant/components/withings/common.py index 911bb08906b..655776ae004 100644 --- a/homeassistant/components/withings/common.py +++ b/homeassistant/components/withings/common.py @@ -226,7 +226,7 @@ class WithingsDataManager: WithingsDataManager.print_service_available() return result - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # Withings api encountered error. if isinstance(ex, (UnauthorizedException, AuthFailedException)): raise NotAuthenticatedError(ex) diff --git a/homeassistant/components/wled/config_flow.py b/homeassistant/components/wled/config_flow.py index 7be283874e0..c6b11fa1eb6 100644 --- a/homeassistant/components/wled/config_flow.py +++ b/homeassistant/components/wled/config_flow.py @@ -14,7 +14,7 @@ from homeassistant.const import CONF_HOST, CONF_MAC, CONF_NAME from homeassistant.helpers import ConfigType from homeassistant.helpers.aiohttp_client import async_get_clientsession -from .const import DOMAIN # pylint: disable=W0611 +from .const import DOMAIN # pylint: disable=unused-import _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/xmpp/notify.py b/homeassistant/components/xmpp/notify.py index 5aa9dbfffd1..338b0b85c03 100644 --- a/homeassistant/components/xmpp/notify.py +++ b/homeassistant/components/xmpp/notify.py @@ -190,7 +190,6 @@ async def async_send_message( message = self.Message(sto=recipient, stype="chat") message["body"] = url - # pylint: disable=invalid-sequence-index message["oob"]["url"] = url try: message.send() diff --git a/homeassistant/components/zeroconf/__init__.py b/homeassistant/components/zeroconf/__init__.py index 41a6c7510f9..9f27a5fafc9 100644 --- a/homeassistant/components/zeroconf/__init__.py +++ b/homeassistant/components/zeroconf/__init__.py @@ -1,7 +1,5 @@ """Support for exposing Home Assistant via Zeroconf.""" -# PyLint bug confuses absolute/relative imports -# https://github.com/PyCQA/pylint/issues/1931 -# pylint: disable=no-name-in-module + import logging import socket diff --git a/homeassistant/components/zha/__init__.py b/homeassistant/components/zha/__init__.py index be84795d962..ecd27c48839 100644 --- a/homeassistant/components/zha/__init__.py +++ b/homeassistant/components/zha/__init__.py @@ -100,8 +100,7 @@ async def async_setup_entry(hass, config_entry): if config.get(CONF_ENABLE_QUIRKS, True): # needs to be done here so that the ZHA module is finished loading # before zhaquirks is imported - # pylint: disable=W0611, W0612 - import zhaquirks # noqa: F401 + import zhaquirks # noqa: F401 pylint: disable=unused-import zha_gateway = ZHAGateway(hass, config, config_entry) await zha_gateway.async_initialize() diff --git a/homeassistant/components/zha/core/registries.py b/homeassistant/components/zha/core/registries.py index dd007e125a6..13688a6c420 100644 --- a/homeassistant/components/zha/core/registries.py +++ b/homeassistant/components/zha/core/registries.py @@ -27,7 +27,7 @@ from homeassistant.components.sensor import DOMAIN as SENSOR from homeassistant.components.switch import DOMAIN as SWITCH # importing channels updates registries -from . import channels # noqa: F401 pylint: disable=wrong-import-position,unused-import +from . import channels # noqa: F401 pylint: disable=unused-import from .const import ( CONTROLLER, SENSOR_ACCELERATION, diff --git a/homeassistant/components/zha/core/store.py b/homeassistant/components/zha/core/store.py index cea38517767..bcc9b2a42d4 100644 --- a/homeassistant/components/zha/core/store.py +++ b/homeassistant/components/zha/core/store.py @@ -1,5 +1,5 @@ """Data storage helper for ZHA.""" -# pylint: disable=W0611 +# pylint: disable=unused-import from collections import OrderedDict import logging from typing import MutableMapping diff --git a/homeassistant/components/zwave/config_flow.py b/homeassistant/components/zwave/config_flow.py index f28502db57f..a264cdea7da 100644 --- a/homeassistant/components/zwave/config_flow.py +++ b/homeassistant/components/zwave/config_flow.py @@ -48,8 +48,7 @@ class ZwaveFlowHandler(config_entries.ConfigFlow): try: from functools import partial - # pylint: disable=unused-variable - option = await self.hass.async_add_executor_job( # noqa: F841 + option = await self.hass.async_add_executor_job( # noqa: F841 pylint: disable=unused-variable partial( ZWaveOption, user_input[CONF_USB_STICK_PATH], diff --git a/homeassistant/config.py b/homeassistant/config.py index e6be2b9c7a5..71628be8006 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -627,7 +627,6 @@ async def merge_packages_config( _log_pkg_error: Callable = _log_pkg_error, ) -> Dict: """Merge packages into the top-level configuration. Mutate config.""" - # pylint: disable=too-many-nested-blocks PACKAGES_CONFIG_SCHEMA(packages) for pack_name, pack_conf in packages.items(): for comp_name, comp_conf in pack_conf.items(): @@ -766,7 +765,6 @@ async def async_process_component_config( # Validate platform specific schema if hasattr(platform, "PLATFORM_SCHEMA"): - # pylint: disable=no-member try: p_validated = platform.PLATFORM_SCHEMA( # type: ignore p_config diff --git a/homeassistant/core.py b/homeassistant/core.py index f5e91769107..2859e0fe157 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -75,7 +75,6 @@ from homeassistant.util.unit_system import ( ) # Typing imports that create a circular dependency -# pylint: disable=using-constant-test if TYPE_CHECKING: from homeassistant.config_entries import ConfigEntries from homeassistant.components.http import HomeAssistantHTTP diff --git a/homeassistant/exceptions.py b/homeassistant/exceptions.py index 0000a4b176e..6147e26c809 100644 --- a/homeassistant/exceptions.py +++ b/homeassistant/exceptions.py @@ -2,10 +2,8 @@ from typing import Optional, Tuple, TYPE_CHECKING import jinja2 -# pylint: disable=using-constant-test if TYPE_CHECKING: - # pylint: disable=unused-import - from .core import Context # noqa: F401 + from .core import Context # noqa: F401 pylint: disable=unused-import class HomeAssistantError(Exception): diff --git a/homeassistant/helpers/__init__.py b/homeassistant/helpers/__init__.py index 4c1a9803d75..fe60ffc4b33 100644 --- a/homeassistant/helpers/__init__.py +++ b/homeassistant/helpers/__init__.py @@ -4,7 +4,6 @@ from typing import Any, Iterable, Tuple, Sequence, Dict from homeassistant.const import CONF_PLATFORM -# pylint: disable=invalid-name ConfigType = Dict[str, Any] diff --git a/homeassistant/helpers/config_entry_flow.py b/homeassistant/helpers/config_entry_flow.py index 7a1512957a2..41f90effb89 100644 --- a/homeassistant/helpers/config_entry_flow.py +++ b/homeassistant/helpers/config_entry_flow.py @@ -24,7 +24,7 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow): self._domain = domain self._title = title self._discovery_function = discovery_function - self.CONNECTION_CLASS = connection_class # pylint: disable=C0103 + self.CONNECTION_CLASS = connection_class # pylint: disable=invalid-name async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 1e65c24eaaf..21dd0b71487 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -231,7 +231,6 @@ class Script: Should only be called on exceptions raised by this scripts async_run. """ - # pylint: disable=protected-access step = self._exception_step action = self.sequence[step] action_type = _determine_action(action) @@ -281,7 +280,6 @@ class Script: @callback def async_script_delay(now): """Handle delay.""" - # pylint: disable=cell-var-from-loop with suppress(ValueError): self._async_listener.remove(unsub) diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index e389f95dae1..f23d9cddfdd 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -142,7 +142,7 @@ class RenderInfo: def result(self) -> str: """Results of the template computation.""" if self._exception is not None: - raise self._exception # pylint: disable=raising-bad-type + raise self._exception return self._result def _freeze(self) -> None: diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 9c8d7d2aecb..af76b073cd3 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -26,7 +26,7 @@ from typing import ( ) # Typing imports that create a circular dependency -# pylint: disable=using-constant-test,unused-import +# pylint: disable=unused-import if TYPE_CHECKING: from homeassistant.core import HomeAssistant diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index 3bd466e2771..fec09a1d690 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -68,7 +68,6 @@ def load_yaml(fname: str) -> JSON_TYPE: raise HomeAssistantError(exc) -# pylint: disable=pointless-statement @overload def _add_reference( obj: Union[list, NodeListClass], loader: yaml.SafeLoader, node: yaml.nodes.Node diff --git a/pylintrc b/pylintrc index 5de08d06794..44659ddb376 100644 --- a/pylintrc +++ b/pylintrc @@ -50,6 +50,8 @@ disable= too-many-boolean-expressions, unnecessary-pass, unused-argument +enable= + use-symbolic-message-instead [REPORTS] score=no diff --git a/tests/components/daikin/test_config_flow.py b/tests/components/daikin/test_config_flow.py index f9fba67d554..674d918ed39 100644 --- a/tests/components/daikin/test_config_flow.py +++ b/tests/components/daikin/test_config_flow.py @@ -1,4 +1,4 @@ -# pylint: disable=W0621 +# pylint: disable=redefined-outer-name """Tests for the Daikin config flow.""" import asyncio diff --git a/tests/components/homematicip_cloud/conftest.py b/tests/components/homematicip_cloud/conftest.py index f60f8d659b5..fa19f573c7c 100644 --- a/tests/components/homematicip_cloud/conftest.py +++ b/tests/components/homematicip_cloud/conftest.py @@ -27,7 +27,9 @@ def mock_connection_fixture() -> AsyncConnection: def _rest_call_side_effect(path, body=None): return path, body - connection._restCall.side_effect = _rest_call_side_effect # pylint: disable=W0212 + connection._restCall.side_effect = ( # pylint: disable=protected-access + _rest_call_side_effect + ) connection.api_call.return_value = mock_coro(True) connection.init.side_effect = mock_coro(True) diff --git a/tests/components/homematicip_cloud/helper.py b/tests/components/homematicip_cloud/helper.py index 494ec2dc90b..42ff2061698 100644 --- a/tests/components/homematicip_cloud/helper.py +++ b/tests/components/homematicip_cloud/helper.py @@ -58,7 +58,9 @@ async def async_manipulate_test_data( fire_target = hmip_device if fire_device is None else fire_device if isinstance(fire_target, AsyncHome): - fire_target.fire_update_event(fire_target._rawJSONData) # pylint: disable=W0212 + fire_target.fire_update_event( + fire_target._rawJSONData # pylint: disable=protected-access + ) else: fire_target.fire_update_event() @@ -136,7 +138,9 @@ class HomeTemplate(Home): def _get_mock(instance): """Create a mock and copy instance attributes over mock.""" if isinstance(instance, Mock): - instance.__dict__.update(instance._mock_wraps.__dict__) # pylint: disable=W0212 + instance.__dict__.update( + instance._mock_wraps.__dict__ # pylint: disable=protected-access + ) return instance mock = Mock(spec=instance, wraps=instance) diff --git a/tests/components/homematicip_cloud/test_alarm_control_panel.py b/tests/components/homematicip_cloud/test_alarm_control_panel.py index 78bc0a09ea5..cf85e805143 100644 --- a/tests/components/homematicip_cloud/test_alarm_control_panel.py +++ b/tests/components/homematicip_cloud/test_alarm_control_panel.py @@ -18,7 +18,7 @@ async def _async_manipulate_security_zones( hass, home, internal_active=False, external_active=False, alarm_triggered=False ): """Set new values on hmip security zones.""" - json = home._rawJSONData # pylint: disable=W0212 + json = home._rawJSONData # pylint: disable=protected-access json["functionalHomes"]["SECURITY_AND_ALARM"]["alarmActive"] = alarm_triggered external_zone_id = json["functionalHomes"]["SECURITY_AND_ALARM"]["securityZones"][ "EXTERNAL" diff --git a/tests/components/homematicip_cloud/test_climate.py b/tests/components/homematicip_cloud/test_climate.py index 2b233a6dee2..d40a77751e8 100644 --- a/tests/components/homematicip_cloud/test_climate.py +++ b/tests/components/homematicip_cloud/test_climate.py @@ -367,7 +367,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "activate_absence_with_duration" assert home.mock_calls[-1][1] == (60,) - assert len(home._connection.mock_calls) == 1 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 1 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", @@ -377,7 +377,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "activate_absence_with_duration" assert home.mock_calls[-1][1] == (60,) - assert len(home._connection.mock_calls) == 2 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 2 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", @@ -387,7 +387,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "activate_absence_with_period" assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0),) - assert len(home._connection.mock_calls) == 3 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 3 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", @@ -397,7 +397,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "activate_absence_with_period" assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0),) - assert len(home._connection.mock_calls) == 4 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 4 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", @@ -407,7 +407,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "activate_vacation" assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0), 18.5) - assert len(home._connection.mock_calls) == 5 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 5 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", @@ -417,7 +417,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "activate_vacation" assert home.mock_calls[-1][1] == (datetime.datetime(2019, 2, 17, 14, 0), 18.5) - assert len(home._connection.mock_calls) == 6 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 6 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", @@ -427,14 +427,14 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "deactivate_absence" assert home.mock_calls[-1][1] == () - assert len(home._connection.mock_calls) == 7 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 7 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", "deactivate_eco_mode", blocking=True ) assert home.mock_calls[-1][0] == "deactivate_absence" assert home.mock_calls[-1][1] == () - assert len(home._connection.mock_calls) == 8 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 8 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", @@ -444,14 +444,14 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): ) assert home.mock_calls[-1][0] == "deactivate_vacation" assert home.mock_calls[-1][1] == () - assert len(home._connection.mock_calls) == 9 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 9 # pylint: disable=protected-access await hass.services.async_call( "homematicip_cloud", "deactivate_vacation", blocking=True ) assert home.mock_calls[-1][0] == "deactivate_vacation" assert home.mock_calls[-1][1] == () - assert len(home._connection.mock_calls) == 10 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 10 # pylint: disable=protected-access not_existing_hap_id = "5555F7110000000000000001" await hass.services.async_call( @@ -463,7 +463,7 @@ async def test_hmip_climate_services(hass, mock_hap_with_service): assert home.mock_calls[-1][0] == "deactivate_vacation" assert home.mock_calls[-1][1] == () # There is no further call on connection. - assert len(home._connection.mock_calls) == 10 # pylint: disable=W0212 + assert len(home._connection.mock_calls) == 10 # pylint: disable=protected-access async def test_hmip_heating_group_services(hass, mock_hap_with_service): @@ -485,7 +485,9 @@ async def test_hmip_heating_group_services(hass, mock_hap_with_service): ) assert hmip_device.mock_calls[-1][0] == "set_active_profile" assert hmip_device.mock_calls[-1][1] == (1,) - assert len(hmip_device._connection.mock_calls) == 2 # pylint: disable=W0212 + assert ( + len(hmip_device._connection.mock_calls) == 2 # pylint: disable=protected-access + ) await hass.services.async_call( "homematicip_cloud", @@ -495,4 +497,7 @@ async def test_hmip_heating_group_services(hass, mock_hap_with_service): ) assert hmip_device.mock_calls[-1][0] == "set_active_profile" assert hmip_device.mock_calls[-1][1] == (1,) - assert len(hmip_device._connection.mock_calls) == 12 # pylint: disable=W0212 + assert ( + len(hmip_device._connection.mock_calls) # pylint: disable=protected-access + == 12 + ) diff --git a/tests/components/homematicip_cloud/test_device.py b/tests/components/homematicip_cloud/test_device.py index 812f32a3344..77f99655c98 100644 --- a/tests/components/homematicip_cloud/test_device.py +++ b/tests/components/homematicip_cloud/test_device.py @@ -105,7 +105,7 @@ async def test_hap_reconnected(hass, default_mock_hap): ha_state = hass.states.get(entity_id) assert ha_state.state == STATE_UNAVAILABLE - default_mock_hap._accesspoint_connected = False # pylint: disable=W0212 + default_mock_hap._accesspoint_connected = False # pylint: disable=protected-access await async_manipulate_test_data(hass, default_mock_hap.home, "connected", True) await hass.async_block_till_done() ha_state = hass.states.get(entity_id) diff --git a/tests/components/logi_circle/test_config_flow.py b/tests/components/logi_circle/test_config_flow.py index 02a9437a225..6a291d5e7ab 100644 --- a/tests/components/logi_circle/test_config_flow.py +++ b/tests/components/logi_circle/test_config_flow.py @@ -40,7 +40,7 @@ def init_config_flow(hass): sensors=None, ) flow = config_flow.LogiCircleFlowHandler() - flow._get_authorization_url = Mock( # pylint: disable=W0212 + flow._get_authorization_url = Mock( # pylint: disable=protected-access return_value="http://example.com" ) flow.hass = hass @@ -65,7 +65,9 @@ def mock_logi_circle(): yield mock_logi_circle_ -async def test_step_import(hass, mock_logi_circle): # pylint: disable=W0621 +async def test_step_import( + hass, mock_logi_circle # pylint: disable=redefined-outer-name +): """Test that we trigger import when configuring with client.""" flow = init_config_flow(hass) @@ -75,8 +77,8 @@ async def test_step_import(hass, mock_logi_circle): # pylint: disable=W0621 async def test_full_flow_implementation( - hass, mock_logi_circle -): # pylint: disable=W0621 + hass, mock_logi_circle # pylint: disable=redefined-outer-name +): """Test registering an implementation and finishing flow works.""" config_flow.register_flow_implementation( hass, @@ -154,7 +156,7 @@ async def test_abort_if_already_setup(hass): ) async def test_abort_if_authorize_fails( hass, mock_logi_circle, side_effect, error -): # pylint: disable=W0621 +): # pylint: disable=redefined-outer-name """Test we abort if authorizing fails.""" flow = init_config_flow(hass) mock_logi_circle.LogiCircle().authorize.side_effect = side_effect @@ -176,7 +178,9 @@ async def test_not_pick_implementation_if_only_one(hass): assert result["step_id"] == "auth" -async def test_gen_auth_url(hass, mock_logi_circle): # pylint: disable=W0621 +async def test_gen_auth_url( + hass, mock_logi_circle +): # pylint: disable=redefined-outer-name """Test generating authorize URL from Logi Circle API.""" config_flow.register_flow_implementation( hass, @@ -192,7 +196,7 @@ async def test_gen_auth_url(hass, mock_logi_circle): # pylint: disable=W0621 flow.flow_impl = "test-auth-url" await async_setup_component(hass, "http", {}) - result = flow._get_authorization_url() # pylint: disable=W0212 + result = flow._get_authorization_url() # pylint: disable=protected-access assert result == "http://authorize.url" @@ -206,7 +210,7 @@ async def test_callback_view_rejects_missing_code(hass): async def test_callback_view_accepts_code( hass, mock_logi_circle -): # pylint: disable=W0621 +): # pylint: disable=redefined-outer-name """Test the auth callback view handles requests with auth code.""" init_config_flow(hass) view = LogiCircleAuthCallbackView() diff --git a/tests/components/owntracks/test_device_tracker.py b/tests/components/owntracks/test_device_tracker.py index daef624f9c2..3a7f3c030ed 100644 --- a/tests/components/owntracks/test_device_tracker.py +++ b/tests/components/owntracks/test_device_tracker.py @@ -1495,8 +1495,7 @@ async def test_encrypted_payload_no_topic_key(hass, setup_comp): async def test_encrypted_payload_libsodium(hass, setup_comp): """Test sending encrypted message payload.""" try: - # pylint: disable=unused-import - import nacl # noqa: F401 + import nacl # noqa: F401 pylint: disable=unused-import except (ImportError, OSError): pytest.skip("PyNaCl/libsodium is not installed") return diff --git a/tests/components/point/test_config_flow.py b/tests/components/point/test_config_flow.py index ec808b5fd80..b7b4cdfb47f 100644 --- a/tests/components/point/test_config_flow.py +++ b/tests/components/point/test_config_flow.py @@ -14,7 +14,7 @@ def init_config_flow(hass, side_effect=None): """Init a configuration flow.""" config_flow.register_flow_implementation(hass, DOMAIN, "id", "secret") flow = config_flow.PointFlowHandler() - flow._get_authorization_url = Mock( # pylint: disable=W0212 + flow._get_authorization_url = Mock( # pylint: disable=protected-access return_value=mock_coro("https://example.com"), side_effect=side_effect ) flow.hass = hass @@ -28,7 +28,7 @@ def is_authorized(): @pytest.fixture -def mock_pypoint(is_authorized): # pylint: disable=W0621 +def mock_pypoint(is_authorized): # pylint: disable=redefined-outer-name """Mock pypoint.""" with MockDependency("pypoint") as mock_pypoint_: mock_pypoint_.PointSession().get_access_token.return_value = { @@ -66,7 +66,9 @@ async def test_abort_if_already_setup(hass): assert result["reason"] == "already_setup" -async def test_full_flow_implementation(hass, mock_pypoint): # pylint: disable=W0621 +async def test_full_flow_implementation( + hass, mock_pypoint # pylint: disable=redefined-outer-name +): """Test registering an implementation and finishing flow works.""" config_flow.register_flow_implementation(hass, "test-other", None, None) flow = init_config_flow(hass) @@ -92,7 +94,7 @@ async def test_full_flow_implementation(hass, mock_pypoint): # pylint: disable= assert result["data"]["token"] == {"access_token": "boo"} -async def test_step_import(hass, mock_pypoint): # pylint: disable=W0621 +async def test_step_import(hass, mock_pypoint): # pylint: disable=redefined-outer-name """Test that we trigger import when configuring with client.""" flow = init_config_flow(hass) @@ -104,7 +106,7 @@ async def test_step_import(hass, mock_pypoint): # pylint: disable=W0621 @pytest.mark.parametrize("is_authorized", [False]) async def test_wrong_code_flow_implementation( hass, mock_pypoint -): # pylint: disable=W0621 +): # pylint: disable=redefined-outer-name """Test wrong code.""" flow = init_config_flow(hass) diff --git a/tests/components/smhi/common.py b/tests/components/smhi/common.py index 74c8a99b51f..6f215840324 100644 --- a/tests/components/smhi/common.py +++ b/tests/components/smhi/common.py @@ -5,7 +5,7 @@ from unittest.mock import Mock class AsyncMock(Mock): """Implements Mock async.""" - # pylint: disable=W0235 + # 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/smhi/test_config_flow.py b/tests/components/smhi/test_config_flow.py index ab317fb829a..e5e1d392419 100644 --- a/tests/components/smhi/test_config_flow.py +++ b/tests/components/smhi/test_config_flow.py @@ -9,7 +9,7 @@ from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE from homeassistant.components.smhi import config_flow -# pylint: disable=W0212 +# pylint: disable=protected-access async def test_homeassistant_location_exists() -> None: """Test if homeassistant location exists it should return True.""" hass = Mock() diff --git a/tests/components/smhi/test_weather.py b/tests/components/smhi/test_weather.py index 76b32895758..6cb7d690c1c 100644 --- a/tests/components/smhi/test_weather.py +++ b/tests/components/smhi/test_weather.py @@ -99,7 +99,7 @@ def test_properties_no_data(hass: HomeAssistant) -> None: assert weather.temperature_unit == TEMP_CELSIUS -# pylint: disable=W0212 +# pylint: disable=protected-access def test_properties_unknown_symbol() -> None: """Test behaviour when unknown symbol from API.""" hass = Mock() @@ -152,7 +152,7 @@ def test_properties_unknown_symbol() -> None: assert forecast[ATTR_FORECAST_CONDITION] is None -# pylint: disable=W0212 +# pylint: disable=protected-access async def test_refresh_weather_forecast_exceeds_retries(hass) -> None: """Test the refresh weather forecast function.""" from smhi.smhi_lib import SmhiForecastException