Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint suppression cleanups #47248

Merged
merged 5 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/auth/permissions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
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,
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/automation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
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,
Expand Down
2 changes: 0 additions & 2 deletions homeassistant/components/avion/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

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 = []
Expand Down Expand Up @@ -111,7 +110,6 @@ def assumed_state(self):

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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/awair/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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):
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/bbb_gpio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

def setup(hass, config):
"""Set up the BeagleBone Black GPIO component."""
# pylint: disable=import-error

def cleanup_gpio(event):
"""Stuff to do before stopping."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bh1750/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/blinkt/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

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
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/blueprint/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""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,
InvalidBlueprint,
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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/bluetooth_tracker/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
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

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bme280/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/bme680/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/braviatv/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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,
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/cert_expiry/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/cmus/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def connect(self):
class CmusDevice(MediaPlayerEntity):
"""Representation of a running cmus."""

# pylint: disable=no-member
def __init__(self, device, name, server):
"""Initialize the CMUS device."""

Expand Down
6 changes: 2 additions & 4 deletions homeassistant/components/decora/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
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 (
Expand Down
14 changes: 4 additions & 10 deletions homeassistant/components/device_tracker/__init__.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -29,7 +23,7 @@
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,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/environment_canada/camera.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/environment_canada/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/environment_canada/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/eq3btsmart/climate.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/fan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ def turn_on(
"""Turn on the fan."""
raise NotImplementedError()

# pylint: disable=arguments-differ
async def async_turn_on_compat(
self,
speed: Optional[str] = None,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/flume/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ async def _async_update_data():
_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",
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/foscam/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
)
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"]

Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/fritzbox/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
)
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(
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/gc100/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
)


# pylint: disable=no-member
def setup(hass, base_config):
"""Set up the gc100 component."""
config = base_config[DOMAIN]
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/geniushub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def __init__(self, hass, client, hub_uid) -> None:
@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:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/google/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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,
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/google_pubsub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/habitica/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
),
)

has_unique_values = vol.Schema(vol.Unique()) # pylint: disable=invalid-name
has_unique_values = vol.Schema(vol.Unique())
# because we want a handy alias


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/hassio/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from homeassistant import config_entries

from . import DOMAIN # pylint:disable=unused-import
from . import DOMAIN

_LOGGER = logging.getLogger(__name__)

Expand Down
14 changes: 5 additions & 9 deletions homeassistant/components/hdmi_cec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
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,
Expand All @@ -25,8 +21,8 @@
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
Expand Down
8 changes: 2 additions & 6 deletions homeassistant/components/hdmi_cec/media_player.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Loading