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'spull/28810/head
parent
2aee366a1f
commit
d88ca0f5cb
|
@ -1,18 +1,6 @@
|
||||||
"""Permissions for Home Assistant."""
|
"""Permissions for Home Assistant."""
|
||||||
import logging
|
import logging
|
||||||
from typing import ( # noqa: F401
|
from typing import Any, Callable, Optional
|
||||||
cast,
|
|
||||||
Any,
|
|
||||||
Callable,
|
|
||||||
Dict,
|
|
||||||
List,
|
|
||||||
Mapping,
|
|
||||||
Optional,
|
|
||||||
Set,
|
|
||||||
Tuple,
|
|
||||||
Union,
|
|
||||||
TYPE_CHECKING,
|
|
||||||
)
|
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
@ -20,7 +8,7 @@ from .const import CAT_ENTITIES
|
||||||
from .models import PermissionLookup
|
from .models import PermissionLookup
|
||||||
from .types import PolicyType
|
from .types import PolicyType
|
||||||
from .entities import ENTITY_POLICY_SCHEMA, compile_entities
|
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
|
from .util import test_all
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import attr
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from homeassistant.helpers import entity_registry as ent_reg # noqa
|
from homeassistant.helpers import entity_registry as ent_reg # noqa: F401
|
||||||
from homeassistant.helpers import device_registry as dev_reg # noqa
|
from homeassistant.helpers import device_registry as dev_reg # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
@attr.s(slots=True)
|
@attr.s(slots=True)
|
||||||
|
|
|
@ -21,8 +21,9 @@ def lookup_all(
|
||||||
|
|
||||||
def compile_policy(
|
def compile_policy(
|
||||||
policy: CategoryType, subcategories: SubCatLookupType, perm_lookup: PermissionLookup
|
policy: CategoryType, subcategories: SubCatLookupType, perm_lookup: PermissionLookup
|
||||||
) -> Callable[[str, str], bool]: # noqa
|
) -> Callable[[str, str], bool]:
|
||||||
"""Compile policy into a function that tests policy.
|
"""Compile policy into a function that tests policy.
|
||||||
|
|
||||||
Subcategories are mapping key -> lookup function, ordered by highest
|
Subcategories are mapping key -> lookup function, ordered by highest
|
||||||
priority first.
|
priority first.
|
||||||
"""
|
"""
|
||||||
|
@ -80,7 +81,7 @@ def compile_policy(
|
||||||
|
|
||||||
def _gen_dict_test_func(
|
def _gen_dict_test_func(
|
||||||
perm_lookup: PermissionLookup, lookup_func: LookupFunc, lookup_dict: SubCategoryDict
|
perm_lookup: PermissionLookup, lookup_func: LookupFunc, lookup_dict: SubCategoryDict
|
||||||
) -> Callable[[str, str], Optional[bool]]: # noqa
|
) -> Callable[[str, str], Optional[bool]]:
|
||||||
"""Generate a lookup function."""
|
"""Generate a lookup function."""
|
||||||
|
|
||||||
def test_value(object_id: str, key: str) -> Optional[bool]:
|
def test_value(object_id: str, key: str) -> Optional[bool]:
|
||||||
|
|
|
@ -3,7 +3,7 @@ from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.const import (
|
||||||
SERVICE_ALARM_ARM_NIGHT,
|
SERVICE_ALARM_ARM_NIGHT,
|
||||||
SERVICE_ALARM_ARM_CUSTOM_BYPASS,
|
SERVICE_ALARM_ARM_CUSTOM_BYPASS,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.config_validation import ( # noqa
|
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||||
ENTITY_SERVICE_SCHEMA,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.const import ATTR_CREDENTIALS, CONF_NAME, CONF_PROFILE_NAME
|
||||||
from homeassistant.helpers import config_validation as cv, discovery
|
from homeassistant.helpers import config_validation as cv, discovery
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# Loading the config flow file will register the flow
|
||||||
from . import config_flow # noqa
|
from . import config_flow # noqa: F401
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_ACCESS_KEY_ID,
|
CONF_ACCESS_KEY_ID,
|
||||||
CONF_CONTEXT,
|
CONF_CONTEXT,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import voluptuous as vol
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.const import STATE_ON, STATE_OFF
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from aiohttp import web
|
||||||
|
|
||||||
from homeassistant.components import http
|
from homeassistant.components import http
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
time_period_str,
|
time_period_str,
|
||||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
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,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import voluptuous as vol
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.entity import Entity
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
from . import config_flow # noqa pylint_disable=unused-import
|
from . import config_flow # noqa: F401
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,11 @@ from homeassistant.helpers.event import async_track_utc_time_change
|
||||||
from homeassistant.const import ATTR_GPS_ACCURACY, STATE_HOME
|
from homeassistant.const import ATTR_GPS_ACCURACY, STATE_HOME
|
||||||
|
|
||||||
from . import legacy, setup
|
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_setup_entry,
|
||||||
async_unload_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 (
|
from .const import (
|
||||||
ATTR_ATTRIBUTES,
|
ATTR_ATTRIBUTES,
|
||||||
ATTR_BATTERY,
|
ATTR_BATTERY,
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.components.image_processing import (
|
||||||
)
|
)
|
||||||
|
|
||||||
# pylint: disable=unused-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
|
from homeassistant.core import split_entity_id
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -14,10 +14,10 @@ from homeassistant.const import (
|
||||||
CONF_TEMPERATURE_UNIT,
|
CONF_TEMPERATURE_UNIT,
|
||||||
CONF_USERNAME,
|
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 import config_validation as cv, discovery
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import ConfigType # noqa
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
DOMAIN = "elkm1"
|
DOMAIN = "elkm1"
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ from homeassistant.helpers.template import Template
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||||
|
|
||||||
# Import config flow so that it's added to the registry
|
# 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 (
|
from .entry_data import (
|
||||||
DATA_KEY,
|
DATA_KEY,
|
||||||
DISPATCHER_ON_DEVICE_UPDATE,
|
DISPATCHER_ON_DEVICE_UPDATE,
|
||||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.const import SERVICE_TURN_ON, SERVICE_TOGGLE, SERVICE_TURN_OF
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import ToggleEntity
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
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,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -363,7 +363,7 @@ class HomeKit:
|
||||||
self.status = STATUS_WAIT
|
self.status = STATUS_WAIT
|
||||||
|
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from . import ( # noqa F401
|
from . import ( # noqa: F401
|
||||||
type_covers,
|
type_covers,
|
||||||
type_fans,
|
type_fans,
|
||||||
type_lights,
|
type_lights,
|
||||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.helpers import device_registry as dr
|
||||||
from .config_flow import HomekitControllerFlowHandler # noqa: F401
|
from .config_flow import HomekitControllerFlowHandler # noqa: F401
|
||||||
from .connection import get_accessory_information, HKDevice
|
from .connection import get_accessory_information, HKDevice
|
||||||
from .const import CONTROLLER, ENTITY_MAP, KNOWN_DEVICES
|
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
|
from .storage import EntityMapStorage
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -20,11 +20,11 @@ from homeassistant.util import ssl as ssl_util
|
||||||
|
|
||||||
from .auth import setup_auth
|
from .auth import setup_auth
|
||||||
from .ban import setup_bans
|
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 .cors import setup_cors
|
||||||
from .real_ip import setup_real_ip
|
from .real_ip import setup_real_ip
|
||||||
from .static import CACHE_HEADERS, CachingStaticResource
|
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
|
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Component for the Portuguese weather service - IPMA."""
|
"""Component for the Portuguese weather service - IPMA."""
|
||||||
from homeassistant.core import Config, HomeAssistant
|
from homeassistant.core import Config, HomeAssistant
|
||||||
from .config_flow import IpmaFlowHandler # noqa
|
from .config_flow import IpmaFlowHandler # noqa: F401
|
||||||
from .const import DOMAIN # noqa
|
from .const import DOMAIN # noqa: F401
|
||||||
|
|
||||||
DEFAULT_NAME = "ipma"
|
DEFAULT_NAME = "ipma"
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.exceptions import UnknownUser, Unauthorized
|
from homeassistant.exceptions import UnknownUser, Unauthorized
|
||||||
import homeassistant.helpers.config_validation as cv
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
ENTITY_SERVICE_SCHEMA,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import voluptuous as vol
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.config_validation import ( # noqa
|
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||||
ENTITY_SERVICE_SCHEMA,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
|
|
|
@ -7,7 +7,7 @@ config_entry_flow.register_webhook_flow(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
"Mailgun Webhook",
|
"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/",
|
"docs_url": "https://www.home-assistant.io/integrations/mailgun/",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,7 +39,7 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
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,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""The met component."""
|
"""The met component."""
|
||||||
from homeassistant.core import Config, HomeAssistant
|
from homeassistant.core import Config, HomeAssistant
|
||||||
from .config_flow import MetFlowHandler # noqa
|
from .config_flow import MetFlowHandler # noqa: F401
|
||||||
from .const import DOMAIN # noqa
|
from .const import DOMAIN # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: Config) -> bool:
|
async def async_setup(hass: HomeAssistant, config: Config) -> bool:
|
||||||
|
|
|
@ -111,7 +111,7 @@ def error_response(
|
||||||
def supports_encryption() -> bool:
|
def supports_encryption() -> bool:
|
||||||
"""Test if we support encryption."""
|
"""Test if we support encryption."""
|
||||||
try:
|
try:
|
||||||
import nacl # noqa pylint: disable=unused-import
|
import nacl # noqa: F401 pylint: disable=unused-import
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
|
@ -47,7 +47,7 @@ from homeassistant.util.async_ import run_callback_threadsafe
|
||||||
from homeassistant.util.logging import catch_log_exception
|
from homeassistant.util.logging import catch_log_exception
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# 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 (
|
from .const import (
|
||||||
CONF_BROKER,
|
CONF_BROKER,
|
||||||
CONF_DISCOVERY,
|
CONF_DISCOVERY,
|
||||||
|
|
|
@ -12,7 +12,7 @@ CONF_CLOUDHOOK = "cloudhook"
|
||||||
def supports_encryption():
|
def supports_encryption():
|
||||||
"""Test if we support encryption."""
|
"""Test if we support encryption."""
|
||||||
try:
|
try:
|
||||||
import nacl # noqa pylint: disable=unused-import
|
import nacl # noqa: F401 pylint: disable=unused-import
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
|
@ -17,7 +17,7 @@ from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.util.dt import as_local, parse_datetime, utc_from_timestamp
|
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 (
|
from .const import (
|
||||||
CONF_WEBHOOK_URL,
|
CONF_WEBHOOK_URL,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
|
|
@ -16,7 +16,7 @@ from homeassistant.const import (
|
||||||
SERVICE_TOGGLE,
|
SERVICE_TOGGLE,
|
||||||
)
|
)
|
||||||
from homeassistant.components import group
|
from homeassistant.components import group
|
||||||
from homeassistant.helpers.config_validation import ( # noqa
|
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||||
ENTITY_SERVICE_SCHEMA,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
|
|
|
@ -15,7 +15,7 @@ from homeassistant.const import (
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
DEVICE_CLASS_TIMESTAMP,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.config_validation import ( # noqa
|
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,7 +20,7 @@ from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||||
|
|
||||||
from .config_flow import SmartThingsFlowHandler # noqa
|
from .config_flow import SmartThingsFlowHandler # noqa: F401
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_APP_ID,
|
CONF_APP_ID,
|
||||||
CONF_INSTALLED_APP_ID,
|
CONF_INSTALLED_APP_ID,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant import config_entries
|
||||||
from homeassistant.const import CONF_SCAN_INTERVAL
|
from homeassistant.const import CONF_SCAN_INTERVAL
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.event import async_call_later
|
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 (
|
from .const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Consts used by TelldusLive."""
|
"""Consts used by TelldusLive."""
|
||||||
from datetime import timedelta
|
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,
|
ATTR_BATTERY_LEVEL,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_TOKEN,
|
CONF_TOKEN,
|
||||||
|
|
|
@ -89,25 +89,23 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Verify that the TensorFlow Object Detection API is pre-installed
|
# Verify that the TensorFlow Object Detection API is pre-installed
|
||||||
# pylint: disable=unused-import,unused-variable
|
|
||||||
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
|
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.
|
# 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.)
|
# (The model_dir is created during the manual setup process. See integration docs.)
|
||||||
import tensorflow as tf # noqa
|
import tensorflow as tf
|
||||||
from object_detection.utils import label_map_util # noqa
|
from object_detection.utils import label_map_util
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# pylint: disable=line-too-long
|
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"No TensorFlow Object Detection library found! Install or compile "
|
"No TensorFlow Object Detection library found! Install or compile "
|
||||||
"for your system following instructions here: "
|
"for your system following instructions here: "
|
||||||
"https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md"
|
"https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md"
|
||||||
) # noqa
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Display warning that PIL will be used if no OpenCV is found.
|
# Display warning that PIL will be used if no OpenCV is found.
|
||||||
# pylint: disable=unused-import,unused-variable
|
# pylint: disable=unused-import,unused-variable
|
||||||
import cv2 # noqa
|
import cv2 # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"No OpenCV library found. TensorFlow will process image with "
|
"No OpenCV library found. TensorFlow will process image with "
|
||||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.dispatcher import dispatcher_send, async_dispatcher_connect
|
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 (
|
from .const import (
|
||||||
CONF_CLIENT_ID,
|
CONF_CLIENT_ID,
|
||||||
CONF_CLIENT_SECRET,
|
CONF_CLIENT_SECRET,
|
||||||
|
@ -139,7 +139,7 @@ class ToonData:
|
||||||
"""Update all Toon data and notify entities."""
|
"""Update all Toon data and notify entities."""
|
||||||
# Ignore the TTL meganism from client library
|
# Ignore the TTL meganism from client library
|
||||||
# It causes a lots of issues, hence we take control over caching
|
# 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)
|
# Gather data from client library (single API call)
|
||||||
self.gas = self._toon.gas
|
self.gas = self._toon.gas
|
||||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant import config_entries
|
||||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.util.json import load_json
|
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 (
|
from .const import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
CONFIG_FILE,
|
CONFIG_FILE,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Consts used by Tradfri."""
|
"""Consts used by Tradfri."""
|
||||||
from homeassistant.components.light import SUPPORT_TRANSITION, SUPPORT_BRIGHTNESS
|
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_DIMMER = "dimmer"
|
||||||
ATTR_HUE = "hue"
|
ATTR_HUE = "hue"
|
||||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.const import ( # noqa: F401 # STATE_PAUSED/IDLE are API
|
||||||
)
|
)
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
import homeassistant.helpers.config_validation as cv
|
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,
|
ENTITY_SERVICE_SCHEMA,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
|
|
|
@ -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.util.temperature import convert as convert_temperature
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.entity import Entity
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.const import PRECISION_TENTHS, PRECISION_WHOLE, TEMP_CELSIUS
|
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,
|
||||||
PLATFORM_SCHEMA_BASE,
|
PLATFORM_SCHEMA_BASE,
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# 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 . import api
|
||||||
from .core import ZHAGateway
|
from .core import ZHAGateway
|
||||||
from .core.const import (
|
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
|
# needs to be done here so that the ZHA module is finished loading
|
||||||
# before zhaquirks is imported
|
# before zhaquirks is imported
|
||||||
# pylint: disable=W0611, W0612
|
# pylint: disable=W0611, W0612
|
||||||
import zhaquirks # noqa
|
import zhaquirks # noqa: F401
|
||||||
|
|
||||||
zha_gateway = ZHAGateway(hass, config, config_entry)
|
zha_gateway = ZHAGateway(hass, config, config_entry)
|
||||||
await zha_gateway.async_initialize()
|
await zha_gateway.async_initialize()
|
||||||
|
|
|
@ -395,14 +395,14 @@ class EventRelayChannel(ZigbeeChannel):
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=wrong-import-position
|
# pylint: disable=wrong-import-position
|
||||||
from . import closures # noqa
|
from . import closures # noqa: F401
|
||||||
from . import general # noqa
|
from . import general # noqa: F401
|
||||||
from . import homeautomation # noqa
|
from . import homeautomation # noqa: F401
|
||||||
from . import hvac # noqa
|
from . import hvac # noqa: F401
|
||||||
from . import lighting # noqa
|
from . import lighting # noqa: F401
|
||||||
from . import lightlink # noqa
|
from . import lightlink # noqa: F401
|
||||||
from . import manufacturerspecific # noqa
|
from . import manufacturerspecific # noqa: F401
|
||||||
from . import measurement # noqa
|
from . import measurement # noqa: F401
|
||||||
from . import protocol # noqa
|
from . import protocol # noqa: F401
|
||||||
from . import security # noqa
|
from . import security # noqa: F401
|
||||||
from . import smartenergy # noqa
|
from . import smartenergy # noqa: F401
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Decorators for ZHA core registries."""
|
"""Decorators for ZHA core registries."""
|
||||||
from typing import Callable, TypeVar, Union
|
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):
|
class DictRegistry(dict):
|
||||||
|
|
|
@ -27,7 +27,7 @@ from homeassistant.components.sensor import DOMAIN as SENSOR
|
||||||
from homeassistant.components.switch import DOMAIN as SWITCH
|
from homeassistant.components.switch import DOMAIN as SWITCH
|
||||||
|
|
||||||
# importing channels updates registries
|
# 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 (
|
from .const import (
|
||||||
CONTROLLER,
|
CONTROLLER,
|
||||||
SENSOR_ACCELERATION,
|
SENSOR_ACCELERATION,
|
||||||
|
|
|
@ -35,7 +35,7 @@ from homeassistant.helpers.dispatcher import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import const
|
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 . import websocket_api as wsapi
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_AUTOHEAL,
|
CONF_AUTOHEAL,
|
||||||
|
|
|
@ -68,7 +68,7 @@ from homeassistant.util.async_ import run_callback_threadsafe, fire_coroutine_th
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
from homeassistant.util import location, slugify
|
from homeassistant.util import location, slugify
|
||||||
from homeassistant.util.unit_system import ( # NOQA
|
from homeassistant.util.unit_system import (
|
||||||
UnitSystem,
|
UnitSystem,
|
||||||
IMPERIAL_SYSTEM,
|
IMPERIAL_SYSTEM,
|
||||||
METRIC_SYSTEM,
|
METRIC_SYSTEM,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import jinja2
|
||||||
# pylint: disable=using-constant-test
|
# pylint: disable=using-constant-test
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from .core import Context # noqa
|
from .core import Context # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class HomeAssistantError(Exception):
|
class HomeAssistantError(Exception):
|
||||||
|
|
|
@ -28,9 +28,9 @@ from typing import (
|
||||||
# Typing imports that create a circular dependency
|
# Typing imports that create a circular dependency
|
||||||
# pylint: disable=using-constant-test,unused-import
|
# pylint: disable=using-constant-test,unused-import
|
||||||
if TYPE_CHECKING:
|
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"}
|
DEPENDENCY_BLACKLIST = {"config"}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,6 @@ def disable_c_asyncio() -> None:
|
||||||
sys.path.insert(0, AsyncioImportFinder.PATH_TRIGGER)
|
sys.path.insert(0, AsyncioImportFinder.PATH_TRIGGER)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import _asyncio # noqa
|
import _asyncio # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -15,7 +15,7 @@ from typing import (
|
||||||
TypeVar,
|
TypeVar,
|
||||||
Callable,
|
Callable,
|
||||||
KeysView,
|
KeysView,
|
||||||
Union, # noqa
|
Union,
|
||||||
Iterable,
|
Iterable,
|
||||||
Coroutine,
|
Coroutine,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Decorator utility functions."""
|
"""Decorator utility functions."""
|
||||||
from typing import Callable, TypeVar
|
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):
|
class Registry(dict):
|
||||||
|
|
|
@ -76,14 +76,14 @@ def _add_reference(
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
@overload # noqa: F811
|
@overload
|
||||||
def _add_reference(
|
def _add_reference(
|
||||||
obj: Union[str, NodeStrClass], loader: yaml.SafeLoader, node: yaml.nodes.Node
|
obj: Union[str, NodeStrClass], loader: yaml.SafeLoader, node: yaml.nodes.Node
|
||||||
) -> NodeStrClass:
|
) -> NodeStrClass:
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
@overload # noqa: F811
|
@overload
|
||||||
def _add_reference(
|
def _add_reference(
|
||||||
obj: DICT_T, loader: yaml.SafeLoader, node: yaml.nodes.Node
|
obj: DICT_T, loader: yaml.SafeLoader, node: yaml.nodes.Node
|
||||||
) -> DICT_T:
|
) -> DICT_T:
|
||||||
|
@ -93,7 +93,7 @@ def _add_reference(
|
||||||
# pylint: enable=pointless-statement
|
# pylint: enable=pointless-statement
|
||||||
|
|
||||||
|
|
||||||
def _add_reference( # type: ignore # noqa: F811
|
def _add_reference( # type: ignore
|
||||||
obj, loader: SafeLineLoader, node: yaml.nodes.Node
|
obj, loader: SafeLineLoader, node: yaml.nodes.Node
|
||||||
):
|
):
|
||||||
"""Add file reference information to an object."""
|
"""Add file reference information to an object."""
|
||||||
|
|
|
@ -56,7 +56,7 @@ from homeassistant.helpers.json import JSONEncoder
|
||||||
from homeassistant.setup import async_setup_component, setup_component
|
from homeassistant.setup import async_setup_component, setup_component
|
||||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||||
from homeassistant.util.async_ import run_callback_threadsafe
|
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_automations as async_get_device_automations,
|
||||||
_async_get_device_automation_capabilities as async_get_device_automation_capabilities,
|
_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()))
|
return tuple(sorted(self.items()))
|
||||||
|
|
||||||
def __repr__(self): # noqa: D105 no docstring
|
def __repr__(self): # noqa: D105 no docstring
|
||||||
|
|
|
@ -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.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:
|
class TestTTSGooglePlatform:
|
||||||
|
|
|
@ -76,7 +76,7 @@ async def test_step_import(hass, mock_logi_circle): # pylint: disable=W0621
|
||||||
|
|
||||||
async def test_full_flow_implementation(
|
async def test_full_flow_implementation(
|
||||||
hass, mock_logi_circle
|
hass, mock_logi_circle
|
||||||
): # noqa pylint: disable=W0621
|
): # pylint: disable=W0621
|
||||||
"""Test registering an implementation and finishing flow works."""
|
"""Test registering an implementation and finishing flow works."""
|
||||||
config_flow.register_flow_implementation(
|
config_flow.register_flow_implementation(
|
||||||
hass,
|
hass,
|
||||||
|
@ -154,7 +154,7 @@ async def test_abort_if_already_setup(hass):
|
||||||
)
|
)
|
||||||
async def test_abort_if_authorize_fails(
|
async def test_abort_if_authorize_fails(
|
||||||
hass, mock_logi_circle, side_effect, error
|
hass, mock_logi_circle, side_effect, error
|
||||||
): # noqa pylint: disable=W0621
|
): # pylint: disable=W0621
|
||||||
"""Test we abort if authorizing fails."""
|
"""Test we abort if authorizing fails."""
|
||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
mock_logi_circle.LogiCircle().authorize.side_effect = side_effect
|
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(
|
async def test_callback_view_accepts_code(
|
||||||
hass, mock_logi_circle
|
hass, mock_logi_circle
|
||||||
): # noqa pylint: disable=W0621
|
): # pylint: disable=W0621
|
||||||
"""Test the auth callback view handles requests with auth code."""
|
"""Test the auth callback view handles requests with auth code."""
|
||||||
init_config_flow(hass)
|
init_config_flow(hass)
|
||||||
view = LogiCircleAuthCallbackView()
|
view = LogiCircleAuthCallbackView()
|
||||||
|
|
|
@ -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.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:
|
class TestTTSMaryTTSPlatform:
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
"""Entity tests for mobile_app."""
|
"""Entity tests for mobile_app."""
|
||||||
# pylint: disable=redefined-outer-name,unused-import
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def test_sensor(
|
async def test_sensor(hass, create_registrations, webhook_client):
|
||||||
hass, create_registrations, webhook_client
|
|
||||||
): # noqa: F401, F811, E501
|
|
||||||
"""Test that sensors can be registered and updated."""
|
"""Test that sensors can be registered and updated."""
|
||||||
webhook_id = create_registrations[1]["webhook_id"]
|
webhook_id = create_registrations[1]["webhook_id"]
|
||||||
webhook_url = "/api/webhook/{}".format(webhook_id)
|
webhook_url = "/api/webhook/{}".format(webhook_id)
|
||||||
|
@ -67,9 +65,7 @@ async def test_sensor(
|
||||||
assert updated_entity.state == "123"
|
assert updated_entity.state == "123"
|
||||||
|
|
||||||
|
|
||||||
async def test_sensor_must_register(
|
async def test_sensor_must_register(hass, create_registrations, webhook_client):
|
||||||
hass, create_registrations, webhook_client # noqa: F401, F811, E501
|
|
||||||
): # noqa: F401, F811, E501
|
|
||||||
"""Test that sensors must be registered before updating."""
|
"""Test that sensors must be registered before updating."""
|
||||||
webhook_id = create_registrations[1]["webhook_id"]
|
webhook_id = create_registrations[1]["webhook_id"]
|
||||||
webhook_url = "/api/webhook/{}".format(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"
|
assert json["battery_state"]["error"]["code"] == "not_registered"
|
||||||
|
|
||||||
|
|
||||||
async def test_sensor_id_no_dupes(
|
async def test_sensor_id_no_dupes(hass, create_registrations, webhook_client):
|
||||||
hass, create_registrations, webhook_client # noqa: F401, F811, E501
|
|
||||||
): # noqa: F401, F811, E501
|
|
||||||
"""Test that sensors must have a unique ID."""
|
"""Test that sensors must have a unique ID."""
|
||||||
webhook_id = create_registrations[1]["webhook_id"]
|
webhook_id = create_registrations[1]["webhook_id"]
|
||||||
webhook_url = "/api/webhook/{}".format(webhook_id)
|
webhook_url = "/api/webhook/{}".format(webhook_id)
|
||||||
|
|
|
@ -12,9 +12,8 @@ from .const import REGISTER, RENDER_TEMPLATE
|
||||||
async def test_registration(hass, hass_client):
|
async def test_registration(hass, hass_client):
|
||||||
"""Test that registrations happen."""
|
"""Test that registrations happen."""
|
||||||
try:
|
try:
|
||||||
# pylint: disable=unused-import
|
from nacl.secret import SecretBox
|
||||||
from nacl.secret import SecretBox # noqa: F401
|
from nacl.encoding import Base64Encoder
|
||||||
from nacl.encoding import Base64Encoder # noqa: F401
|
|
||||||
except (ImportError, OSError):
|
except (ImportError, OSError):
|
||||||
pytest.skip("libnacl/libsodium is not installed")
|
pytest.skip("libnacl/libsodium is not installed")
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Webhook tests for mobile_app."""
|
"""Webhook tests for mobile_app."""
|
||||||
# pylint: disable=redefined-outer-name,unused-import
|
|
||||||
import logging
|
import logging
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -29,9 +29,7 @@ async def test_webhook_handle_render_template(create_registrations, webhook_clie
|
||||||
assert json == {"one": "Hello world"}
|
assert json == {"one": "Hello world"}
|
||||||
|
|
||||||
|
|
||||||
async def test_webhook_handle_call_services(
|
async def test_webhook_handle_call_services(hass, create_registrations, webhook_client):
|
||||||
hass, create_registrations, webhook_client
|
|
||||||
): # noqa: E501 F811
|
|
||||||
"""Test that we call services properly."""
|
"""Test that we call services properly."""
|
||||||
calls = async_mock_service(hass, "test", "mobile_app")
|
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"
|
assert events[0].data["hello"] == "yo world"
|
||||||
|
|
||||||
|
|
||||||
async def test_webhook_update_registration(
|
async def test_webhook_update_registration(webhook_client, hass_client):
|
||||||
webhook_client, hass_client
|
|
||||||
): # noqa: E501 F811
|
|
||||||
"""Test that a we can update an existing registration via webhook."""
|
"""Test that a we can update an existing registration via webhook."""
|
||||||
authed_api_client = await hass_client()
|
authed_api_client = await hass_client()
|
||||||
register_resp = await authed_api_client.post(
|
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(
|
async def test_webhook_returns_error_incorrect_json(
|
||||||
webhook_client, create_registrations, caplog
|
webhook_client, create_registrations, caplog
|
||||||
): # noqa: E501 F811
|
):
|
||||||
"""Test that an error is returned when JSON is invalid."""
|
"""Test that an error is returned when JSON is invalid."""
|
||||||
resp = await webhook_client.post(
|
resp = await webhook_client.post(
|
||||||
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]), data="not json"
|
"/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):
|
async def test_webhook_handle_decryption(webhook_client, create_registrations):
|
||||||
"""Test that we can encrypt/decrypt properly."""
|
"""Test that we can encrypt/decrypt properly."""
|
||||||
try:
|
try:
|
||||||
# pylint: disable=unused-import
|
from nacl.secret import SecretBox
|
||||||
from nacl.secret import SecretBox # noqa: F401
|
from nacl.encoding import Base64Encoder
|
||||||
from nacl.encoding import Base64Encoder # noqa: F401
|
|
||||||
except (ImportError, OSError):
|
except (ImportError, OSError):
|
||||||
pytest.skip("libnacl/libsodium is not installed")
|
pytest.skip("libnacl/libsodium is not installed")
|
||||||
return
|
return
|
||||||
|
|
|
@ -9,13 +9,13 @@ from homeassistant.components import onboarding
|
||||||
from homeassistant.components.onboarding import const, views
|
from homeassistant.components.onboarding import const, views
|
||||||
|
|
||||||
from tests.common import CLIENT_ID, register_auth_provider
|
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
|
from . import mock_storage
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def always_mock_weather(mock_weather): # noqa
|
def always_mock_weather(mock_weather): # noqa: F811
|
||||||
"""Mock the Met weather provider."""
|
"""Mock the Met weather provider."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,7 @@ async def test_abort_if_already_setup(hass):
|
||||||
assert result["reason"] == "already_setup"
|
assert result["reason"] == "already_setup"
|
||||||
|
|
||||||
|
|
||||||
async def test_full_flow_implementation(
|
async def test_full_flow_implementation(hass, mock_pypoint): # pylint: disable=W0621
|
||||||
hass, mock_pypoint
|
|
||||||
): # noqa pylint: disable=W0621
|
|
||||||
"""Test registering an implementation and finishing flow works."""
|
"""Test registering an implementation and finishing flow works."""
|
||||||
config_flow.register_flow_implementation(hass, "test-other", None, None)
|
config_flow.register_flow_implementation(hass, "test-other", None, None)
|
||||||
flow = init_config_flow(hass)
|
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])
|
@pytest.mark.parametrize("is_authorized", [False])
|
||||||
async def test_wrong_code_flow_implementation(
|
async def test_wrong_code_flow_implementation(
|
||||||
hass, mock_pypoint
|
hass, mock_pypoint
|
||||||
): # noqa pylint: disable=W0621
|
): # pylint: disable=W0621
|
||||||
"""Test wrong code."""
|
"""Test wrong code."""
|
||||||
flow = init_config_flow(hass)
|
flow = init_config_flow(hass)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ def aioclient_mock():
|
||||||
yield mock_session
|
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."""
|
"""Test a binary sensor device."""
|
||||||
config = {
|
config = {
|
||||||
"qwikswitch": {
|
"qwikswitch": {
|
||||||
|
@ -86,7 +86,7 @@ async def test_binary_sensor_device(hass, aioclient_mock): # noqa
|
||||||
assert state_obj.state == "off"
|
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."""
|
"""Test a sensor device."""
|
||||||
config = {
|
config = {
|
||||||
"qwikswitch": {
|
"qwikswitch": {
|
||||||
|
|
|
@ -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.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:
|
class TestTTSVoiceRSSPlatform:
|
||||||
|
|
|
@ -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.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:
|
class TestTTSYandexPlatform:
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
"""Test check_config helper."""
|
"""Test check_config helper."""
|
||||||
import logging
|
import logging
|
||||||
import os # noqa: F401 pylint: disable=unused-import
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.helpers.check_config import (
|
from homeassistant.helpers.check_config import (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import voluptuous as vol
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# To prevent circular import when running just this file
|
# 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 import core as ha, exceptions
|
||||||
from homeassistant.const import STATE_ON, STATE_OFF, ATTR_ENTITY_ID
|
from homeassistant.const import STATE_ON, STATE_OFF, ATTR_ENTITY_ID
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
"""Test check_config script."""
|
"""Test check_config script."""
|
||||||
import logging
|
import logging
|
||||||
import os # noqa: F401 pylint: disable=unused-import
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import homeassistant.scripts.check_config as check_config
|
import homeassistant.scripts.check_config as check_config
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Provide a mock package component."""
|
"""Provide a mock package component."""
|
||||||
from .const import TEST # noqa
|
from .const import TEST # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
DOMAIN = "test_package"
|
DOMAIN = "test_package"
|
||||||
|
|
|
@ -165,7 +165,7 @@ class RunThreadsafeTests(TestCase):
|
||||||
|
|
||||||
def test_run_callback_threadsafe_with_invalid(self):
|
def test_run_callback_threadsafe_with_invalid(self):
|
||||||
"""Test callback submission from thread to event loop on invalid."""
|
"""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)
|
future = self.loop.run_in_executor(None, callback)
|
||||||
with self.assertRaises(ValueError) as exc_context:
|
with self.assertRaises(ValueError) as exc_context:
|
||||||
self.loop.run_until_complete(future)
|
self.loop.run_until_complete(future)
|
||||||
|
|
Loading…
Reference in New Issue