Upgrade pylint to 2.6.0 (#39363)

This commit is contained in:
Ville Skyttä 2020-08-29 08:59:24 +03:00 committed by GitHub
parent 67de1d3466
commit 1bf2c4d976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 77 additions and 86 deletions

View file

@ -31,7 +31,8 @@ jobs:
- python: "3.7.1" - python: "3.7.1"
env: TOXENV=lint env: TOXENV=lint
- python: "3.7.1" - python: "3.7.1"
env: TOXENV=pylint PYLINT_ARGS=--jobs=0 TRAVIS_WAIT=30 # PYLINT_ARGS=--jobs=0 disabled for now: https://github.com/PyCQA/pylint/issues/3584
env: TOXENV=pylint TRAVIS_WAIT=30
- python: "3.7.1" - python: "3.7.1"
env: TOXENV=typing env: TOXENV=typing

View file

@ -72,4 +72,4 @@ class _OwnerPermissions(AbstractPermissions):
return lambda entity_id, key: True return lambda entity_id, key: True
OwnerPermissions = _OwnerPermissions() # pylint: disable=invalid-name OwnerPermissions = _OwnerPermissions()

View file

@ -26,10 +26,8 @@ class AcmedaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
if ( if (
user_input is not None user_input is not None
and self.discovered_hubs is not None and self.discovered_hubs is not None
# pylint: disable=unsupported-membership-test
and user_input["id"] in self.discovered_hubs and user_input["id"] in self.discovered_hubs
): ):
# pylint: disable=unsubscriptable-object
return await self.async_create(self.discovered_hubs[user_input["id"]]) return await self.async_create(self.discovered_hubs[user_input["id"]])
# Already configured hosts # Already configured hosts

View file

@ -11,7 +11,7 @@ from yarl import URL
from homeassistant import config_entries, core, data_entry_flow from homeassistant import config_entries, core, data_entry_flow
from homeassistant.helpers import aiohttp_client, config_entry_oauth2_flow from homeassistant.helpers import aiohttp_client, config_entry_oauth2_flow
from .const import DOMAIN, TYPE_LOCAL, TYPE_OAUTH2 from .const import DOMAIN as ALMOND_DOMAIN, TYPE_LOCAL, TYPE_OAUTH2
async def async_verify_local_connection(hass: core.HomeAssistant, host: str): async def async_verify_local_connection(hass: core.HomeAssistant, host: str):
@ -28,11 +28,11 @@ async def async_verify_local_connection(hass: core.HomeAssistant, host: str):
return False return False
@config_entries.HANDLERS.register(DOMAIN) @config_entries.HANDLERS.register(ALMOND_DOMAIN)
class AlmondFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler): class AlmondFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler):
"""Implementation of the Almond OAuth2 config flow.""" """Implementation of the Almond OAuth2 config flow."""
DOMAIN = DOMAIN DOMAIN = ALMOND_DOMAIN
host = None host = None
hassio_discovery = None hassio_discovery = None

View file

@ -374,7 +374,7 @@ def adb_decorator(override_available=False):
err, err,
) )
await self.aftv.adb_close() await self.aftv.adb_close()
self._available = False # pylint: disable=protected-access self._available = False
return None return None
return _adb_exception_catcher return _adb_exception_catcher

View file

@ -64,7 +64,7 @@ class DateTimeJSONEncoder(json.JSONEncoder):
Additionally add encoding for datetime objects as isoformat. Additionally add encoding for datetime objects as isoformat.
""" """
def default(self, o): # pylint: disable=method-hidden def default(self, o):
"""Implement encoding logic.""" """Implement encoding logic."""
if isinstance(o, datetime): if isinstance(o, datetime):
return o.isoformat() return o.isoformat()

View file

