Lint suppression cleanups (#47248)

* Unused pylint suppression cleanups

* Remove outdated pylint bug references

* Add flake8-noqa config and note to run it every now and then

* Add codes to noqa's

* Unused noqa cleanups
pull/46755/head
Ville Skyttä 2021-03-02 10:02:04 +02:00 committed by GitHub
parent 38a2f196b8
commit dc880118a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
217 changed files with 237 additions and 306 deletions

View File

@ -28,6 +28,9 @@ repos:
- id: flake8
additional_dependencies:
- flake8-docstrings==1.5.0
# Temporarily every now and then for noqa cleanup; not done by
# default yet due to https://github.com/plinss/flake8-noqa/issues/1
# - flake8-noqa==1.1.0
- pydocstyle==5.1.1
files: ^(homeassistant|script|tests)/.+\.py$
- repo: https://github.com/PyCQA/bandit

View File

@ -4,8 +4,7 @@ from typing import TYPE_CHECKING
import attr
if TYPE_CHECKING:
# pylint: disable=unused-import
from homeassistant.helpers import ( # noqa: F401
from homeassistant.helpers import (
device_registry as dev_reg,
entity_registry as ent_reg,
)

View File

@ -59,7 +59,7 @@ from homeassistant.loader import bind_hass
from homeassistant.util.dt import parse_datetime
# Not used except by packages to check config structure
from .config import PLATFORM_SCHEMA # noqa
from .config import PLATFORM_SCHEMA # noqa: F401
from .config import async_validate_config_item
from .const import (
CONF_ACTION,

View File

@ -41,7 +41,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up an Avion switch."""
# pylint: disable=no-member
avion = importlib.import_module("avion")
lights = []
@ -111,7 +110,6 @@ class AvionLight(LightEntity):
def set_state(self, brightness):
"""Set the state of this lamp to the provided brightness."""
# pylint: disable=no-member
avion = importlib.import_module("avion")
# Bluetooth LE is unreliable, and the connection may drop at any

View File

@ -10,7 +10,7 @@ from homeassistant.config_entries import CONN_CLASS_CLOUD_POLL, ConfigFlow
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from .const import DOMAIN, LOGGER # pylint: disable=unused-import
from .const import DOMAIN, LOGGER
class AwairFlowHandler(ConfigFlow, domain=DOMAIN):

View File

@ -8,7 +8,6 @@ DOMAIN = "bbb_gpio"
def setup(hass, config):
"""Set up the BeagleBone Black GPIO component."""
# pylint: disable=import-error
def cleanup_gpio(event):
"""Stuff to do before stopping."""

View File

@ -3,7 +3,7 @@ from functools import partial
import logging
from i2csense.bh1750 import BH1750 # pylint: disable=import-error
import smbus # pylint: disable=import-error
import smbus
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA

View File

@ -26,7 +26,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Blinkt Light platform."""
# pylint: disable=no-member
blinkt = importlib.import_module("blinkt")
# ensure that the lights are off when exiting

View File

@ -1,7 +1,7 @@
"""The blueprint integration."""
from . import websocket_api
from .const import DOMAIN # noqa
from .errors import ( # noqa
from .const import DOMAIN # noqa: F401
from .errors import ( # noqa: F401
BlueprintException,
BlueprintWithNameException,
FailedToLoad,
@ -9,8 +9,8 @@ from .errors import ( # noqa
InvalidBlueprintInputs,
MissingInput,
)
from .models import Blueprint, BlueprintInputs, DomainBlueprints # noqa
from .schemas import is_blueprint_instance_config # noqa
from .models import Blueprint, BlueprintInputs, DomainBlueprints # noqa: F401
from .schemas import is_blueprint_instance_config # noqa: F401
async def async_setup(hass, config):

View File

@ -4,7 +4,7 @@ from datetime import datetime, timedelta
import logging
from uuid import UUID
import pygatt # pylint: disable=import-error
import pygatt
import voluptuous as vol
from homeassistant.components.device_tracker import PLATFORM_SCHEMA

View File

@ -3,8 +3,7 @@ import asyncio
import logging
from typing import List, Optional, Set, Tuple
# pylint: disable=import-error
import bluetooth
import bluetooth # pylint: disable=import-error
from bt_proximity import BluetoothRSSI
import voluptuous as vol

View File

@ -4,7 +4,7 @@ from functools import partial
import logging
from i2csense.bme280 import BME280 # pylint: disable=import-error
import smbus # pylint: disable=import-error
import smbus
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA

View File

@ -4,7 +4,7 @@ import threading
from time import monotonic, sleep
import bme680 # pylint: disable=import-error
from smbus import SMBus # pylint: disable=import-error
from smbus import SMBus
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
@ -131,7 +131,6 @@ def _setup_bme680(config):
sensor_handler = None
sensor = None
try:
# pylint: disable=no-member
i2c_address = config[CONF_I2C_ADDRESS]
bus = SMBus(config[CONF_I2C_BUS])
sensor = bme680.BME680(i2c_address, bus)

View File

@ -12,7 +12,7 @@ from homeassistant.const import CONF_HOST, CONF_MAC, CONF_PIN
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from .const import ( # pylint:disable=unused-import
from .const import (
ATTR_CID,
ATTR_MAC,
ATTR_MODEL,

View File

@ -19,8 +19,7 @@ def get_cert(host, port):
address = (host, port)
with socket.create_connection(address, timeout=TIMEOUT) as sock:
with ctx.wrap_socket(sock, server_hostname=address[0]) as ssock:
# pylint disable: https://github.com/PyCQA/pylint/issues/3166
cert = ssock.getpeercert() # pylint: disable=no-member
cert = ssock.getpeercert()
return cert

View File

@ -98,7 +98,6 @@ class CmusRemote:
class CmusDevice(MediaPlayerEntity):
"""Representation of a running cmus."""
# pylint: disable=no-member
def __init__(self, device, name, server):
"""Initialize the CMUS device."""

View File

@ -4,10 +4,8 @@ from functools import wraps
import logging
import time
from bluepy.btle import ( # pylint: disable=import-error, no-member, no-name-in-module
BTLEException,
)
import decora # pylint: disable=import-error, no-member
from bluepy.btle import BTLEException # pylint: disable=import-error
import decora # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.light import (

View File

@ -1,16 +1,10 @@
"""Provide functionality to keep track of devices."""
from homeassistant.const import ( # noqa: F401 pylint: disable=unused-import
ATTR_GPS_ACCURACY,
STATE_HOME,
)
from homeassistant.const import ATTR_GPS_ACCURACY, STATE_HOME # noqa: F401
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.loader import bind_hass
from .config_entry import ( # noqa: F401 pylint: disable=unused-import
async_setup_entry,
async_unload_entry,
)
from .const import ( # noqa: F401 pylint: disable=unused-import
from .config_entry import async_setup_entry, async_unload_entry # noqa: F401
from .const import ( # noqa: F401
ATTR_ATTRIBUTES,
ATTR_BATTERY,
ATTR_DEV_ID,
@ -29,7 +23,7 @@ from .const import ( # noqa: F401 pylint: disable=unused-import
SOURCE_TYPE_GPS,
SOURCE_TYPE_ROUTER,
)
from .legacy import ( # noqa: F401 pylint: disable=unused-import
from .legacy import ( # noqa: F401
PLATFORM_SCHEMA,
PLATFORM_SCHEMA_BASE,
SERVICE_SEE,

View File

@ -1,7 +1,7 @@
"""Support for the Environment Canada radar imagery."""
import datetime
from env_canada import ECRadar # pylint: disable=import-error
from env_canada import ECRadar
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera

View File

@ -3,7 +3,7 @@ from datetime import datetime, timedelta
import logging
import re
from env_canada import ECData # pylint: disable=import-error
from env_canada import ECData
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA

View File

@ -2,7 +2,7 @@
import datetime
import re
from env_canada import ECData # pylint: disable=import-error
from env_canada import ECData
import voluptuous as vol
from homeassistant.components.weather import (

View File

@ -1,7 +1,7 @@
"""Support for eQ-3 Bluetooth Smart thermostats."""
import logging
from bluepy.btle import BTLEException # pylint: disable=import-error, no-name-in-module
from bluepy.btle import BTLEException # pylint: disable=import-error
import eq3bt as eq3 # pylint: disable=import-error
import voluptuous as vol

View File

@ -344,7 +344,6 @@ class FanEntity(ToggleEntity):
"""Turn on the fan."""
raise NotImplementedError()
# pylint: disable=arguments-differ
async def async_turn_on_compat(
self,
speed: Optional[str] = None,

View File

@ -175,7 +175,7 @@ def _create_flume_device_coordinator(hass, flume_device):
_LOGGER.debug("Updating Flume data")
try:
await hass.async_add_executor_job(flume_device.update_force)
except Exception as ex: # pylint: disable=broad-except
except Exception as ex:
raise UpdateFailed(f"Error communicating with flume API: {ex}") from ex
_LOGGER.debug(
"Flume update details: %s",

View File

@ -17,8 +17,7 @@ from homeassistant.const import (
)
from homeassistant.data_entry_flow import AbortFlow
from .const import CONF_RTSP_PORT, CONF_STREAM, LOGGER
from .const import DOMAIN # pylint:disable=unused-import
from .const import CONF_RTSP_PORT, CONF_STREAM, DOMAIN, LOGGER
STREAMS = ["Main", "Sub"]

View File

@ -13,7 +13,6 @@ from homeassistant.components.ssdp import (
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
# pylint:disable=unused-import
from .const import DEFAULT_HOST, DEFAULT_USERNAME, DOMAIN
DATA_SCHEMA_USER = vol.Schema(

View File

@ -25,7 +25,6 @@ CONFIG_SCHEMA = vol.Schema(
)
# pylint: disable=no-member
def setup(hass, base_config):
"""Set up the gc100 component."""
config = base_config[DOMAIN]

View File

@ -173,7 +173,6 @@ class GeniusBroker:
@property
def hub_uid(self) -> int:
"""Return the Hub UID (MAC address)."""
# pylint: disable=no-member
return self._hub_uid if self._hub_uid is not None else self.client.uid
async def async_update(self, now, **kwargs) -> None:

View File

@ -3,7 +3,7 @@ import copy
from datetime import timedelta
import logging
from httplib2 import ServerNotFoundError # pylint: disable=import-error
from httplib2 import ServerNotFoundError
from homeassistant.components.calendar import (
ENTITY_ID_FORMAT,

View File

@ -57,9 +57,7 @@ def setup(hass: HomeAssistant, yaml_config: Dict[str, Any]):
service_principal_path
)
topic_path = publisher.topic_path( # pylint: disable=no-member
project_id, topic_name
)
topic_path = publisher.topic_path(project_id, topic_name)
encoder = DateTimeJSONEncoder()

View File

@ -46,7 +46,7 @@ INSTANCE_SCHEMA = vol.All(
),
)
has_unique_values = vol.Schema(vol.Unique()) # pylint: disable=invalid-name
has_unique_values = vol.Schema(vol.Unique())
# because we want a handy alias

View File

@ -3,7 +3,7 @@ import logging
from homeassistant import config_entries
from . import DOMAIN # pylint:disable=unused-import
from . import DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -4,13 +4,9 @@ from functools import reduce
import logging
import multiprocessing
from pycec.cec import CecAdapter # pylint: disable=import-error
from pycec.commands import ( # pylint: disable=import-error
CecCommand,
KeyPressCommand,
KeyReleaseCommand,
)
from pycec.const import ( # pylint: disable=import-error
from pycec.cec import CecAdapter
from pycec.commands import CecCommand, KeyPressCommand, KeyReleaseCommand
from pycec.const import (
ADDR_AUDIOSYSTEM,
ADDR_BROADCAST,
ADDR_UNREGISTERED,
@ -25,8 +21,8 @@ from pycec.const import ( # pylint: disable=import-error
STATUS_STILL,
STATUS_STOP,
)
from pycec.network import HDMINetwork, PhysicalAddress # pylint: disable=import-error
from pycec.tcp import TcpAdapter # pylint: disable=import-error
from pycec.network import HDMINetwork, PhysicalAddress
from pycec.tcp import TcpAdapter
import voluptuous as vol
from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER

View File

@ -1,12 +1,8 @@
"""Support for HDMI CEC devices as media players."""
import logging
from pycec.commands import ( # pylint: disable=import-error
CecCommand,
KeyPressCommand,
KeyReleaseCommand,
)
from pycec.const import ( # pylint: disable=import-error
from pycec.commands import CecCommand, KeyPressCommand, KeyReleaseCommand
from pycec.const import (
KEY_BACKWARD,
KEY_FORWARD,
KEY_MUTE_TOGGLE,

View File

@ -457,11 +457,9 @@ class HERETravelTimeData:
_LOGGER.debug("Raw response is: %s", response.response)
# pylint: disable=no-member
source_attribution = response.response.get("sourceAttribution")
if source_attribution is not None:
self.attribution = self._build_hass_attribution(source_attribution)
# pylint: disable=no-member
route = response.response["route"]
summary = route[0]["summary"]
waypoint = route[0]["waypoint"]
@ -477,7 +475,6 @@ class HERETravelTimeData:
else:
# Convert to kilometers
self.distance = distance / 1000
# pylint: disable=no-member
self.route = response.route_short
self.origin_name = waypoint[0]["mappedRoadName"]
self.destination_name = waypoint[1]["mappedRoadName"]

View File

@ -42,7 +42,6 @@ from homeassistant.helpers.reload import async_integration_yaml_config
from homeassistant.loader import IntegrationNotFound, async_get_integration
from homeassistant.util import get_local_ip
# pylint: disable=unused-import
from . import ( # noqa: F401
type_cameras,
type_covers,

View File

@ -36,13 +36,13 @@ from .const import (
DEFAULT_AUTO_START,
DEFAULT_CONFIG_FLOW_PORT,
DEFAULT_HOMEKIT_MODE,
DOMAIN,
HOMEKIT_MODE_ACCESSORY,
HOMEKIT_MODE_BRIDGE,
HOMEKIT_MODES,
SHORT_BRIDGE_NAME,
VIDEO_CODEC_COPY,
)
from .const import DOMAIN # pylint:disable=unused-import
from .util import async_find_next_available_port, state_needs_accessory_mode
CONF_CAMERA_COPY = "camera_copy"

View File

@ -4,7 +4,7 @@ from functools import partial
import logging
from i2csense.htu21d import HTU21D # pylint: disable=import-error
import smbus # pylint: disable=import-error
import smbus
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA

View File

@ -92,7 +92,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
raise UpdateFailed(f"Authentication failed: {err}") from err
except ClientConnectorError as err:
raise UpdateFailed(f"Network not available: {err}") from err
except Exception as err: # pylint: disable=broad-except
except Exception as err:
raise UpdateFailed(f"Error occurred while fetching data: {err}") from err
coordinator = DataUpdateCoordinator(

View File

@ -11,12 +11,7 @@ from homeassistant.core import callback
from homeassistant.helpers import aiohttp_client
import homeassistant.helpers.config_validation as cv
from .const import ( # pylint:disable=unused-import
CONF_FILTER,
CONF_REAL_TIME,
CONF_STATION,
DOMAIN,
)
from .const import CONF_FILTER, CONF_REAL_TIME, CONF_STATION, DOMAIN
from .hub import GTIHub
_LOGGER = logging.getLogger(__name__)

View File

@ -221,7 +221,6 @@ class HyperionConfigFlow(ConfigFlow, domain=DOMAIN):
return self.async_abort(reason="cannot_connect")
return await self._advance_to_auth_step_if_necessary(hyperion_client)
# pylint: disable=arguments-differ
async def async_step_user(
self,
user_input: Optional[ConfigType] = None,

View File

@ -553,7 +553,6 @@ class HyperionPriorityLight(HyperionBaseLight):
return True
return False
# pylint: disable=no-self-use
def _allow_priority_update(self, priority: Optional[Dict[str, Any]] = None) -> bool:
"""Determine whether to allow a Hyperion priority to update entity attributes."""
# Black is treated as 'off' (and Home Assistant does not support selecting black

View File

@ -178,12 +178,10 @@ class HyperionComponentSwitch(SwitchEntity):
}
)
# pylint: disable=unused-argument
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the switch."""
await self._async_send_set_component(True)
# pylint: disable=unused-argument
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the switch."""
await self._async_send_set_component(False)

View File

@ -21,10 +21,10 @@ from .const import (
DEFAULT_GPS_ACCURACY_THRESHOLD,
DEFAULT_MAX_INTERVAL,
DEFAULT_WITH_FAMILY,
DOMAIN,
STORAGE_KEY,
STORAGE_VERSION,
)
from .const import DOMAIN # pylint: disable=unused-import
CONF_TRUSTED_DEVICE = "trusted_device"
CONF_VERIFICATION_CODE = "verification_code"

View File

@ -29,7 +29,6 @@ ATTR_COUNTER = "counter"
class ColorTempModes(Enum):
# pylint: disable=invalid-name
"""Color temperature modes for config validation."""
ABSOLUTE = "DPT-7.600"
@ -37,7 +36,6 @@ class ColorTempModes(Enum):
class SupportedPlatforms(Enum):
# pylint: disable=invalid-name
"""Supported platforms."""
BINARY_SENSOR = "binary_sensor"

View File

@ -27,7 +27,7 @@ from .const import (
DATA_LCN,
DOMAIN,
)
from .schemas import CONFIG_SCHEMA # noqa: 401
from .schemas import CONFIG_SCHEMA # noqa: F401
from .services import (
DynText,
Led,

View File

@ -1,5 +1,5 @@
"""Support for LIRC devices."""
# pylint: disable=no-member, import-error
# pylint: disable=import-error
import logging
import threading
import time

View File

@ -34,7 +34,7 @@ from .const import (
STORAGE_DASHBOARD_UPDATE_FIELDS,
url_slug,
)
from .system_health import system_health_info # NOQA
from .system_health import system_health_info # noqa: F401
_LOGGER = logging.getLogger(__name__)

View File

@ -1,8 +1,8 @@
"""Support for binary sensor using I2C MCP23017 chip."""
from adafruit_mcp230xx.mcp23017 import MCP23017 # pylint: disable=import-error
import board # pylint: disable=import-error
import busio # pylint: disable=import-error
import digitalio # pylint: disable=import-error
from adafruit_mcp230xx.mcp23017 import MCP23017
import board
import busio
import digitalio
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity

View File

@ -1,8 +1,8 @@
"""Support for switch sensor using I2C MCP23017 chip."""
from adafruit_mcp230xx.mcp23017 import MCP23017 # pylint: disable=import-error
import board # pylint: disable=import-error
import busio # pylint: disable=import-error
import digitalio # pylint: disable=import-error
from adafruit_mcp230xx.mcp23017 import MCP23017
import board
import busio
import digitalio
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA

View File

@ -193,7 +193,6 @@ class MeteoFranceRainSensor(MeteoFranceSensor):
class MeteoFranceAlertSensor(MeteoFranceSensor):
"""Representation of a Meteo-France alert sensor."""
# pylint: disable=super-init-not-called
def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator):
"""Initialize the Meteo-France sensor."""
super().__init__(sensor_type, coordinator)

View File

@ -5,7 +5,7 @@ import logging
import btlewrap
from btlewrap import BluetoothBackendException
from miflora import miflora_poller # pylint: disable=import-error
from miflora import miflora_poller
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA

View File

@ -144,8 +144,6 @@ class MjpegCamera(Camera):
else:
req = requests.get(self._mjpeg_url, stream=True, timeout=10)
# https://github.com/PyCQA/pylint/issues/1437
# pylint: disable=no-member
with closing(req) as response:
return extract_image_from_mjpeg(response.iter_content(102400))

View File

@ -668,7 +668,7 @@ class MQTT:
will_message = None
if will_message is not None:
self._mqttc.will_set( # pylint: disable=no-value-for-parameter
self._mqttc.will_set(
topic=will_message.topic,
payload=will_message.payload,
qos=will_message.qos,
@ -833,7 +833,7 @@ class MQTT:
async def publish_birth_message(birth_message):
await self._ha_started.wait() # Wait for Home Assistant to start
await self._discovery_cooldown() # Wait for MQTT discovery to cool down
await self.async_publish( # pylint: disable=no-value-for-parameter
await self.async_publish(
topic=birth_message.topic,
payload=birth_message.payload,
qos=birth_message.qos,

View File

@ -242,7 +242,6 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity):
def available(self) -> bool:
"""Return true if the device is available and value has not expired."""
expire_after = self._config.get(CONF_EXPIRE_AFTER)
# pylint: disable=no-member
return MqttAvailability.available.fget(self) and (
expire_after is None or not self._expired
)

View File

@ -197,7 +197,6 @@ class MqttSensor(MqttEntity, Entity):
def available(self) -> bool:
"""Return true if the device is available and value has not expired."""
expire_after = self._config.get(CONF_EXPIRE_AFTER)
# pylint: disable=no-member
return MqttAvailability.available.fget(self) and (
expire_after is None or not self._expired
)

View File

@ -29,7 +29,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class MullvadBinarySensor(CoordinatorEntity, BinarySensorEntity):
"""Represents a Mullvad binary sensor."""
def __init__(self, coordinator, sensor): # pylint: disable=super-init-not-called
def __init__(self, coordinator, sensor):
"""Initialize the Mullvad binary sensor."""
super().__init__(coordinator)
self.id = sensor[CONF_ID]

View File

@ -5,7 +5,7 @@ from mullvad_api import MullvadAPI, MullvadAPIError
from homeassistant import config_entries
from .const import DOMAIN # pylint:disable=unused-import
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -23,8 +23,6 @@ from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from . import CONF_RETAIN, CONF_VERSION, DEFAULT_VERSION
# pylint: disable=unused-import
from .const import (
CONF_BAUD_RATE,
CONF_GATEWAY_TYPE,

View File

@ -8,7 +8,6 @@ from homeassistant import config_entries
from homeassistant.const import CONF_TOKEN
from homeassistant.helpers import config_entry_oauth2_flow
# pylint: disable=unused-import
from .const import NEATO_DOMAIN

View File

@ -2,7 +2,7 @@
from datetime import datetime, timedelta
import logging
import noaa_coops as coops # pylint: disable=import-error
import noaa_coops as coops
import requests
import voluptuous as vol

View File

@ -9,7 +9,7 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.helpers import aiohttp_client
from .const import CONF_SCAN_INTERVAL, DOMAIN # pylint:disable=unused-import
from .const import CONF_SCAN_INTERVAL, DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -5,7 +5,7 @@ from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_TYPE
from homeassistant.helpers.typing import HomeAssistantType
from .const import ( # pylint: disable=unused-import
from .const import (
CONF_MOUNT_DIR,
CONF_TYPE_OWFS,
CONF_TYPE_OWSERVER,

View File

@ -4,7 +4,7 @@ import secrets
from homeassistant import config_entries
from homeassistant.const import CONF_WEBHOOK_ID
from .const import DOMAIN # noqa pylint: disable=unused-import
from .const import DOMAIN # pylint: disable=unused-import
from .helper import supports_encryption
CONF_SECRET = "secret"

View File

@ -7,8 +7,7 @@ from homeassistant import config_entries
from homeassistant.core import callback
from homeassistant.data_entry_flow import AbortFlow
from .const import CONF_INTEGRATION_CREATED_ADDON, CONF_USE_ADDON
from .const import DOMAIN # pylint:disable=unused-import
from .const import CONF_INTEGRATION_CREATED_ADDON, CONF_USE_ADDON, DOMAIN
_LOGGER = logging.getLogger(__name__)

View File

@ -1,5 +1,5 @@
"""Support for binary sensor using RPi GPIO."""
from pi4ioe5v9xxxx import pi4ioe5v9xxxx # pylint: disable=import-error
from pi4ioe5v9xxxx import pi4ioe5v9xxxx
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity

View File

@ -1,5 +1,5 @@
"""Allows to configure a switch using RPi GPIO."""
from pi4ioe5v9xxxx import pi4ioe5v9xxxx # pylint: disable=import-error
from pi4ioe5v9xxxx import pi4ioe5v9xxxx
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity

View File

@ -27,7 +27,7 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.network import get_url
from .const import ( # pylint: disable=unused-import
from .const import (
AUTH_CALLBACK_NAME,
AUTH_CALLBACK_PATH,
AUTOMATIC_SETUP_STRING,

View File

@ -189,7 +189,7 @@ class PlexServer:
_connect_with_url()
except requests.exceptions.SSLError as error:
while error and not isinstance(error, ssl.SSLCertVerificationError):
error = error.__context__ # pylint: disable=no-member
error = error.__context__
if isinstance(error, ssl.SSLCertVerificationError):
domain = urlparse(self._url).netloc.split(":")[0]
if domain.endswith("plex.direct") and error.args[0].startswith(

View File

@ -25,7 +25,7 @@ from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.util import location
from homeassistant.util.json import load_json, save_json
from .config_flow import PlayStation4FlowHandler # noqa: pylint: disable=unused-import
from .config_flow import PlayStation4FlowHandler # noqa: F401
from .const import ATTR_MEDIA_IMAGE_URL, COMMANDS, DOMAIN, GAMES_FILE, PS4_DATA
_LOGGER = logging.getLogger(__name__)

View File

@ -35,7 +35,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import COORDINATOR, DOMAIN, PLATFORM_IDX, REST, REST_IDX
from .data import RestData
from .schema import CONFIG_SCHEMA # noqa:F401 pylint: disable=unused-import
from .schema import CONFIG_SCHEMA # noqa: F401
_LOGGER = logging.getLogger(__name__)

View File

@ -45,7 +45,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
)
# pylint: disable=no-member
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Find and return switches controlled by a generic RF device via GPIO."""
rpi_rf = importlib.import_module("rpi_rf")

View File

@ -99,7 +99,7 @@ class SharkIqUpdateCoordinator(DataUpdateCoordinator):
_LOGGER.debug("Matching flow found")
raise UpdateFailed(err) from err
except Exception as err: # pylint: disable=broad-except
except Exception as err:
_LOGGER.exception("Unexpected error updating SharkIQ")
raise UpdateFailed(err) from err

View File

@ -1,7 +1,7 @@
"""Config flow for SMS integration."""
import logging
import gammu # pylint: disable=import-error, no-member
import gammu # pylint: disable=import-error
import voluptuous as vol
from homeassistant import config_entries, core, exceptions

View File

@ -1,10 +1,8 @@
"""The sms gateway to interact with a GSM modem."""
import logging
import gammu # pylint: disable=import-error, no-member
from gammu.asyncworker import ( # pylint: disable=import-error, no-member
GammuAsyncWorker,
)
import gammu # pylint: disable=import-error
from gammu.asyncworker import GammuAsyncWorker # pylint: disable=import-error
from homeassistant.core import callback
@ -165,6 +163,6 @@ async def create_sms_gateway(config, hass):
gateway = Gateway(worker, hass)
await gateway.init_async()
return gateway
except gammu.GSMError as exc: # pylint: disable=no-member
except gammu.GSMError as exc:
_LOGGER.error("Failed to initialize, error %s", exc)
return None

View File

@ -1,7 +1,7 @@
"""Support for SMS notification services."""
import logging
import gammu # pylint: disable=import-error, no-member
import gammu # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService
@ -51,8 +51,8 @@ class SMSNotificationService(BaseNotificationService):
}
try:
# Encode messages
encoded = gammu.EncodeSMS(smsinfo) # pylint: disable=no-member
except gammu.GSMError as exc: # pylint: disable=no-member
encoded = gammu.EncodeSMS(smsinfo)
except gammu.GSMError as exc:
_LOGGER.error("Encoding message %s failed: %s", message, exc)
return
@ -64,5 +64,5 @@ class SMSNotificationService(BaseNotificationService):
try:
# Actually send the message
await self.gateway.send_sms_async(encoded_message)
except gammu.GSMError as exc: # pylint: disable=no-member
except gammu.GSMError as exc:
_LOGGER.error("Sending to %s failed: %s", self.number, exc)

View File

@ -1,7 +1,7 @@
"""Support for SMS dongle sensor."""
import logging
import gammu # pylint: disable=import-error, no-member
import gammu # pylint: disable=import-error
from homeassistant.const import DEVICE_CLASS_SIGNAL_STRENGTH, SIGNAL_STRENGTH_DECIBELS
from homeassistant.helpers.entity import Entity
@ -71,7 +71,7 @@ class GSMSignalSensor(Entity):
"""Get the latest data from the modem."""
try:
self._state = await self._gateway.get_signal_quality_async()
except gammu.GSMError as exc: # pylint: disable=no-member
except gammu.GSMError as exc:
_LOGGER.error("Failed to read signal quality: %s", exc)
@property

View File

@ -19,9 +19,9 @@ from .const import (
CONF_TARGET_ID,
CONF_TARGET_NAME,
DEFAULT_PORT,
DOMAIN,
MYLINK_STATUS,
)
from .const import DOMAIN # pylint:disable=unused-import
_LOGGER = logging.getLogger(__name__)

View File

@ -13,8 +13,8 @@ from .const import (
DEFAULT_NAME,
DEFAULT_SCAN_INTERVAL,
DEFAULT_SERVER,
DOMAIN,
)
from .const import DOMAIN # pylint: disable=unused-import
class SpeedTestFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):

View File

@ -1,7 +1,7 @@
"""Support for Switchbot."""
from typing import Any, Dict
# pylint: disable=import-error, no-member
# pylint: disable=import-error
import switchbot
import voluptuous as vol

View File

@ -1,7 +1,7 @@
"""Support for Switchmate."""
from datetime import timedelta
# pylint: disable=import-error, no-member
# pylint: disable=import-error
import switchmate
import voluptuous as vol

View File

@ -62,7 +62,6 @@ class SyncThruConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
# Remove trailing " (ip)" if present for consistency with user driven config
self.name = re.sub(r"\s+\([\d.]+\)\s*$", "", self.name)
# https://github.com/PyCQA/pylint/issues/3167
self.context["title_placeholders"] = {CONF_NAME: self.name}
return await self.async_step_confirm()

View File

@ -4,11 +4,7 @@ import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.mqtt import valid_subscribe_topic
from .const import ( # pylint:disable=unused-import
CONF_DISCOVERY_PREFIX,
DEFAULT_PREFIX,
DOMAIN,
)
from .const import CONF_DISCOVERY_PREFIX, DEFAULT_PREFIX, DOMAIN
class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):

View File

@ -341,9 +341,8 @@ class TensorFlowImageProcessor(ImageProcessingEntity):
start = time.perf_counter()
try:
import cv2 # pylint: disable=import-error, import-outside-toplevel
import cv2 # pylint: disable=import-outside-toplevel
# pylint: disable=no-member
img = cv2.imdecode(np.asarray(bytearray(image)), cv2.IMREAD_UNCHANGED)
inp = img[:, :, [2, 1, 0]] # BGR->RGB
inp_expanded = inp.reshape(1, inp.shape[0], inp.shape[1], 3)

View File

@ -42,11 +42,11 @@ from .const import (
DEFAULT_DISCOVERY_INTERVAL,
DEFAULT_QUERY_INTERVAL,
DEFAULT_TUYA_MAX_COLTEMP,
DOMAIN,
TUYA_DATA,
TUYA_PLATFORMS,
TUYA_TYPE_NOT_QUERY,
)
from .const import DOMAIN # pylint:disable=unused-import
_LOGGER = logging.getLogger(__name__)

View File

@ -5,7 +5,7 @@ import logging
import async_timeout
from awesomeversion import AwesomeVersion
from distro import linux_distribution # pylint: disable=import-error
from distro import linux_distribution
import voluptuous as vol
from homeassistant.const import __version__ as current_version

View File

@ -13,11 +13,7 @@ from homeassistant.const import CONF_EXCLUDE, CONF_LIGHTS, CONF_SOURCE
from homeassistant.core import callback
from homeassistant.helpers.entity_registry import EntityRegistry
from .const import ( # pylint: disable=unused-import
CONF_CONTROLLER,
CONF_LEGACY_UNIQUE_ID,
DOMAIN,
)
from .const import CONF_CONTROLLER, CONF_LEGACY_UNIQUE_ID, DOMAIN
LIST_REGEX = re.compile("[^0-9]+")
_LOGGER = logging.getLogger(__name__)

View File

@ -6,9 +6,9 @@ import voluptuous as vol
from homeassistant.core import HomeAssistant, callback
from homeassistant.loader import bind_hass
from . import commands, connection, const, decorators, http, messages # noqa
from .connection import ActiveConnection # noqa
from .const import ( # noqa
from . import commands, connection, const, decorators, http, messages # noqa: F401
from .connection import ActiveConnection # noqa: F401
from .const import ( # noqa: F401
ERR_HOME_ASSISTANT_ERROR,
ERR_INVALID_FORMAT,
ERR_NOT_FOUND,
@ -19,13 +19,13 @@ from .const import ( # noqa
ERR_UNKNOWN_COMMAND,
ERR_UNKNOWN_ERROR,
)
from .decorators import ( # noqa
from .decorators import ( # noqa: F401
async_response,
require_admin,
websocket_command,
ws_require_user,
)
from .messages import ( # noqa
from .messages import ( # noqa: F401
BASE_COMMAND_MESSAGE_SCHEMA,
error_message,
event_message,

View File

@ -9,7 +9,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.json import JSONEncoder
if TYPE_CHECKING:
from .connection import ActiveConnection # noqa
from .connection import ActiveConnection
WebSocketCommandHandler = Callable[[HomeAssistant, "ActiveConnection", dict], None]

View File

@ -2,8 +2,7 @@
from dataclasses import dataclass
from typing import List, Tuple
# pylint: disable=no-name-in-module
from pydantic.error_wrappers import ValidationError
from pydantic.error_wrappers import ValidationError # pylint: disable=no-name-in-module
from xbox.webapi.api.client import XboxLiveClient
from xbox.webapi.api.provider.catalog.models import FieldsTemplate, Image
from xbox.webapi.api.provider.gameclips.models import GameclipsResponse

View File

@ -1,7 +1,7 @@
"""Support for Xiaomi Mi WiFi Repeater 2."""
import logging
from miio import DeviceException, WifiRepeater # pylint: disable=import-error
from miio import DeviceException, WifiRepeater
import voluptuous as vol
from homeassistant.components.device_tracker import (

View File

@ -4,7 +4,7 @@ from enum import Enum
from functools import partial
import logging
from miio import ( # pylint: disable=import-error
from miio import (
AirFresh,
AirHumidifier,
AirHumidifierMiot,
@ -12,24 +12,24 @@ from miio import ( # pylint: disable=import-error
AirPurifierMiot,
DeviceException,
)
from miio.airfresh import ( # pylint: disable=import-error, import-error
from miio.airfresh import (
LedBrightness as AirfreshLedBrightness,
OperationMode as AirfreshOperationMode,
)
from miio.airhumidifier import ( # pylint: disable=import-error, import-error
from miio.airhumidifier import (
LedBrightness as AirhumidifierLedBrightness,
OperationMode as AirhumidifierOperationMode,
)
from miio.airhumidifier_miot import ( # pylint: disable=import-error, import-error
from miio.airhumidifier_miot import (
LedBrightness as AirhumidifierMiotLedBrightness,
OperationMode as AirhumidifierMiotOperationMode,
PressedButton as AirhumidifierPressedButton,
)
from miio.airpurifier import ( # pylint: disable=import-error, import-error
from miio.airpurifier import (
LedBrightness as AirpurifierLedBrightness,
OperationMode as AirpurifierOperationMode,
)
from miio.airpurifier_miot import ( # pylint: disable=import-error, import-error
from miio.airpurifier_miot import (
LedBrightness as AirpurifierMiotLedBrightness,
OperationMode as AirpurifierMiotOperationMode,
)

View File

@ -6,8 +6,14 @@ from functools import partial
import logging
from math import ceil
from miio import Ceil, DeviceException, PhilipsBulb, PhilipsEyecare, PhilipsMoonlight
from miio import Device # pylint: disable=import-error
from miio import (
Ceil,
Device,
DeviceException,
PhilipsBulb,
PhilipsEyecare,
PhilipsMoonlight,
)
from miio.gateway import (
GATEWAY_MODEL_AC_V1,
GATEWAY_MODEL_AC_V2,

View File

@ -4,7 +4,7 @@ from datetime import timedelta
import logging
import time
from miio import ChuangmiIr, DeviceException # pylint: disable=import-error
from miio import ChuangmiIr, DeviceException
import voluptuous as vol
from homeassistant.components.remote import (

View File

@ -2,8 +2,7 @@
from dataclasses import dataclass
import logging
from miio import AirQualityMonitor # pylint: disable=import-error
from miio import DeviceException
from miio import AirQualityMonitor, DeviceException
from miio.gateway import (
GATEWAY_MODEL_AC_V1,
GATEWAY_MODEL_AC_V2,

View File

@ -3,9 +3,8 @@ import asyncio
from functools import partial
import logging
from miio import AirConditioningCompanionV3 # pylint: disable=import-error
from miio import ChuangmiPlug, DeviceException, PowerStrip
from miio.powerstrip import PowerMode # pylint: disable=import-error
from miio import AirConditioningCompanionV3, ChuangmiPlug, DeviceException, PowerStrip
from miio.powerstrip import PowerMode
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity

View File

@ -2,7 +2,7 @@
from functools import partial
import logging
from miio import DeviceException, Vacuum # pylint: disable=import-error
from miio import DeviceException, Vacuum
import voluptuous as vol
from homeassistant.components.vacuum import (

View File

@ -94,7 +94,7 @@ async def async_setup_entry(hass, config_entry):
if config.get(CONF_ENABLE_QUIRKS, True):
# needs to be done here so that the ZHA module is finished loading
# before zhaquirks is imported
import zhaquirks # noqa: F401 pylint: disable=unused-import, import-outside-toplevel, import-error
import zhaquirks # noqa: F401 pylint: disable=unused-import, import-outside-toplevel
zha_gateway = ZHAGateway(hass, config, config_entry)
await zha_gateway.async_initialize()

View File

@ -10,7 +10,7 @@ from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_send
from . import ( # noqa: F401 # pylint: disable=unused-import
from . import ( # noqa: F401
base,
closures,
general,

View File

@ -1,5 +1,4 @@
"""Data storage helper for ZHA."""
# pylint: disable=unused-import
from collections import OrderedDict
import datetime
import time

Some files were not shown because too many files have changed in this diff Show More