From d88ca0f5cb699c83cca21951cbc16eed0778ee28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 16 Nov 2019 11:22:07 +0200 Subject: [PATCH] Lint exclusions (#28655) * Remove malformed pylint disable markers * Remove some unused imports * Remove some unneeded lint exclusions * Remove more unneeded lint exclusions * Add specific codes to all noqa's --- homeassistant/auth/permissions/__init__.py | 16 ++------------ homeassistant/auth/permissions/models.py | 4 ++-- homeassistant/auth/permissions/util.py | 5 +++-- .../components/air_quality/__init__.py | 2 +- .../alarm_control_panel/__init__.py | 2 +- homeassistant/components/aws/__init__.py | 2 +- .../components/binary_sensor/__init__.py | 2 +- homeassistant/components/calendar/__init__.py | 2 +- homeassistant/components/camera/__init__.py | 2 +- homeassistant/components/climate/__init__.py | 2 +- homeassistant/components/cover/__init__.py | 2 +- homeassistant/components/daikin/__init__.py | 2 +- .../components/device_tracker/__init__.py | 4 ++-- .../dlib_face_detect/image_processing.py | 2 +- homeassistant/components/elkm1/__init__.py | 4 ++-- homeassistant/components/esphome/__init__.py | 2 +- homeassistant/components/fan/__init__.py | 2 +- .../components/geo_location/__init__.py | 2 +- homeassistant/components/homekit/__init__.py | 2 +- .../components/homekit_controller/__init__.py | 2 +- homeassistant/components/http/__init__.py | 4 ++-- homeassistant/components/ipma/__init__.py | 4 ++-- homeassistant/components/light/__init__.py | 2 +- homeassistant/components/lock/__init__.py | 2 +- .../components/mailgun/config_flow.py | 2 +- .../components/media_player/__init__.py | 2 +- homeassistant/components/met/__init__.py | 4 ++-- .../components/mobile_app/helpers.py | 2 +- homeassistant/components/mqtt/__init__.py | 2 +- .../components/owntracks/config_flow.py | 2 +- homeassistant/components/point/__init__.py | 2 +- homeassistant/components/remote/__init__.py | 2 +- homeassistant/components/sensor/__init__.py | 2 +- .../components/smartthings/__init__.py | 2 +- homeassistant/components/switch/__init__.py | 2 +- .../components/tellduslive/__init__.py | 2 +- homeassistant/components/tellduslive/const.py | 2 +- .../components/tensorflow/image_processing.py | 10 ++++----- homeassistant/components/toon/__init__.py | 4 ++-- homeassistant/components/tradfri/__init__.py | 2 +- homeassistant/components/tradfri/const.py | 2 +- homeassistant/components/vacuum/__init__.py | 2 +- .../components/water_heater/__init__.py | 2 +- homeassistant/components/weather/__init__.py | 2 +- homeassistant/components/zha/__init__.py | 4 ++-- .../components/zha/core/channels/__init__.py | 22 +++++++++---------- .../components/zha/core/decorators.py | 2 +- .../components/zha/core/registries.py | 2 +- homeassistant/components/zwave/__init__.py | 2 +- homeassistant/core.py | 2 +- homeassistant/exceptions.py | 2 +- homeassistant/loader.py | 4 ++-- homeassistant/monkey_patch.py | 2 +- homeassistant/util/__init__.py | 2 +- homeassistant/util/decorator.py | 2 +- homeassistant/util/yaml/loader.py | 6 ++--- tests/common.py | 4 ++-- tests/components/google_translate/test_tts.py | 2 +- .../logi_circle/test_config_flow.py | 6 ++--- tests/components/marytts/test_tts.py | 2 +- tests/components/mobile_app/test_entity.py | 14 ++++-------- tests/components/mobile_app/test_http_api.py | 5 ++--- tests/components/mobile_app/test_webhook.py | 17 +++++--------- tests/components/onboarding/test_views.py | 4 ++-- tests/components/point/test_config_flow.py | 6 ++--- tests/components/qwikswitch/test_init.py | 4 ++-- tests/components/voicerss/test_tts.py | 2 +- tests/components/yandextts/test_tts.py | 2 +- tests/helpers/test_check_config.py | 1 - tests/helpers/test_service.py | 2 +- tests/scripts/test_check_config.py | 1 - .../test_package/__init__.py | 2 +- tests/util/test_async.py | 2 +- 73 files changed, 113 insertions(+), 142 deletions(-) diff --git a/homeassistant/auth/permissions/__init__.py b/homeassistant/auth/permissions/__init__.py index 25253a1601c..f0e093953e1 100644 --- a/homeassistant/auth/permissions/__init__.py +++ b/homeassistant/auth/permissions/__init__.py @@ -1,18 +1,6 @@ """Permissions for Home Assistant.""" import logging -from typing import ( # noqa: F401 - cast, - Any, - Callable, - Dict, - List, - Mapping, - Optional, - Set, - Tuple, - Union, - TYPE_CHECKING, -) +from typing import Any, Callable, Optional import voluptuous as vol @@ -20,7 +8,7 @@ from .const import CAT_ENTITIES from .models import PermissionLookup from .types import PolicyType from .entities import ENTITY_POLICY_SCHEMA, compile_entities -from .merge import merge_policies # noqa +from .merge import merge_policies # noqa: F401 from .util import test_all diff --git a/homeassistant/auth/permissions/models.py b/homeassistant/auth/permissions/models.py index 31bea635bbe..1224ea07b23 100644 --- a/homeassistant/auth/permissions/models.py +++ b/homeassistant/auth/permissions/models.py @@ -5,8 +5,8 @@ import attr if TYPE_CHECKING: # pylint: disable=unused-import - from homeassistant.helpers import entity_registry as ent_reg # noqa - from homeassistant.helpers import device_registry as dev_reg # noqa + from homeassistant.helpers import entity_registry as ent_reg # noqa: F401 + from homeassistant.helpers import device_registry as dev_reg # noqa: F401 @attr.s(slots=True) diff --git a/homeassistant/auth/permissions/util.py b/homeassistant/auth/permissions/util.py index 109a5dc04ae..4d38e0a639c 100644 --- a/homeassistant/auth/permissions/util.py +++ b/homeassistant/auth/permissions/util.py @@ -21,8 +21,9 @@ def lookup_all( def compile_policy( policy: CategoryType, subcategories: SubCatLookupType, perm_lookup: PermissionLookup -) -> Callable[[str, str], bool]: # noqa +) -> Callable[[str, str], bool]: """Compile policy into a function that tests policy. + Subcategories are mapping key -> lookup function, ordered by highest priority first. """ @@ -80,7 +81,7 @@ def compile_policy( def _gen_dict_test_func( perm_lookup: PermissionLookup, lookup_func: LookupFunc, lookup_dict: SubCategoryDict -) -> Callable[[str, str], Optional[bool]]: # noqa +) -> Callable[[str, str], Optional[bool]]: """Generate a lookup function.""" def test_value(object_id: str, key: str) -> Optional[bool]: diff --git a/homeassistant/components/air_quality/__init__.py b/homeassistant/components/air_quality/__init__.py index 3d8bb92572a..00308c40b36 100644 --- a/homeassistant/components/air_quality/__init__.py +++ b/homeassistant/components/air_quality/__init__.py @@ -3,7 +3,7 @@ from datetime import timedelta import logging from homeassistant.helpers.entity_component import EntityComponent -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/alarm_control_panel/__init__.py b/homeassistant/components/alarm_control_panel/__init__.py index ab0b810ee83..6faad5dd51f 100644 --- a/homeassistant/components/alarm_control_panel/__init__.py +++ b/homeassistant/components/alarm_control_panel/__init__.py @@ -14,7 +14,7 @@ from homeassistant.const import ( SERVICE_ALARM_ARM_NIGHT, SERVICE_ALARM_ARM_CUSTOM_BYPASS, ) -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 ENTITY_SERVICE_SCHEMA, PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, diff --git a/homeassistant/components/aws/__init__.py b/homeassistant/components/aws/__init__.py index 780a65b2d47..b553b7eafd6 100644 --- a/homeassistant/components/aws/__init__.py +++ b/homeassistant/components/aws/__init__.py @@ -12,7 +12,7 @@ from homeassistant.const import ATTR_CREDENTIALS, CONF_NAME, CONF_PROFILE_NAME from homeassistant.helpers import config_validation as cv, discovery # Loading the config flow file will register the flow -from . import config_flow # noqa +from . import config_flow # noqa: F401 from .const import ( CONF_ACCESS_KEY_ID, CONF_CONTEXT, diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index 9af6a10c425..e5f5dc94ff1 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -8,7 +8,7 @@ import voluptuous as vol from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity import Entity from homeassistant.const import STATE_ON, STATE_OFF -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/calendar/__init__.py b/homeassistant/components/calendar/__init__.py index 32817242642..ca240925cf5 100644 --- a/homeassistant/components/calendar/__init__.py +++ b/homeassistant/components/calendar/__init__.py @@ -7,7 +7,7 @@ from aiohttp import web from homeassistant.components import http from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, time_period_str, diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index 68cd1f51dda..58b6db139f5 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -24,7 +24,7 @@ from homeassistant.exceptions import HomeAssistantError from homeassistant.loader import bind_hass from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity_component import EntityComponent -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index 0c8d6103b12..f0d350fc0ba 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -17,7 +17,7 @@ from homeassistant.const import ( TEMP_CELSIUS, ) import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 ENTITY_SERVICE_SCHEMA, PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, diff --git a/homeassistant/components/cover/__init__.py b/homeassistant/components/cover/__init__.py index cfac143a5d8..d57bf678a69 100644 --- a/homeassistant/components/cover/__init__.py +++ b/homeassistant/components/cover/__init__.py @@ -9,7 +9,7 @@ import voluptuous as vol from homeassistant.loader import bind_hass from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity import Entity -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/daikin/__init__.py b/homeassistant/components/daikin/__init__.py index 390e80d0916..7d476e17647 100644 --- a/homeassistant/components/daikin/__init__.py +++ b/homeassistant/components/daikin/__init__.py @@ -15,7 +15,7 @@ from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.typing import HomeAssistantType from homeassistant.util import Throttle -from . import config_flow # noqa pylint_disable=unused-import +from . import config_flow # noqa: F401 _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/device_tracker/__init__.py b/homeassistant/components/device_tracker/__init__.py index 84bc76e0b04..25e33d2a2db 100644 --- a/homeassistant/components/device_tracker/__init__.py +++ b/homeassistant/components/device_tracker/__init__.py @@ -13,11 +13,11 @@ from homeassistant.helpers.event import async_track_utc_time_change from homeassistant.const import ATTR_GPS_ACCURACY, STATE_HOME from . import legacy, setup -from .config_entry import ( # noqa # pylint: disable=unused-import +from .config_entry import ( # noqa: F401 pylint: disable=unused-import async_setup_entry, async_unload_entry, ) -from .legacy import DeviceScanner # noqa # pylint: disable=unused-import +from .legacy import DeviceScanner # noqa: F401 pylint: disable=unused-import from .const import ( ATTR_ATTRIBUTES, ATTR_BATTERY, diff --git a/homeassistant/components/dlib_face_detect/image_processing.py b/homeassistant/components/dlib_face_detect/image_processing.py index cdd8bc101b5..6e5c49e7aba 100644 --- a/homeassistant/components/dlib_face_detect/image_processing.py +++ b/homeassistant/components/dlib_face_detect/image_processing.py @@ -12,7 +12,7 @@ from homeassistant.components.image_processing import ( ) # pylint: disable=unused-import -from homeassistant.components.image_processing import PLATFORM_SCHEMA # noqa +from homeassistant.components.image_processing import PLATFORM_SCHEMA # noqa: F401 from homeassistant.core import split_entity_id _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index d257c46839c..601309590c8 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -14,10 +14,10 @@ from homeassistant.const import ( CONF_TEMPERATURE_UNIT, CONF_USERNAME, ) -from homeassistant.core import HomeAssistant, callback # noqa +from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_validation as cv, discovery from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import ConfigType # noqa +from homeassistant.helpers.typing import ConfigType DOMAIN = "elkm1" diff --git a/homeassistant/components/esphome/__init__.py b/homeassistant/components/esphome/__init__.py index a669726ca38..2ad24e6f75e 100644 --- a/homeassistant/components/esphome/__init__.py +++ b/homeassistant/components/esphome/__init__.py @@ -38,7 +38,7 @@ from homeassistant.helpers.template import Template from homeassistant.helpers.typing import ConfigType, HomeAssistantType # Import config flow so that it's added to the registry -from .config_flow import EsphomeFlowHandler # noqa +from .config_flow import EsphomeFlowHandler # noqa: F401 from .entry_data import ( DATA_KEY, DISPATCHER_ON_DEVICE_UPDATE, diff --git a/homeassistant/components/fan/__init__.py b/homeassistant/components/fan/__init__.py index 82f4d37938c..4c6cee2927c 100644 --- a/homeassistant/components/fan/__init__.py +++ b/homeassistant/components/fan/__init__.py @@ -11,7 +11,7 @@ from homeassistant.const import SERVICE_TURN_ON, SERVICE_TOGGLE, SERVICE_TURN_OF from homeassistant.loader import bind_hass from homeassistant.helpers.entity import ToggleEntity from homeassistant.helpers.entity_component import EntityComponent -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 ENTITY_SERVICE_SCHEMA, PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, diff --git a/homeassistant/components/geo_location/__init__.py b/homeassistant/components/geo_location/__init__.py index 3c270f2c521..e5c587f93ed 100644 --- a/homeassistant/components/geo_location/__init__.py +++ b/homeassistant/components/geo_location/__init__.py @@ -4,7 +4,7 @@ import logging from typing import Optional from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 4c300e0a934..bb525271cec 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -363,7 +363,7 @@ class HomeKit: self.status = STATUS_WAIT # pylint: disable=unused-import - from . import ( # noqa F401 + from . import ( # noqa: F401 type_covers, type_fans, type_lights, diff --git a/homeassistant/components/homekit_controller/__init__.py b/homeassistant/components/homekit_controller/__init__.py index 6a649284722..4ca54099d24 100644 --- a/homeassistant/components/homekit_controller/__init__.py +++ b/homeassistant/components/homekit_controller/__init__.py @@ -13,7 +13,7 @@ from homeassistant.helpers import device_registry as dr from .config_flow import HomekitControllerFlowHandler # noqa: F401 from .connection import get_accessory_information, HKDevice from .const import CONTROLLER, ENTITY_MAP, KNOWN_DEVICES -from .const import DOMAIN # noqa: pylint: disable=unused-import +from .const import DOMAIN from .storage import EntityMapStorage _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/http/__init__.py b/homeassistant/components/http/__init__.py index 4df606a3c1b..4d3985a7af3 100644 --- a/homeassistant/components/http/__init__.py +++ b/homeassistant/components/http/__init__.py @@ -20,11 +20,11 @@ from homeassistant.util import ssl as ssl_util from .auth import setup_auth from .ban import setup_bans -from .const import KEY_AUTHENTICATED, KEY_HASS, KEY_HASS_USER, KEY_REAL_IP # noqa +from .const import KEY_AUTHENTICATED, KEY_HASS, KEY_HASS_USER, KEY_REAL_IP # noqa: F401 from .cors import setup_cors from .real_ip import setup_real_ip from .static import CACHE_HEADERS, CachingStaticResource -from .view import HomeAssistantView # noqa +from .view import HomeAssistantView # noqa: F401 # mypy: allow-untyped-defs, no-check-untyped-defs diff --git a/homeassistant/components/ipma/__init__.py b/homeassistant/components/ipma/__init__.py index 39cb670999f..702e12a8a63 100644 --- a/homeassistant/components/ipma/__init__.py +++ b/homeassistant/components/ipma/__init__.py @@ -1,7 +1,7 @@ """Component for the Portuguese weather service - IPMA.""" from homeassistant.core import Config, HomeAssistant -from .config_flow import IpmaFlowHandler # noqa -from .const import DOMAIN # noqa +from .config_flow import IpmaFlowHandler # noqa: F401 +from .const import DOMAIN # noqa: F401 DEFAULT_NAME = "ipma" diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index fbd908a9e45..2ca5e496b10 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -19,7 +19,7 @@ from homeassistant.const import ( ) from homeassistant.exceptions import UnknownUser, Unauthorized import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ENTITY_SERVICE_SCHEMA, diff --git a/homeassistant/components/lock/__init__.py b/homeassistant/components/lock/__init__.py index 503bd3a8c78..341df1bb28a 100644 --- a/homeassistant/components/lock/__init__.py +++ b/homeassistant/components/lock/__init__.py @@ -8,7 +8,7 @@ import voluptuous as vol from homeassistant.loader import bind_hass from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity import Entity -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 ENTITY_SERVICE_SCHEMA, PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, diff --git a/homeassistant/components/mailgun/config_flow.py b/homeassistant/components/mailgun/config_flow.py index e1c6abbc1ca..c575b4c0354 100644 --- a/homeassistant/components/mailgun/config_flow.py +++ b/homeassistant/components/mailgun/config_flow.py @@ -7,7 +7,7 @@ config_entry_flow.register_webhook_flow( DOMAIN, "Mailgun Webhook", { - "mailgun_url": "https://documentation.mailgun.com/en/latest/user_manual.html#webhooks", # noqa: E501 pylint: disable=line-too-long + "mailgun_url": "https://documentation.mailgun.com/en/latest/user_manual.html#webhooks", "docs_url": "https://www.home-assistant.io/integrations/mailgun/", }, ) diff --git a/homeassistant/components/media_player/__init__.py b/homeassistant/components/media_player/__init__.py index 98da19fd98e..c783772365b 100644 --- a/homeassistant/components/media_player/__init__.py +++ b/homeassistant/components/media_player/__init__.py @@ -39,7 +39,7 @@ from homeassistant.const import ( ) from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 ENTITY_SERVICE_SCHEMA, PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, diff --git a/homeassistant/components/met/__init__.py b/homeassistant/components/met/__init__.py index 63b95b03821..305038c3e6a 100644 --- a/homeassistant/components/met/__init__.py +++ b/homeassistant/components/met/__init__.py @@ -1,7 +1,7 @@ """The met component.""" from homeassistant.core import Config, HomeAssistant -from .config_flow import MetFlowHandler # noqa -from .const import DOMAIN # noqa +from .config_flow import MetFlowHandler # noqa: F401 +from .const import DOMAIN # noqa: F401 async def async_setup(hass: HomeAssistant, config: Config) -> bool: diff --git a/homeassistant/components/mobile_app/helpers.py b/homeassistant/components/mobile_app/helpers.py index 2fb949720d6..cad25f371dd 100644 --- a/homeassistant/components/mobile_app/helpers.py +++ b/homeassistant/components/mobile_app/helpers.py @@ -111,7 +111,7 @@ def error_response( def supports_encryption() -> bool: """Test if we support encryption.""" try: - import nacl # noqa pylint: disable=unused-import + import nacl # noqa: F401 pylint: disable=unused-import return True except OSError: diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 2fab599ac3f..70523a840a3 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -47,7 +47,7 @@ from homeassistant.util.async_ import run_callback_threadsafe from homeassistant.util.logging import catch_log_exception # Loading the config flow file will register the flow -from . import config_flow, discovery, server # noqa pylint: disable=unused-import +from . import config_flow, discovery, server # noqa: F401 pylint: disable=unused-import from .const import ( CONF_BROKER, CONF_DISCOVERY, diff --git a/homeassistant/components/owntracks/config_flow.py b/homeassistant/components/owntracks/config_flow.py index a59cd869c74..5034114293f 100644 --- a/homeassistant/components/owntracks/config_flow.py +++ b/homeassistant/components/owntracks/config_flow.py @@ -12,7 +12,7 @@ CONF_CLOUDHOOK = "cloudhook" def supports_encryption(): """Test if we support encryption.""" try: - import nacl # noqa pylint: disable=unused-import + import nacl # noqa: F401 pylint: disable=unused-import return True except OSError: diff --git a/homeassistant/components/point/__init__.py b/homeassistant/components/point/__init__.py index e9885891553..9c5ec4d5529 100644 --- a/homeassistant/components/point/__init__.py +++ b/homeassistant/components/point/__init__.py @@ -17,7 +17,7 @@ from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.typing import HomeAssistantType from homeassistant.util.dt import as_local, parse_datetime, utc_from_timestamp -from . import config_flow # noqa pylint_disable=unused-import +from . import config_flow from .const import ( CONF_WEBHOOK_URL, DOMAIN, diff --git a/homeassistant/components/remote/__init__.py b/homeassistant/components/remote/__init__.py index 450b1c123c3..71059b98f35 100644 --- a/homeassistant/components/remote/__init__.py +++ b/homeassistant/components/remote/__init__.py @@ -16,7 +16,7 @@ from homeassistant.const import ( SERVICE_TOGGLE, ) from homeassistant.components import group -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 ENTITY_SERVICE_SCHEMA, PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index 9ca11b5266a..53e4b0ffcf7 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -15,7 +15,7 @@ from homeassistant.const import ( DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TIMESTAMP, ) -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/smartthings/__init__.py b/homeassistant/components/smartthings/__init__.py index 93f7cbb8f32..9787fb53917 100644 --- a/homeassistant/components/smartthings/__init__.py +++ b/homeassistant/components/smartthings/__init__.py @@ -20,7 +20,7 @@ from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.typing import ConfigType, HomeAssistantType -from .config_flow import SmartThingsFlowHandler # noqa +from .config_flow import SmartThingsFlowHandler # noqa: F401 from .const import ( CONF_APP_ID, CONF_INSTALLED_APP_ID, diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index aa7459d1d3c..26d5658d668 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.loader import bind_hass from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity import ToggleEntity -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/tellduslive/__init__.py b/homeassistant/components/tellduslive/__init__.py index 7234127a152..313699e6f1c 100644 --- a/homeassistant/components/tellduslive/__init__.py +++ b/homeassistant/components/tellduslive/__init__.py @@ -10,7 +10,7 @@ from homeassistant import config_entries from homeassistant.const import CONF_SCAN_INTERVAL from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.event import async_call_later -from . import config_flow # noqa pylint_disable=unused-import +from . import config_flow # noqa: F401 from .const import ( CONF_HOST, DOMAIN, diff --git a/homeassistant/components/tellduslive/const.py b/homeassistant/components/tellduslive/const.py index b352f339d22..8d9f28cc5cf 100644 --- a/homeassistant/components/tellduslive/const.py +++ b/homeassistant/components/tellduslive/const.py @@ -1,7 +1,7 @@ """Consts used by TelldusLive.""" from datetime import timedelta -from homeassistant.const import ( # noqa pylint: disable=unused-import +from homeassistant.const import ( # noqa: F401 pylint: disable=unused-import ATTR_BATTERY_LEVEL, CONF_HOST, CONF_TOKEN, diff --git a/homeassistant/components/tensorflow/image_processing.py b/homeassistant/components/tensorflow/image_processing.py index ea73d52fe4a..c9c1b00aae4 100644 --- a/homeassistant/components/tensorflow/image_processing.py +++ b/homeassistant/components/tensorflow/image_processing.py @@ -89,25 +89,23 @@ def setup_platform(hass, config, add_entities, discovery_info=None): try: # Verify that the TensorFlow Object Detection API is pre-installed - # pylint: disable=unused-import,unused-variable os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" # These imports shouldn't be moved to the top, because they depend on code from the model_dir. # (The model_dir is created during the manual setup process. See integration docs.) - import tensorflow as tf # noqa - from object_detection.utils import label_map_util # noqa + import tensorflow as tf + from object_detection.utils import label_map_util except ImportError: - # pylint: disable=line-too-long _LOGGER.error( "No TensorFlow Object Detection library found! Install or compile " "for your system following instructions here: " "https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md" - ) # noqa + ) return try: # Display warning that PIL will be used if no OpenCV is found. # pylint: disable=unused-import,unused-variable - import cv2 # noqa + import cv2 # noqa: F401 except ImportError: _LOGGER.warning( "No OpenCV library found. TensorFlow will process image with " diff --git a/homeassistant/components/toon/__init__.py b/homeassistant/components/toon/__init__.py index 4a3afb9b87b..ed627fdc924 100644 --- a/homeassistant/components/toon/__init__.py +++ b/homeassistant/components/toon/__init__.py @@ -13,7 +13,7 @@ from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.helpers.event import async_track_time_interval from homeassistant.helpers.dispatcher import dispatcher_send, async_dispatcher_connect -from . import config_flow # noqa pylint_disable=unused-import +from . import config_flow # noqa: F401 from .const import ( CONF_CLIENT_ID, CONF_CLIENT_SECRET, @@ -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() # noqa pylint: disable=W0212 + self._toon._clear_cache() # pylint: disable=W0212 # Gather data from client library (single API call) self.gas = self._toon.gas diff --git a/homeassistant/components/tradfri/__init__.py b/homeassistant/components/tradfri/__init__.py index 9d1a43b240f..bb445647310 100644 --- a/homeassistant/components/tradfri/__init__.py +++ b/homeassistant/components/tradfri/__init__.py @@ -10,7 +10,7 @@ from homeassistant import config_entries from homeassistant.const import EVENT_HOMEASSISTANT_STOP from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.util.json import load_json -from . import config_flow # noqa pylint_disable=unused-import +from . import config_flow # noqa: F401 from .const import ( DOMAIN, CONFIG_FILE, diff --git a/homeassistant/components/tradfri/const.py b/homeassistant/components/tradfri/const.py index 038f0e91c76..01d2f18501d 100644 --- a/homeassistant/components/tradfri/const.py +++ b/homeassistant/components/tradfri/const.py @@ -1,6 +1,6 @@ """Consts used by Tradfri.""" from homeassistant.components.light import SUPPORT_TRANSITION, SUPPORT_BRIGHTNESS -from homeassistant.const import CONF_HOST # noqa pylint: disable=unused-import +from homeassistant.const import CONF_HOST # noqa: F401 pylint: disable=unused-import ATTR_DIMMER = "dimmer" ATTR_HUE = "hue" diff --git a/homeassistant/components/vacuum/__init__.py b/homeassistant/components/vacuum/__init__.py index ace3f610606..c1f1131a52f 100644 --- a/homeassistant/components/vacuum/__init__.py +++ b/homeassistant/components/vacuum/__init__.py @@ -18,7 +18,7 @@ from homeassistant.const import ( # noqa: F401 # STATE_PAUSED/IDLE are API ) from homeassistant.loader import bind_hass import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 ENTITY_SERVICE_SCHEMA, PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, diff --git a/homeassistant/components/water_heater/__init__.py b/homeassistant/components/water_heater/__init__.py index c41381fe5fa..6e7b918c289 100644 --- a/homeassistant/components/water_heater/__init__.py +++ b/homeassistant/components/water_heater/__init__.py @@ -9,7 +9,7 @@ from homeassistant.helpers.temperature import display_temp as show_temp from homeassistant.util.temperature import convert as convert_temperature from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.entity import Entity -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/weather/__init__.py b/homeassistant/components/weather/__init__.py index fd122f66ac2..bdeedd4cd6b 100644 --- a/homeassistant/components/weather/__init__.py +++ b/homeassistant/components/weather/__init__.py @@ -3,7 +3,7 @@ from datetime import timedelta import logging from homeassistant.const import PRECISION_TENTHS, PRECISION_WHOLE, TEMP_CELSIUS -from homeassistant.helpers.config_validation import ( # noqa +from homeassistant.helpers.config_validation import ( # noqa: F401 PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE, ) diff --git a/homeassistant/components/zha/__init__.py b/homeassistant/components/zha/__init__.py index ab686a97989..be84795d962 100644 --- a/homeassistant/components/zha/__init__.py +++ b/homeassistant/components/zha/__init__.py @@ -8,7 +8,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE # Loading the config flow file will register the flow -from . import config_flow # noqa # pylint: disable=unused-import +from . import config_flow # noqa: F401 pylint: disable=unused-import from . import api from .core import ZHAGateway from .core.const import ( @@ -101,7 +101,7 @@ async def async_setup_entry(hass, config_entry): # needs to be done here so that the ZHA module is finished loading # before zhaquirks is imported # pylint: disable=W0611, W0612 - import zhaquirks # noqa + import zhaquirks # noqa: F401 zha_gateway = ZHAGateway(hass, config, config_entry) await zha_gateway.async_initialize() diff --git a/homeassistant/components/zha/core/channels/__init__.py b/homeassistant/components/zha/core/channels/__init__.py index 66a31ff8f21..29cecb7784e 100644 --- a/homeassistant/components/zha/core/channels/__init__.py +++ b/homeassistant/components/zha/core/channels/__init__.py @@ -395,14 +395,14 @@ class EventRelayChannel(ZigbeeChannel): # pylint: disable=wrong-import-position -from . import closures # noqa -from . import general # noqa -from . import homeautomation # noqa -from . import hvac # noqa -from . import lighting # noqa -from . import lightlink # noqa -from . import manufacturerspecific # noqa -from . import measurement # noqa -from . import protocol # noqa -from . import security # noqa -from . import smartenergy # noqa +from . import closures # noqa: F401 +from . import general # noqa: F401 +from . import homeautomation # noqa: F401 +from . import hvac # noqa: F401 +from . import lighting # noqa: F401 +from . import lightlink # noqa: F401 +from . import manufacturerspecific # noqa: F401 +from . import measurement # noqa: F401 +from . import protocol # noqa: F401 +from . import security # noqa: F401 +from . import smartenergy # noqa: F401 diff --git a/homeassistant/components/zha/core/decorators.py b/homeassistant/components/zha/core/decorators.py index 4148cff6ca9..c416548dbe9 100644 --- a/homeassistant/components/zha/core/decorators.py +++ b/homeassistant/components/zha/core/decorators.py @@ -1,7 +1,7 @@ """Decorators for ZHA core registries.""" from typing import Callable, TypeVar, Union -CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # noqa pylint: disable=invalid-name +CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-name class DictRegistry(dict): diff --git a/homeassistant/components/zha/core/registries.py b/homeassistant/components/zha/core/registries.py index 571e77d4fae..dd007e125a6 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 pylint: disable=wrong-import-position,unused-import +from . import channels # noqa: F401 pylint: disable=wrong-import-position,unused-import from .const import ( CONTROLLER, SENSOR_ACCELERATION, diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index 97a904c5d99..293cc45273f 100644 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -35,7 +35,7 @@ from homeassistant.helpers.dispatcher import ( ) from . import const -from . import config_flow # noqa pylint: disable=unused-import +from . import config_flow # noqa: F401 pylint: disable=unused-import from . import websocket_api as wsapi from .const import ( CONF_AUTOHEAL, diff --git a/homeassistant/core.py b/homeassistant/core.py index 01c5561d939..f5e91769107 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -68,7 +68,7 @@ from homeassistant.util.async_ import run_callback_threadsafe, fire_coroutine_th from homeassistant import util import homeassistant.util.dt as dt_util from homeassistant.util import location, slugify -from homeassistant.util.unit_system import ( # NOQA +from homeassistant.util.unit_system import ( UnitSystem, IMPERIAL_SYSTEM, METRIC_SYSTEM, diff --git a/homeassistant/exceptions.py b/homeassistant/exceptions.py index 89caf730ad7..0000a4b176e 100644 --- a/homeassistant/exceptions.py +++ b/homeassistant/exceptions.py @@ -5,7 +5,7 @@ import jinja2 # pylint: disable=using-constant-test if TYPE_CHECKING: # pylint: disable=unused-import - from .core import Context # noqa + from .core import Context # noqa: F401 class HomeAssistantError(Exception): diff --git a/homeassistant/loader.py b/homeassistant/loader.py index e32303ecfab..9c8d7d2aecb 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -28,9 +28,9 @@ from typing import ( # Typing imports that create a circular dependency # pylint: disable=using-constant-test,unused-import if TYPE_CHECKING: - from homeassistant.core import HomeAssistant # noqa + from homeassistant.core import HomeAssistant -CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # noqa pylint: disable=invalid-name +CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-name DEPENDENCY_BLACKLIST = {"config"} diff --git a/homeassistant/monkey_patch.py b/homeassistant/monkey_patch.py index 2c5227988d3..c6e2e66ab13 100644 --- a/homeassistant/monkey_patch.py +++ b/homeassistant/monkey_patch.py @@ -68,6 +68,6 @@ def disable_c_asyncio() -> None: sys.path.insert(0, AsyncioImportFinder.PATH_TRIGGER) try: - import _asyncio # noqa + import _asyncio # noqa: F401 except ImportError: pass diff --git a/homeassistant/util/__init__.py b/homeassistant/util/__init__.py index 0f4f3c867ad..408d1e370d4 100644 --- a/homeassistant/util/__init__.py +++ b/homeassistant/util/__init__.py @@ -15,7 +15,7 @@ from typing import ( TypeVar, Callable, KeysView, - Union, # noqa + Union, Iterable, Coroutine, ) diff --git a/homeassistant/util/decorator.py b/homeassistant/util/decorator.py index ecf1284b1b1..83c63711c7d 100644 --- a/homeassistant/util/decorator.py +++ b/homeassistant/util/decorator.py @@ -1,7 +1,7 @@ """Decorator utility functions.""" from typing import Callable, TypeVar -CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # noqa pylint: disable=invalid-name +CALLABLE_T = TypeVar("CALLABLE_T", bound=Callable) # pylint: disable=invalid-name class Registry(dict): diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index bbbe22c2ba8..47635cd66c3 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -76,14 +76,14 @@ def _add_reference( ... -@overload # noqa: F811 +@overload def _add_reference( obj: Union[str, NodeStrClass], loader: yaml.SafeLoader, node: yaml.nodes.Node ) -> NodeStrClass: ... -@overload # noqa: F811 +@overload def _add_reference( obj: DICT_T, loader: yaml.SafeLoader, node: yaml.nodes.Node ) -> DICT_T: @@ -93,7 +93,7 @@ def _add_reference( # pylint: enable=pointless-statement -def _add_reference( # type: ignore # noqa: F811 +def _add_reference( # type: ignore obj, loader: SafeLineLoader, node: yaml.nodes.Node ): """Add file reference information to an object.""" diff --git a/tests/common.py b/tests/common.py index f40019c5d24..e652e10cc54 100644 --- a/tests/common.py +++ b/tests/common.py @@ -56,7 +56,7 @@ from homeassistant.helpers.json import JSONEncoder from homeassistant.setup import async_setup_component, setup_component from homeassistant.util.unit_system import METRIC_SYSTEM from homeassistant.util.async_ import run_callback_threadsafe -from homeassistant.components.device_automation import ( # noqa +from homeassistant.components.device_automation import ( # noqa: F401 _async_get_device_automations as async_get_device_automations, _async_get_device_automation_capabilities as async_get_device_automation_capabilities, ) @@ -1084,7 +1084,7 @@ class hashdict(dict): """ - def __key(self): # noqa: D105 no docstring + def __key(self): return tuple(sorted(self.items())) def __repr__(self): # noqa: D105 no docstring diff --git a/tests/components/google_translate/test_tts.py b/tests/components/google_translate/test_tts.py index e9d19a8f4f1..13f9eb88fce 100644 --- a/tests/components/google_translate/test_tts.py +++ b/tests/components/google_translate/test_tts.py @@ -14,7 +14,7 @@ from homeassistant.setup import setup_component from tests.common import get_test_home_assistant, assert_setup_component, mock_service -from tests.components.tts.test_init import mutagen_mock # noqa +from tests.components.tts.test_init import mutagen_mock # noqa: F401 class TestTTSGooglePlatform: diff --git a/tests/components/logi_circle/test_config_flow.py b/tests/components/logi_circle/test_config_flow.py index ebfae2af451..02a9437a225 100644 --- a/tests/components/logi_circle/test_config_flow.py +++ b/tests/components/logi_circle/test_config_flow.py @@ -76,7 +76,7 @@ async def test_step_import(hass, mock_logi_circle): # pylint: disable=W0621 async def test_full_flow_implementation( hass, mock_logi_circle -): # noqa pylint: disable=W0621 +): # pylint: disable=W0621 """Test registering an implementation and finishing flow works.""" config_flow.register_flow_implementation( hass, @@ -154,7 +154,7 @@ async def test_abort_if_already_setup(hass): ) async def test_abort_if_authorize_fails( hass, mock_logi_circle, side_effect, error -): # noqa pylint: disable=W0621 +): # pylint: disable=W0621 """Test we abort if authorizing fails.""" flow = init_config_flow(hass) mock_logi_circle.LogiCircle().authorize.side_effect = side_effect @@ -206,7 +206,7 @@ async def test_callback_view_rejects_missing_code(hass): async def test_callback_view_accepts_code( hass, mock_logi_circle -): # noqa pylint: disable=W0621 +): # pylint: disable=W0621 """Test the auth callback view handles requests with auth code.""" init_config_flow(hass) view = LogiCircleAuthCallbackView() diff --git a/tests/components/marytts/test_tts.py b/tests/components/marytts/test_tts.py index 275cf17e22a..5692d72d388 100644 --- a/tests/components/marytts/test_tts.py +++ b/tests/components/marytts/test_tts.py @@ -12,7 +12,7 @@ from homeassistant.components.media_player.const import ( from tests.common import get_test_home_assistant, assert_setup_component, mock_service -from tests.components.tts.test_init import mutagen_mock # noqa +from tests.components.tts.test_init import mutagen_mock # noqa: F401 class TestTTSMaryTTSPlatform: diff --git a/tests/components/mobile_app/test_entity.py b/tests/components/mobile_app/test_entity.py index f2693f25585..94a4e76ae84 100644 --- a/tests/components/mobile_app/test_entity.py +++ b/tests/components/mobile_app/test_entity.py @@ -1,13 +1,11 @@ """Entity tests for mobile_app.""" -# pylint: disable=redefined-outer-name,unused-import + import logging _LOGGER = logging.getLogger(__name__) -async def test_sensor( - hass, create_registrations, webhook_client -): # noqa: F401, F811, E501 +async def test_sensor(hass, create_registrations, webhook_client): """Test that sensors can be registered and updated.""" webhook_id = create_registrations[1]["webhook_id"] webhook_url = "/api/webhook/{}".format(webhook_id) @@ -67,9 +65,7 @@ async def test_sensor( assert updated_entity.state == "123" -async def test_sensor_must_register( - hass, create_registrations, webhook_client # noqa: F401, F811, E501 -): # noqa: F401, F811, E501 +async def test_sensor_must_register(hass, create_registrations, webhook_client): """Test that sensors must be registered before updating.""" webhook_id = create_registrations[1]["webhook_id"] webhook_url = "/api/webhook/{}".format(webhook_id) @@ -88,9 +84,7 @@ async def test_sensor_must_register( assert json["battery_state"]["error"]["code"] == "not_registered" -async def test_sensor_id_no_dupes( - hass, create_registrations, webhook_client # noqa: F401, F811, E501 -): # noqa: F401, F811, E501 +async def test_sensor_id_no_dupes(hass, create_registrations, webhook_client): """Test that sensors must have a unique ID.""" webhook_id = create_registrations[1]["webhook_id"] webhook_url = "/api/webhook/{}".format(webhook_id) diff --git a/tests/components/mobile_app/test_http_api.py b/tests/components/mobile_app/test_http_api.py index 3c05f495e40..158d3ffe213 100644 --- a/tests/components/mobile_app/test_http_api.py +++ b/tests/components/mobile_app/test_http_api.py @@ -12,9 +12,8 @@ from .const import REGISTER, RENDER_TEMPLATE async def test_registration(hass, hass_client): """Test that registrations happen.""" try: - # pylint: disable=unused-import - from nacl.secret import SecretBox # noqa: F401 - from nacl.encoding import Base64Encoder # noqa: F401 + from nacl.secret import SecretBox + from nacl.encoding import Base64Encoder except (ImportError, OSError): pytest.skip("libnacl/libsodium is not installed") return diff --git a/tests/components/mobile_app/test_webhook.py b/tests/components/mobile_app/test_webhook.py index 9274aa60a84..1ea2d50d8d8 100644 --- a/tests/components/mobile_app/test_webhook.py +++ b/tests/components/mobile_app/test_webhook.py @@ -1,5 +1,5 @@ """Webhook tests for mobile_app.""" -# pylint: disable=redefined-outer-name,unused-import + import logging import pytest @@ -29,9 +29,7 @@ async def test_webhook_handle_render_template(create_registrations, webhook_clie assert json == {"one": "Hello world"} -async def test_webhook_handle_call_services( - hass, create_registrations, webhook_client -): # noqa: E501 F811 +async def test_webhook_handle_call_services(hass, create_registrations, webhook_client): """Test that we call services properly.""" calls = async_mock_service(hass, "test", "mobile_app") @@ -68,9 +66,7 @@ async def test_webhook_handle_fire_event(hass, create_registrations, webhook_cli assert events[0].data["hello"] == "yo world" -async def test_webhook_update_registration( - webhook_client, hass_client -): # noqa: E501 F811 +async def test_webhook_update_registration(webhook_client, hass_client): """Test that a we can update an existing registration via webhook.""" authed_api_client = await hass_client() register_resp = await authed_api_client.post( @@ -156,7 +152,7 @@ async def test_webhook_handle_get_config(hass, create_registrations, webhook_cli async def test_webhook_returns_error_incorrect_json( webhook_client, create_registrations, caplog -): # noqa: E501 F811 +): """Test that an error is returned when JSON is invalid.""" resp = await webhook_client.post( "/api/webhook/{}".format(create_registrations[1]["webhook_id"]), data="not json" @@ -171,9 +167,8 @@ async def test_webhook_returns_error_incorrect_json( async def test_webhook_handle_decryption(webhook_client, create_registrations): """Test that we can encrypt/decrypt properly.""" try: - # pylint: disable=unused-import - from nacl.secret import SecretBox # noqa: F401 - from nacl.encoding import Base64Encoder # noqa: F401 + from nacl.secret import SecretBox + from nacl.encoding import Base64Encoder except (ImportError, OSError): pytest.skip("libnacl/libsodium is not installed") return diff --git a/tests/components/onboarding/test_views.py b/tests/components/onboarding/test_views.py index bcb430b828d..7881b75ee99 100644 --- a/tests/components/onboarding/test_views.py +++ b/tests/components/onboarding/test_views.py @@ -9,13 +9,13 @@ from homeassistant.components import onboarding from homeassistant.components.onboarding import const, views from tests.common import CLIENT_ID, register_auth_provider -from tests.components.met.conftest import mock_weather # noqa +from tests.components.met.conftest import mock_weather # noqa: F401 from . import mock_storage @pytest.fixture(autouse=True) -def always_mock_weather(mock_weather): # noqa +def always_mock_weather(mock_weather): # noqa: F811 """Mock the Met weather provider.""" pass diff --git a/tests/components/point/test_config_flow.py b/tests/components/point/test_config_flow.py index 664cb412f75..ec808b5fd80 100644 --- a/tests/components/point/test_config_flow.py +++ b/tests/components/point/test_config_flow.py @@ -66,9 +66,7 @@ async def test_abort_if_already_setup(hass): assert result["reason"] == "already_setup" -async def test_full_flow_implementation( - hass, mock_pypoint -): # noqa pylint: disable=W0621 +async def test_full_flow_implementation(hass, mock_pypoint): # pylint: disable=W0621 """Test registering an implementation and finishing flow works.""" config_flow.register_flow_implementation(hass, "test-other", None, None) flow = init_config_flow(hass) @@ -106,7 +104,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 -): # noqa pylint: disable=W0621 +): # pylint: disable=W0621 """Test wrong code.""" flow = init_config_flow(hass) diff --git a/tests/components/qwikswitch/test_init.py b/tests/components/qwikswitch/test_init.py index 126e4c91c39..e573e8cc293 100644 --- a/tests/components/qwikswitch/test_init.py +++ b/tests/components/qwikswitch/test_init.py @@ -57,7 +57,7 @@ def aioclient_mock(): yield mock_session -async def test_binary_sensor_device(hass, aioclient_mock): # noqa +async def test_binary_sensor_device(hass, aioclient_mock): # noqa: F811 """Test a binary sensor device.""" config = { "qwikswitch": { @@ -86,7 +86,7 @@ async def test_binary_sensor_device(hass, aioclient_mock): # noqa assert state_obj.state == "off" -async def test_sensor_device(hass, aioclient_mock): # noqa +async def test_sensor_device(hass, aioclient_mock): # noqa: F811 """Test a sensor device.""" config = { "qwikswitch": { diff --git a/tests/components/voicerss/test_tts.py b/tests/components/voicerss/test_tts.py index 01ac6049ac5..0f2a0618096 100644 --- a/tests/components/voicerss/test_tts.py +++ b/tests/components/voicerss/test_tts.py @@ -13,7 +13,7 @@ from homeassistant.setup import setup_component from tests.common import get_test_home_assistant, assert_setup_component, mock_service -from tests.components.tts.test_init import mutagen_mock # noqa +from tests.components.tts.test_init import mutagen_mock # noqa: F401 class TestTTSVoiceRSSPlatform: diff --git a/tests/components/yandextts/test_tts.py b/tests/components/yandextts/test_tts.py index 4af259e1355..c532732ccc5 100644 --- a/tests/components/yandextts/test_tts.py +++ b/tests/components/yandextts/test_tts.py @@ -11,7 +11,7 @@ from homeassistant.components.media_player.const import ( ) from tests.common import get_test_home_assistant, assert_setup_component, mock_service -from tests.components.tts.test_init import mutagen_mock # noqa +from tests.components.tts.test_init import mutagen_mock # noqa: F401 class TestTTSYandexPlatform: diff --git a/tests/helpers/test_check_config.py b/tests/helpers/test_check_config.py index 5228f0d4882..0b34b263caf 100644 --- a/tests/helpers/test_check_config.py +++ b/tests/helpers/test_check_config.py @@ -1,6 +1,5 @@ """Test check_config helper.""" import logging -import os # noqa: F401 pylint: disable=unused-import from unittest.mock import patch from homeassistant.helpers.check_config import ( diff --git a/tests/helpers/test_service.py b/tests/helpers/test_service.py index 22611b9f601..de8142a6374 100644 --- a/tests/helpers/test_service.py +++ b/tests/helpers/test_service.py @@ -9,7 +9,7 @@ import voluptuous as vol import pytest # To prevent circular import when running just this file -import homeassistant.components # noqa +import homeassistant.components # noqa: F401 from homeassistant import core as ha, exceptions from homeassistant.const import STATE_ON, STATE_OFF, ATTR_ENTITY_ID from homeassistant.setup import async_setup_component diff --git a/tests/scripts/test_check_config.py b/tests/scripts/test_check_config.py index 5199f01807f..8e1ffe63e84 100644 --- a/tests/scripts/test_check_config.py +++ b/tests/scripts/test_check_config.py @@ -1,6 +1,5 @@ """Test check_config script.""" import logging -import os # noqa: F401 pylint: disable=unused-import from unittest.mock import patch import homeassistant.scripts.check_config as check_config diff --git a/tests/testing_config/custom_components/test_package/__init__.py b/tests/testing_config/custom_components/test_package/__init__.py index 0a02ef1e45f..f5cd2c34edf 100644 --- a/tests/testing_config/custom_components/test_package/__init__.py +++ b/tests/testing_config/custom_components/test_package/__init__.py @@ -1,5 +1,5 @@ """Provide a mock package component.""" -from .const import TEST # noqa +from .const import TEST # noqa: F401 DOMAIN = "test_package" diff --git a/tests/util/test_async.py b/tests/util/test_async.py index 8dede61869c..9cda40c1b8b 100644 --- a/tests/util/test_async.py +++ b/tests/util/test_async.py @@ -165,7 +165,7 @@ class RunThreadsafeTests(TestCase): def test_run_callback_threadsafe_with_invalid(self): """Test callback submission from thread to event loop on invalid.""" - callback = lambda: self.target_callback(invalid=True) # noqa + callback = lambda: self.target_callback(invalid=True) # noqa: E731 future = self.loop.run_in_executor(None, callback) with self.assertRaises(ValueError) as exc_context: self.loop.run_until_complete(future)