@ -39,7 +39,7 @@ NOTIFICATION_AUTH_TITLE = "Apple TV Authentication"
NOTIFICATION_SCAN_ID = "apple_tv_scan_notification" NOTIFICATION_SCAN_ID = "apple_tv_scan_notification"
NOTIFICATION_SCAN_TITLE = "Apple TV Scan" NOTIFICATION_SCAN_TITLE = "Apple TV Scan"
T = TypeVar("T") # pylint: disable=invalid-name T = TypeVar("T")
# This version of ensure_list interprets an empty dict as no value # This version of ensure_list interprets an empty dict as no value

View file

@ -1,7 +1,7 @@
"""Support for the Elgato Avea lights.""" """Support for the Elgato Avea lights."""
import logging import logging
import avea import avea # pylint: disable=import-error
from homeassistant.components.light import ( from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS,

View file

@ -1,7 +1,7 @@
"""Platform for beewi_smartclim integration.""" """Platform for beewi_smartclim integration."""
import logging import logging
from beewi_smartclim import BeewiSmartClimPoller from beewi_smartclim import BeewiSmartClimPoller # pylint: disable=import-error
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA

View file

@ -41,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema(
extra=vol.ALLOW_EXTRA, extra=vol.ALLOW_EXTRA,
) )
async_register = bind_hass(async_register) # pylint: disable=invalid-name async_register = bind_hass(async_register)
@core.callback @core.callback

View file

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

View file

@ -80,7 +80,6 @@ async def async_unload_entry(hass, entry):
return True return True
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

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

View file

@ -433,7 +433,6 @@ def esphome_state_property(func):
@property @property
def _wrapper(self): def _wrapper(self):
# pylint: disable=protected-access
if self._state is None: if self._state is None:
return None return None
val = func(self) val = func(self)

View file

@ -59,7 +59,7 @@ async def validate_input(hass: core.HomeAssistant, data):
flume_devices = await hass.async_add_executor_job(FlumeDeviceList, flume_auth) flume_devices = await hass.async_add_executor_job(FlumeDeviceList, flume_auth)
except RequestException as err: except RequestException as err:
raise CannotConnect from err raise CannotConnect from err
except Exception as err: # pylint: disable=broad-except except Exception as err:
raise InvalidAuth from err raise InvalidAuth from err
if not flume_devices or not flume_devices.device_list: if not flume_devices or not flume_devices.device_list:
raise CannotConnect raise CannotConnect

View file

@ -154,5 +154,4 @@ async def async_unload_entry(hass, entry):
return True return True
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

@ -1715,7 +1715,7 @@ class VolumeTrait(_Trait):
svc = media_player.SERVICE_VOLUME_DOWN svc = media_player.SERVICE_VOLUME_DOWN
relative = -relative relative = -relative
for i in range(relative): for _ in range(relative):
await self.hass.services.async_call( await self.hass.services.async_call(
media_player.DOMAIN, media_player.DOMAIN,
svc, svc,

View file

@ -89,7 +89,7 @@ class DateTimeJSONEncoder(json.JSONEncoder):
Additionally add encoding for datetime objects as isoformat. Additionally add encoding for datetime objects as isoformat.
""" """
def default(self, o): # pylint: disable=method-hidden def default(self, o):
"""Implement encoding logic.""" """Implement encoding logic."""
if isinstance(o, datetime.datetime): if isinstance(o, datetime.datetime):
return o.isoformat() return o.isoformat()

View file

@ -116,5 +116,4 @@ async def async_unload_entry(hass, entry):
return True return True
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

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

View file

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

View file

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

View file

@ -723,7 +723,6 @@ class HomeKitPairingQRView(HomeAssistantView):
name = "api:homekit:pairingqr" name = "api:homekit:pairingqr"
requires_auth = False requires_auth = False
# pylint: disable=no-self-use
async def get(self, request): async def get(self, request):
"""Retrieve the pairing QRCode image.""" """Retrieve the pairing QRCode image."""
if not request.query_string: if not request.query_string:

View file

@ -123,5 +123,4 @@ async def async_unload_entry(hass, entry):
return True return True
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

@ -388,7 +388,7 @@ class ItunesDevice(MediaPlayerEntity):
def media_next_track(self): def media_next_track(self):
"""Send media_next command to media player.""" """Send media_next command to media player."""
response = self.client.next() response = self.client.next() # pylint: disable=not-callable
self.update_state(response) self.update_state(response)
def media_previous_track(self): def media_previous_track(self):

View file

@ -94,7 +94,6 @@ class KNXLight(LightEntity):
return self.device.current_brightness return self.device.current_brightness
hsv_color = self._hsv_color hsv_color = self._hsv_color
if self.device.supports_color and hsv_color: if self.device.supports_color and hsv_color:
# pylint: disable=unsubscriptable-object
return round(hsv_color[-1] / 100 * 255) return round(hsv_color[-1] / 100 * 255)
return None return None

View file

@ -442,7 +442,6 @@ class LightEntity(ToggleEntity):
data[ATTR_COLOR_TEMP] = self.color_temp data[ATTR_COLOR_TEMP] = self.color_temp
if supported_features & SUPPORT_COLOR and self.hs_color: if supported_features & SUPPORT_COLOR and self.hs_color:
# pylint: disable=unsubscriptable-object,not-an-iterable
hs_color = self.hs_color hs_color = self.hs_color
data[ATTR_HS_COLOR] = (round(hs_color[0], 3), round(hs_color[1], 3)) data[ATTR_HS_COLOR] = (round(hs_color[0], 3), round(hs_color[1], 3))
data[ATTR_RGB_COLOR] = color_util.color_hs_to_RGB(*hs_color) data[ATTR_RGB_COLOR] = color_util.color_hs_to_RGB(*hs_color)

View file

@ -176,7 +176,7 @@ def state(new_state):
def decorator(function): def decorator(function):
"""Set up the decorator function.""" """Set up the decorator function."""
# pylint: disable=protected-access
def wrapper(self, **kwargs): def wrapper(self, **kwargs):
"""Wrap a group state change.""" """Wrap a group state change."""

View file

@ -128,5 +128,4 @@ async def async_unload_entry(hass, entry):
return await hass.config_entries.async_forward_entry_unload(entry, DEVICE_TRACKER) return await hass.config_entries.async_forward_entry_unload(entry, DEVICE_TRACKER)
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

@ -64,7 +64,7 @@ class LutronOccupancySensor(LutronCasetaDevice, BinarySensorEntity):
sensors by each room. Therefore, there shouldn't be devices sensors by each room. Therefore, there shouldn't be devices
related to any sensor entities. related to any sensor entities.
""" """
return None # pylint: disable=useless-return return None
@property @property
def device_state_attributes(self): def device_state_attributes(self):

View file

@ -95,5 +95,4 @@ async def async_unload_entry(hass, entry):
return True return True
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

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

View file

@ -129,7 +129,11 @@ class MikrotikData:
"""Return device model name.""" """Return device model name."""
cmd = IDENTITY if param == NAME else INFO cmd = IDENTITY if param == NAME else INFO
data = self.command(MIKROTIK_SERVICES[cmd]) data = self.command(MIKROTIK_SERVICES[cmd])
return data[0].get(param) if data else None return (
data[0].get(param) # pylint: disable=unsubscriptable-object
if data
else None
)
def get_hub_details(self): def get_hub_details(self):
"""Get Hub info.""" """Get Hub info."""
@ -229,7 +233,7 @@ class MikrotikData:
data = self.command(cmd, params) data = self.command(cmd, params)
if data is not None: if data is not None:
status = 0 status = 0
for result in data: for result in data: # pylint: disable=not-an-iterable
if "status" in result: if "status" in result:
status += 1 status += 1
if status == len(data): if status == len(data):

View file

@ -48,7 +48,7 @@ async def validate_input(hass: core.HomeAssistant, data):
# #
# The underlying module throws a generic exception on login failure # The underlying module throws a generic exception on login failure
# #
except Exception as ex: # pylint: disable=broad-except except Exception as ex:
raise InvalidAuth from ex raise InvalidAuth from ex
try: try:

View file

@ -184,7 +184,7 @@ class PlexServer:
if _update_plexdirect_hostname(): if _update_plexdirect_hostname():
config_entry_update_needed = True config_entry_update_needed = True
else: else:
raise Unauthorized( raise Unauthorized( # pylint: disable=raise-missing-from
"New certificate cannot be validated with provided token" "New certificate cannot be validated with provided token"
) )
else: else:

View file

@ -566,7 +566,7 @@ class SimpliSafe:
LOGGER.error("SimpliSafe error while updating: %s", result) LOGGER.error("SimpliSafe error while updating: %s", result)
return return
if isinstance(result, Exception): # pylint: disable=broad-except if isinstance(result, Exception):
LOGGER.error("Unknown error while updating: %s", result) LOGGER.error("Unknown error while updating: %s", result)
return return

View file

@ -165,7 +165,7 @@ class LogErrorQueueHandler(logging.handlers.QueueHandler):
"""Emit a log record.""" """Emit a log record."""
try: try:
self.enqueue(record) self.enqueue(record)
except asyncio.CancelledError: # pylint: disable=try-except-raise except asyncio.CancelledError:
raise raise
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
self.handleError(record) self.handleError(record)

View file

@ -107,5 +107,4 @@ async def async_unload_entry(hass, entry):
return True return True
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

@ -64,5 +64,4 @@ async def async_unload_entry(hass, entry):
return True return True
# pylint: disable=invalid-name
async_remove_entry = config_entry_flow.webhook_async_remove_entry async_remove_entry = config_entry_flow.webhook_async_remove_entry

View file

@ -15,7 +15,6 @@ DOMAIN = const.DOMAIN
DEPENDENCIES = ("http",) DEPENDENCIES = ("http",)
# Backwards compat / Make it easier to integrate # Backwards compat / Make it easier to integrate
# pylint: disable=invalid-name
ActiveConnection = connection.ActiveConnection ActiveConnection = connection.ActiveConnection
BASE_COMMAND_MESSAGE_SCHEMA = messages.BASE_COMMAND_MESSAGE_SCHEMA BASE_COMMAND_MESSAGE_SCHEMA = messages.BASE_COMMAND_MESSAGE_SCHEMA
error_message = messages.error_message error_message = messages.error_message
@ -25,7 +24,6 @@ async_response = decorators.async_response
require_admin = decorators.require_admin require_admin = decorators.require_admin
ws_require_user = decorators.ws_require_user ws_require_user = decorators.ws_require_user
websocket_command = decorators.websocket_command websocket_command = decorators.websocket_command
# pylint: enable=invalid-name
@bind_hass @bind_hass

View file

@ -240,12 +240,9 @@ class MatchRule:
return matches return matches
RegistryDictType = Dict[ RegistryDictType = Dict[str, Dict[MatchRule, CALLABLE_T]]
str, Dict[MatchRule, CALLABLE_T]
] # pylint: disable=invalid-name
GroupRegistryDictType = Dict[str, CALLABLE_T]
GroupRegistryDictType = Dict[str, CALLABLE_T] # pylint: disable=invalid-name
class ZHAEntityRegistry: class ZHAEntityRegistry:

View file

@ -593,7 +593,7 @@ async def async_setup_entry(hass, config_entry):
async def rename_node(service): async def rename_node(service):
"""Rename a node.""" """Rename a node."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
name = service.data.get(const.ATTR_NAME) name = service.data.get(const.ATTR_NAME)
node.name = name node.name = name
_LOGGER.info("Renamed Z-Wave node %d to %s", node_id, name) _LOGGER.info("Renamed Z-Wave node %d to %s", node_id, name)
@ -613,7 +613,7 @@ async def async_setup_entry(hass, config_entry):
"""Rename a node value.""" """Rename a node value."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
value_id = service.data.get(const.ATTR_VALUE_ID) value_id = service.data.get(const.ATTR_VALUE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
value = node.values[value_id] value = node.values[value_id]
name = service.data.get(const.ATTR_NAME) name = service.data.get(const.ATTR_NAME)
value.label = name value.label = name
@ -629,7 +629,7 @@ async def async_setup_entry(hass, config_entry):
"""Set the polling intensity of a node value.""" """Set the polling intensity of a node value."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
value_id = service.data.get(const.ATTR_VALUE_ID) value_id = service.data.get(const.ATTR_VALUE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
value = node.values[value_id] value = node.values[value_id]
intensity = service.data.get(const.ATTR_POLL_INTENSITY) intensity = service.data.get(const.ATTR_POLL_INTENSITY)
if intensity == 0: if intensity == 0:
@ -667,7 +667,7 @@ async def async_setup_entry(hass, config_entry):
def set_config_parameter(service): def set_config_parameter(service):
"""Set a config parameter to a node.""" """Set a config parameter to a node."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
param = service.data.get(const.ATTR_CONFIG_PARAMETER) param = service.data.get(const.ATTR_CONFIG_PARAMETER)
selection = service.data.get(const.ATTR_CONFIG_VALUE) selection = service.data.get(const.ATTR_CONFIG_VALUE)
size = service.data.get(const.ATTR_CONFIG_SIZE) size = service.data.get(const.ATTR_CONFIG_SIZE)
@ -725,7 +725,7 @@ async def async_setup_entry(hass, config_entry):
"""Refresh the specified value from a node.""" """Refresh the specified value from a node."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
value_id = service.data.get(const.ATTR_VALUE_ID) value_id = service.data.get(const.ATTR_VALUE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
node.values[value_id].refresh() node.values[value_id].refresh()
_LOGGER.info("Node %s value %s refreshed", node_id, value_id) _LOGGER.info("Node %s value %s refreshed", node_id, value_id)
@ -734,14 +734,14 @@ async def async_setup_entry(hass, config_entry):
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
value_id = service.data.get(const.ATTR_VALUE_ID) value_id = service.data.get(const.ATTR_VALUE_ID)
value = service.data.get(const.ATTR_CONFIG_VALUE) value = service.data.get(const.ATTR_CONFIG_VALUE)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
node.values[value_id].data = value node.values[value_id].data = value
_LOGGER.info("Node %s value %s set to %s", node_id, value_id, value) _LOGGER.info("Node %s value %s set to %s", node_id, value_id, value)
def print_config_parameter(service): def print_config_parameter(service):
"""Print a config parameter from a node.""" """Print a config parameter from a node."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
param = service.data.get(const.ATTR_CONFIG_PARAMETER) param = service.data.get(const.ATTR_CONFIG_PARAMETER)
_LOGGER.info( _LOGGER.info(
"Config parameter %s on Node %s: %s", "Config parameter %s on Node %s: %s",
@ -753,13 +753,13 @@ async def async_setup_entry(hass, config_entry):
def print_node(service): def print_node(service):
"""Print all information about z-wave node.""" """Print all information about z-wave node."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
nice_print_node(node) nice_print_node(node)
def set_wakeup(service): def set_wakeup(service):
"""Set wake-up interval of a node.""" """Set wake-up interval of a node."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
value = service.data.get(const.ATTR_CONFIG_VALUE) value = service.data.get(const.ATTR_CONFIG_VALUE)
if node.can_wake_up(): if node.can_wake_up():
for value_id in node.get_values(class_id=const.COMMAND_CLASS_WAKE_UP): for value_id in node.get_values(class_id=const.COMMAND_CLASS_WAKE_UP):
@ -806,14 +806,14 @@ async def async_setup_entry(hass, config_entry):
def refresh_node(service): def refresh_node(service):
"""Refresh all node info.""" """Refresh all node info."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
node.refresh_info() node.refresh_info()
def reset_node_meters(service): def reset_node_meters(service):
"""Reset meter counters of a node.""" """Reset meter counters of a node."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
instance = service.data.get(const.ATTR_INSTANCE) instance = service.data.get(const.ATTR_INSTANCE)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
for value in node.get_values(class_id=const.COMMAND_CLASS_METER).values(): for value in node.get_values(class_id=const.COMMAND_CLASS_METER).values():
if value.index != const.INDEX_METER_RESET: if value.index != const.INDEX_METER_RESET:
continue continue
@ -833,7 +833,7 @@ async def async_setup_entry(hass, config_entry):
"""Heal a node on the network.""" """Heal a node on the network."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
update_return_routes = service.data.get(const.ATTR_RETURN_ROUTES) update_return_routes = service.data.get(const.ATTR_RETURN_ROUTES)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
_LOGGER.info("Z-Wave node heal running for node %s", node_id) _LOGGER.info("Z-Wave node heal running for node %s", node_id)
node.heal(update_return_routes) node.heal(update_return_routes)
@ -841,7 +841,7 @@ async def async_setup_entry(hass, config_entry):
"""Send test messages to a node on the network.""" """Send test messages to a node on the network."""
node_id = service.data.get(const.ATTR_NODE_ID) node_id = service.data.get(const.ATTR_NODE_ID)
messages = service.data.get(const.ATTR_MESSAGES) messages = service.data.get(const.ATTR_MESSAGES)
node = network.nodes[node_id] node = network.nodes[node_id] # pylint: disable=unsubscriptable-object
_LOGGER.info("Sending %s test-messages to node %s", messages, node_id) _LOGGER.info("Sending %s test-messages to node %s", messages, node_id)
node.test(messages) node.test(messages)

View file

@ -743,6 +743,7 @@ class ConfigEntries:
self, self,
entry: ConfigEntry, entry: ConfigEntry,
*, *,
# pylint: disable=dangerous-default-value # _UNDEFs not modified
unique_id: Union[str, dict, None] = _UNDEF, unique_id: Union[str, dict, None] = _UNDEF,
title: Union[str, dict] = _UNDEF, title: Union[str, dict] = _UNDEF,
data: dict = _UNDEF, data: dict = _UNDEF,

View file

@ -158,7 +158,7 @@ class CoreState(enum.Enum):
final_write = "FINAL_WRITE" final_write = "FINAL_WRITE"
stopped = "STOPPED" stopped = "STOPPED"
def __str__(self) -> str: def __str__(self) -> str: # pylint: disable=invalid-str-returned
"""Return the event.""" """Return the event."""
return self.value # type: ignore return self.value # type: ignore
@ -523,7 +523,7 @@ class EventOrigin(enum.Enum):
local = "LOCAL" local = "LOCAL"
remote = "REMOTE" remote = "REMOTE"
def __str__(self) -> str: def __str__(self) -> str: # pylint: disable=invalid-str-returned
"""Return the event.""" """Return the event."""
return self.value # type: ignore return self.value # type: ignore
@ -1483,6 +1483,7 @@ class Config:
unit_system: Optional[str] = None, unit_system: Optional[str] = None,
location_name: Optional[str] = None, location_name: Optional[str] = None,
time_zone: Optional[str] = None, time_zone: Optional[str] = None,
# pylint: disable=dangerous-default-value # _UNDEFs not modified
external_url: Optional[Union[str, dict]] = _UNDEF, external_url: Optional[Union[str, dict]] = _UNDEF,
internal_url: Optional[Union[str, dict]] = _UNDEF, internal_url: Optional[Union[str, dict]] = _UNDEF,
) -> None: ) -> None:

View file

@ -47,9 +47,6 @@ TRACK_ENTITY_REGISTRY_UPDATED_LISTENER = "track_entity_registry_updated_listener
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
# PyLint does not like the use of threaded_listener_factory
# pylint: disable=invalid-name
def threaded_listener_factory(async_factory: Callable[..., Any]) -> CALLBACK_TYPE: def threaded_listener_factory(async_factory: Callable[..., Any]) -> CALLBACK_TYPE:
"""Convert an async event helper to a threaded one.""" """Convert an async event helper to a threaded one."""

View file

@ -10,7 +10,6 @@ _LOGGER = logging.getLogger(__name__)
class JSONEncoder(json.JSONEncoder): class JSONEncoder(json.JSONEncoder):
"""JSONEncoder that supports Home Assistant objects.""" """JSONEncoder that supports Home Assistant objects."""
# pylint: disable=method-hidden
def default(self, o: Any) -> Any: def default(self, o: Any) -> Any:
"""Convert Home Assistant objects. """Convert Home Assistant objects.

View file

@ -3,8 +3,6 @@ from typing import Any, Dict, Optional, Tuple, Union
import homeassistant.core import homeassistant.core
# pylint: disable=invalid-name
GPSType = Tuple[float, float] GPSType = Tuple[float, float]
ConfigType = Dict[str, Any] ConfigType = Dict[str, Any]
ContextType = homeassistant.core.Context ContextType = homeassistant.core.Context

View file

@ -46,7 +46,7 @@ class RuntimeConfig:
if sys.platform == "win32" and sys.version_info[:2] < (3, 8): if sys.platform == "win32" and sys.version_info[:2] < (3, 8):
PolicyBase = asyncio.WindowsProactorEventLoopPolicy PolicyBase = asyncio.WindowsProactorEventLoopPolicy
else: else:
PolicyBase = asyncio.DefaultEventLoopPolicy # pylint: disable=invalid-name PolicyBase = asyncio.DefaultEventLoopPolicy
class HassEventLoopPolicy(PolicyBase): # type: ignore class HassEventLoopPolicy(PolicyBase): # type: ignore
@ -117,9 +117,7 @@ def _async_loop_exception_handler(_: Any, context: Dict) -> None:
) )
async def setup_and_run_hass( async def setup_and_run_hass(runtime_config: RuntimeConfig) -> int:
runtime_config: RuntimeConfig,
) -> int:
"""Set up Home Assistant and run.""" """Set up Home Assistant and run."""
hass = await bootstrap.async_setup_hass(runtime_config) hass = await bootstrap.async_setup_hass(runtime_config)

View file

@ -10,7 +10,7 @@ from typing import Any, Callable, Coroutine, TypeVar
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
T = TypeVar("T") # pylint: disable=invalid-name T = TypeVar("T")
def fire_coroutine_threadsafe(coro: Coroutine, loop: AbstractEventLoop) -> None: def fire_coroutine_threadsafe(coro: Coroutine, loop: AbstractEventLoop) -> None:

View file

@ -34,7 +34,7 @@ class HomeAssistantQueueHandler(logging.handlers.QueueHandler):
"""Emit a log record.""" """Emit a log record."""
try: try:
self.enqueue(record) self.enqueue(record)
except asyncio.CancelledError: # pylint: disable=try-except-raise except asyncio.CancelledError:
raise raise
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
self.handleError(record) self.handleError(record)

View file

@ -2,7 +2,8 @@
ignore=tests ignore=tests
# Use a conservative default here; 2 should speed up most setups and not hurt # Use a conservative default here; 2 should speed up most setups and not hurt
# any too bad. Override on command line as appropriate. # any too bad. Override on command line as appropriate.
jobs=2 # Disabled for now: https://github.com/PyCQA/pylint/issues/3584
#jobs=2
load-plugins=pylint_strict_informational load-plugins=pylint_strict_informational
persistent=no persistent=no
extension-pkg-whitelist=ciso8601,cv2 extension-pkg-whitelist=ciso8601,cv2
@ -46,6 +47,7 @@ disable=
too-many-boolean-expressions, too-many-boolean-expressions,
unused-argument, unused-argument,
wrong-import-order wrong-import-order
# enable useless-suppression temporarily every now and then to clean them up
enable= enable=
use-symbolic-message-instead use-symbolic-message-instead

View file

@ -10,8 +10,8 @@ coverage==5.2.1
mock-open==1.4.0 mock-open==1.4.0
mypy==0.780 mypy==0.780
pre-commit==2.7.1 pre-commit==2.7.1
pylint==2.4.4 pylint==2.6.0
astroid==2.3.3 astroid==2.4.2
pylint-strict-informational==0.1 pylint-strict-informational==0.1
pytest-aiohttp==0.3.0 pytest-aiohttp==0.3.0
pytest-cov==2.10.0 pytest-cov==2.10.0