Upgrade pylint to 2.6.0 (#39363)
This commit is contained in:
parent
67de1d3466
commit
1bf2c4d976
52 changed files with 77 additions and 86 deletions
|
@ -31,7 +31,8 @@ jobs:
|
|||
- python: "3.7.1"
|
||||
env: TOXENV=lint
|
||||
- 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"
|
||||
env: TOXENV=typing
|
||||
|
||||
|
|
|
@ -72,4 +72,4 @@ class _OwnerPermissions(AbstractPermissions):
|
|||
return lambda entity_id, key: True
|
||||
|
||||
|
||||
OwnerPermissions = _OwnerPermissions() # pylint: disable=invalid-name
|
||||
OwnerPermissions = _OwnerPermissions()
|
||||
|
|
|
@ -26,10 +26,8 @@ class AcmedaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
if (
|
||||
user_input is not None
|
||||
and self.discovered_hubs is not None
|
||||
# pylint: disable=unsupported-membership-test
|
||||
and user_input["id"] in self.discovered_hubs
|
||||
):
|
||||
# pylint: disable=unsubscriptable-object
|
||||
return await self.async_create(self.discovered_hubs[user_input["id"]])
|
||||
|
||||
# Already configured hosts
|
||||
|
|
|
@ -11,7 +11,7 @@ from yarl import URL
|
|||
from homeassistant import config_entries, core, data_entry_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):
|
||||
|
@ -28,11 +28,11 @@ async def async_verify_local_connection(hass: core.HomeAssistant, host: str):
|
|||
return False
|
||||
|
||||
|
||||
@config_entries.HANDLERS.register(DOMAIN)
|
||||
@config_entries.HANDLERS.register(ALMOND_DOMAIN)
|
||||
class AlmondFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler):
|
||||
"""Implementation of the Almond OAuth2 config flow."""
|
||||
|
||||
DOMAIN = DOMAIN
|
||||
DOMAIN = ALMOND_DOMAIN
|
||||
|
||||
host = None
|
||||
hassio_discovery = None
|
||||
|
|
|
@ -374,7 +374,7 @@ def adb_decorator(override_available=False):
|
|||
err,
|
||||
)
|
||||
await self.aftv.adb_close()
|
||||
self._available = False # pylint: disable=protected-access
|
||||
self._available = False
|
||||
return None
|
||||
|
||||
return _adb_exception_catcher
|
||||
|
|
|
@ -64,7 +64,7 @@ class DateTimeJSONEncoder(json.JSONEncoder):
|
|||
Additionally add encoding for datetime objects as isoformat.
|
||||
"""
|
||||
|
||||
def default(self, o): # pylint: disable=method-hidden
|
||||
def default(self, o):
|
||||
"""Implement encoding logic."""
|
||||
if isinstance(o, datetime):
|
||||
return o.isoformat()
|
||||
|
|
|
@ -39,7 +39,7 @@ NOTIFICATION_AUTH_TITLE = "Apple TV Authentication"
|
|||
NOTIFICATION_SCAN_ID = "apple_tv_scan_notification"
|
||||
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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for the Elgato Avea lights."""
|
||||
import logging
|
||||
|
||||
import avea
|
||||
import avea # pylint: disable=import-error
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Platform for beewi_smartclim integration."""
|
||||
import logging
|
||||
|
||||
from beewi_smartclim import BeewiSmartClimPoller
|
||||
from beewi_smartclim import BeewiSmartClimPoller # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
|
|
|
@ -41,7 +41,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
async_register = bind_hass(async_register) # pylint: disable=invalid-name
|
||||
async_register = bind_hass(async_register)
|
||||
|
||||
|
||||
@core.callback
|
||||
|
|
|
@ -4,7 +4,9 @@ from functools import wraps
|
|||
import logging
|
||||
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 voluptuous as vol
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
async_remove_entry = config_entry_flow.webhook_async_remove_entry
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""Support for eQ-3 Bluetooth Smart thermostats."""
|
||||
import logging
|
||||
|
||||
# pylint: disable=import-error
|
||||
from bluepy.btle import BTLEException
|
||||
from bluepy.btle import BTLEException # pylint: disable=import-error, no-name-in-module
|
||||
import eq3bt as eq3 # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
|
|
|
@ -433,7 +433,6 @@ def esphome_state_property(func):
|
|||
|
||||
@property
|
||||
def _wrapper(self):
|
||||
# pylint: disable=protected-access
|
||||
if self._state is None:
|
||||
return None
|
||||
val = func(self)
|
||||
|
|
|
@ -59,7 +59,7 @@ async def validate_input(hass: core.HomeAssistant, data):
|
|||
flume_devices = await hass.async_add_executor_job(FlumeDeviceList, flume_auth)
|
||||
except RequestException as err:
|
||||
raise CannotConnect from err
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
except Exception as err:
|
||||
raise InvalidAuth from err
|
||||
if not flume_devices or not flume_devices.device_list:
|
||||
raise CannotConnect
|
||||
|
|
|
@ -154,5 +154,4 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
async_remove_entry = config_entry_flow.webhook_async_remove_entry
|
||||
|
|
|
@ -1715,7 +1715,7 @@ class VolumeTrait(_Trait):
|
|||
svc = media_player.SERVICE_VOLUME_DOWN
|
||||
relative = -relative
|
||||
|
||||
for i in range(relative):
|
||||
for _ in range(relative):
|
||||
await self.hass.services.async_call(
|
||||
media_player.DOMAIN,
|
||||
svc,
|
||||
|
|
|
@ -89,7 +89,7 @@ class DateTimeJSONEncoder(json.JSONEncoder):
|
|||
Additionally add encoding for datetime objects as isoformat.
|
||||
"""
|
||||
|
||||
def default(self, o): # pylint: disable=method-hidden
|
||||
def default(self, o):
|
||||
"""Implement encoding logic."""
|
||||
if isinstance(o, datetime.datetime):
|
||||
return o.isoformat()
|
||||
|
|
|
@ -116,5 +116,4 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
async_remove_entry = config_entry_flow.webhook_async_remove_entry
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -4,9 +4,13 @@ from functools import reduce
|
|||
import logging
|
||||
import multiprocessing
|
||||
|
||||
from pycec.cec import CecAdapter
|
||||
from pycec.commands import CecCommand, KeyPressCommand, KeyReleaseCommand
|
||||
from pycec.const import (
|
||||
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
|
||||
ADDR_AUDIOSYSTEM,
|
||||
ADDR_BROADCAST,
|
||||
ADDR_UNREGISTERED,
|
||||
|
@ -21,8 +25,8 @@ from pycec.const import (
|
|||
STATUS_STILL,
|
||||
STATUS_STOP,
|
||||
)
|
||||
from pycec.network import HDMINetwork, PhysicalAddress
|
||||
from pycec.tcp import TcpAdapter
|
||||
from pycec.network import HDMINetwork, PhysicalAddress # pylint: disable=import-error
|
||||
from pycec.tcp import TcpAdapter # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
"""Support for HDMI CEC devices as media players."""
|
||||
import logging
|
||||
|
||||
from pycec.commands import CecCommand, KeyPressCommand, KeyReleaseCommand
|
||||
from pycec.const import (
|
||||
from pycec.commands import ( # pylint: disable=import-error
|
||||
CecCommand,
|
||||
KeyPressCommand,
|
||||
KeyReleaseCommand,
|
||||
)
|
||||
from pycec.const import ( # pylint: disable=import-error
|
||||
KEY_BACKWARD,
|
||||
KEY_FORWARD,
|
||||
KEY_MUTE_TOGGLE,
|
||||
|
|
|
@ -723,7 +723,6 @@ class HomeKitPairingQRView(HomeAssistantView):
|
|||
name = "api:homekit:pairingqr"
|
||||
requires_auth = False
|
||||
|
||||
# pylint: disable=no-self-use
|
||||
async def get(self, request):
|
||||
"""Retrieve the pairing QRCode image."""
|
||||
if not request.query_string:
|
||||
|
|
|
@ -123,5 +123,4 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
async_remove_entry = config_entry_flow.webhook_async_remove_entry
|
||||
|
|
|
@ -388,7 +388,7 @@ class ItunesDevice(MediaPlayerEntity):
|
|||
|
||||
def media_next_track(self):
|
||||
"""Send media_next command to media player."""
|
||||
response = self.client.next()
|
||||
response = self.client.next() # pylint: disable=not-callable
|
||||
self.update_state(response)
|
||||
|
||||
def media_previous_track(self):
|
||||
|
|
|
@ -94,7 +94,6 @@ class KNXLight(LightEntity):
|
|||
return self.device.current_brightness
|
||||
hsv_color = self._hsv_color
|
||||
if self.device.supports_color and hsv_color:
|
||||
# pylint: disable=unsubscriptable-object
|
||||
return round(hsv_color[-1] / 100 * 255)
|
||||
return None
|
||||
|
||||
|
|
|
@ -442,7 +442,6 @@ class LightEntity(ToggleEntity):
|
|||
data[ATTR_COLOR_TEMP] = self.color_temp
|
||||
|
||||
if supported_features & SUPPORT_COLOR and self.hs_color:
|
||||
# pylint: disable=unsubscriptable-object,not-an-iterable
|
||||
hs_color = self.hs_color
|
||||
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)
|
||||
|
|
|
@ -176,7 +176,7 @@ def state(new_state):
|
|||
|
||||
def decorator(function):
|
||||
"""Set up the decorator function."""
|
||||
# pylint: disable=protected-access
|
||||
|
||||
def wrapper(self, **kwargs):
|
||||
"""Wrap a group state change."""
|
||||
|
||||
|
|
|
@ -128,5 +128,4 @@ async def async_unload_entry(hass, entry):
|
|||
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
|
||||
|
|
|
@ -64,7 +64,7 @@ class LutronOccupancySensor(LutronCasetaDevice, BinarySensorEntity):
|
|||
sensors by each room. Therefore, there shouldn't be devices
|
||||
related to any sensor entities.
|
||||
"""
|
||||
return None # pylint: disable=useless-return
|
||||
return None
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
|
|
|
@ -95,5 +95,4 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
async_remove_entry = config_entry_flow.webhook_async_remove_entry
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
|
||||
import btlewrap
|
||||
from btlewrap import BluetoothBackendException
|
||||
from miflora import miflora_poller
|
||||
from miflora import miflora_poller # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
|
|
|
@ -129,7 +129,11 @@ class MikrotikData:
|
|||
"""Return device model name."""
|
||||
cmd = IDENTITY if param == NAME else INFO
|
||||
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):
|
||||
"""Get Hub info."""
|
||||
|
@ -229,7 +233,7 @@ class MikrotikData:
|
|||
data = self.command(cmd, params)
|
||||
if data is not None:
|
||||
status = 0
|
||||
for result in data:
|
||||
for result in data: # pylint: disable=not-an-iterable
|
||||
if "status" in result:
|
||||
status += 1
|
||||
if status == len(data):
|
||||
|
|
|
@ -48,7 +48,7 @@ async def validate_input(hass: core.HomeAssistant, data):
|
|||
#
|
||||
# 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
|
||||
|
||||
try:
|
||||
|
|
|
@ -184,7 +184,7 @@ class PlexServer:
|
|||
if _update_plexdirect_hostname():
|
||||
config_entry_update_needed = True
|
||||
else:
|
||||
raise Unauthorized(
|
||||
raise Unauthorized( # pylint: disable=raise-missing-from
|
||||
"New certificate cannot be validated with provided token"
|
||||
)
|
||||
else:
|
||||
|
|
|
@ -566,7 +566,7 @@ class SimpliSafe:
|
|||
LOGGER.error("SimpliSafe error while updating: %s", result)
|
||||
return
|
||||
|
||||
if isinstance(result, Exception): # pylint: disable=broad-except
|
||||
if isinstance(result, Exception):
|
||||
LOGGER.error("Unknown error while updating: %s", result)
|
||||
return
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ class LogErrorQueueHandler(logging.handlers.QueueHandler):
|
|||
"""Emit a log record."""
|
||||
try:
|
||||
self.enqueue(record)
|
||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except Exception: # pylint: disable=broad-except
|
||||
self.handleError(record)
|
||||
|
|
|
@ -107,5 +107,4 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
async_remove_entry = config_entry_flow.webhook_async_remove_entry
|
||||
|
|
|
@ -64,5 +64,4 @@ async def async_unload_entry(hass, entry):
|
|||
return True
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
async_remove_entry = config_entry_flow.webhook_async_remove_entry
|
||||
|
|
|
@ -15,7 +15,6 @@ DOMAIN = const.DOMAIN
|
|||
DEPENDENCIES = ("http",)
|
||||
|
||||
# Backwards compat / Make it easier to integrate
|
||||
# pylint: disable=invalid-name
|
||||
ActiveConnection = connection.ActiveConnection
|
||||
BASE_COMMAND_MESSAGE_SCHEMA = messages.BASE_COMMAND_MESSAGE_SCHEMA
|
||||
error_message = messages.error_message
|
||||
|
@ -25,7 +24,6 @@ async_response = decorators.async_response
|
|||
require_admin = decorators.require_admin
|
||||
ws_require_user = decorators.ws_require_user
|
||||
websocket_command = decorators.websocket_command
|
||||
# pylint: enable=invalid-name
|
||||
|
||||
|
||||
@bind_hass
|
||||
|
|
|
@ -240,12 +240,9 @@ class MatchRule:
|
|||
return matches
|
||||
|
||||
|
||||
RegistryDictType = Dict[
|
||||
str, Dict[MatchRule, CALLABLE_T]
|
||||
] # pylint: disable=invalid-name
|
||||
RegistryDictType = Dict[str, Dict[MatchRule, CALLABLE_T]]
|
||||
|
||||
|
||||
GroupRegistryDictType = Dict[str, CALLABLE_T] # pylint: disable=invalid-name
|
||||
GroupRegistryDictType = Dict[str, CALLABLE_T]
|
||||
|
||||
|
||||
class ZHAEntityRegistry:
|
||||
|
|
|
@ -593,7 +593,7 @@ async def async_setup_entry(hass, config_entry):
|
|||
async def rename_node(service):
|
||||
"""Rename a node."""
|
||||
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)
|
||||
node.name = 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."""
|
||||
node_id = service.data.get(const.ATTR_NODE_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]
|
||||
name = service.data.get(const.ATTR_NAME)
|
||||
value.label = name
|
||||
|
@ -629,7 +629,7 @@ async def async_setup_entry(hass, config_entry):
|
|||
"""Set the polling intensity of a node value."""
|
||||
node_id = service.data.get(const.ATTR_NODE_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]
|
||||
intensity = service.data.get(const.ATTR_POLL_INTENSITY)
|
||||
if intensity == 0:
|
||||
|
@ -667,7 +667,7 @@ async def async_setup_entry(hass, config_entry):
|
|||
def set_config_parameter(service):
|
||||
"""Set a config parameter to a node."""
|
||||
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)
|
||||
selection = service.data.get(const.ATTR_CONFIG_VALUE)
|
||||
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."""
|
||||
node_id = service.data.get(const.ATTR_NODE_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()
|
||||
_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)
|
||||
value_id = service.data.get(const.ATTR_VALUE_ID)
|
||||
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
|
||||
_LOGGER.info("Node %s value %s set to %s", node_id, value_id, value)
|
||||
|
||||
def print_config_parameter(service):
|
||||
"""Print a config parameter from a node."""
|
||||
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)
|
||||
_LOGGER.info(
|
||||
"Config parameter %s on Node %s: %s",
|
||||
|
@ -753,13 +753,13 @@ async def async_setup_entry(hass, config_entry):
|
|||
def print_node(service):
|
||||
"""Print all information about z-wave node."""
|
||||
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)
|
||||
|
||||
def set_wakeup(service):
|
||||
"""Set wake-up interval of a node."""
|
||||
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)
|
||||
if node.can_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):
|
||||
"""Refresh all node info."""
|
||||
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()
|
||||
|
||||
def reset_node_meters(service):
|
||||
"""Reset meter counters of a node."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
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():
|
||||
if value.index != const.INDEX_METER_RESET:
|
||||
continue
|
||||
|
@ -833,7 +833,7 @@ async def async_setup_entry(hass, config_entry):
|
|||
"""Heal a node on the network."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
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)
|
||||
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."""
|
||||
node_id = service.data.get(const.ATTR_NODE_ID)
|
||||
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)
|
||||
node.test(messages)
|
||||
|
||||
|
|
|
@ -743,6 +743,7 @@ class ConfigEntries:
|
|||
self,
|
||||
entry: ConfigEntry,
|
||||
*,
|
||||
# pylint: disable=dangerous-default-value # _UNDEFs not modified
|
||||
unique_id: Union[str, dict, None] = _UNDEF,
|
||||
title: Union[str, dict] = _UNDEF,
|
||||
data: dict = _UNDEF,
|
||||
|
|
|
@ -158,7 +158,7 @@ class CoreState(enum.Enum):
|
|||
final_write = "FINAL_WRITE"
|
||||
stopped = "STOPPED"
|
||||
|
||||
def __str__(self) -> str:
|
||||
def __str__(self) -> str: # pylint: disable=invalid-str-returned
|
||||
"""Return the event."""
|
||||
return self.value # type: ignore
|
||||
|
||||
|
@ -523,7 +523,7 @@ class EventOrigin(enum.Enum):
|
|||
local = "LOCAL"
|
||||
remote = "REMOTE"
|
||||
|
||||
def __str__(self) -> str:
|
||||
def __str__(self) -> str: # pylint: disable=invalid-str-returned
|
||||
"""Return the event."""
|
||||
return self.value # type: ignore
|
||||
|
||||
|
@ -1483,6 +1483,7 @@ class Config:
|
|||
unit_system: Optional[str] = None,
|
||||
location_name: Optional[str] = None,
|
||||
time_zone: Optional[str] = None,
|
||||
# pylint: disable=dangerous-default-value # _UNDEFs not modified
|
||||
external_url: Optional[Union[str, dict]] = _UNDEF,
|
||||
internal_url: Optional[Union[str, dict]] = _UNDEF,
|
||||
) -> None:
|
||||
|
|
|
@ -47,9 +47,6 @@ TRACK_ENTITY_REGISTRY_UPDATED_LISTENER = "track_entity_registry_updated_listener
|
|||
|
||||
_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:
|
||||
"""Convert an async event helper to a threaded one."""
|
||||
|
|
|
@ -10,7 +10,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||
class JSONEncoder(json.JSONEncoder):
|
||||
"""JSONEncoder that supports Home Assistant objects."""
|
||||
|
||||
# pylint: disable=method-hidden
|
||||
def default(self, o: Any) -> Any:
|
||||
"""Convert Home Assistant objects.
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ from typing import Any, Dict, Optional, Tuple, Union
|
|||
|
||||
import homeassistant.core
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
|
||||
GPSType = Tuple[float, float]
|
||||
ConfigType = Dict[str, Any]
|
||||
ContextType = homeassistant.core.Context
|
||||
|
|
|
@ -46,7 +46,7 @@ class RuntimeConfig:
|
|||
if sys.platform == "win32" and sys.version_info[:2] < (3, 8):
|
||||
PolicyBase = asyncio.WindowsProactorEventLoopPolicy
|
||||
else:
|
||||
PolicyBase = asyncio.DefaultEventLoopPolicy # pylint: disable=invalid-name
|
||||
PolicyBase = asyncio.DefaultEventLoopPolicy
|
||||
|
||||
|
||||
class HassEventLoopPolicy(PolicyBase): # type: ignore
|
||||
|
@ -117,9 +117,7 @@ def _async_loop_exception_handler(_: Any, context: Dict) -> None:
|
|||
)
|
||||
|
||||
|
||||
async def setup_and_run_hass(
|
||||
runtime_config: RuntimeConfig,
|
||||
) -> int:
|
||||
async def setup_and_run_hass(runtime_config: RuntimeConfig) -> int:
|
||||
"""Set up Home Assistant and run."""
|
||||
hass = await bootstrap.async_setup_hass(runtime_config)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ from typing import Any, Callable, Coroutine, TypeVar
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
T = TypeVar("T") # pylint: disable=invalid-name
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
def fire_coroutine_threadsafe(coro: Coroutine, loop: AbstractEventLoop) -> None:
|
||||
|
|
|
@ -34,7 +34,7 @@ class HomeAssistantQueueHandler(logging.handlers.QueueHandler):
|
|||
"""Emit a log record."""
|
||||
try:
|
||||
self.enqueue(record)
|
||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
||||
except asyncio.CancelledError:
|
||||
raise
|
||||
except Exception: # pylint: disable=broad-except
|
||||
self.handleError(record)
|
||||
|
|
4
pylintrc
4
pylintrc
|
@ -2,7 +2,8 @@
|
|||
ignore=tests
|
||||
# Use a conservative default here; 2 should speed up most setups and not hurt
|
||||
# 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
|
||||
persistent=no
|
||||
extension-pkg-whitelist=ciso8601,cv2
|
||||
|
@ -46,6 +47,7 @@ disable=
|
|||
too-many-boolean-expressions,
|
||||
unused-argument,
|
||||
wrong-import-order
|
||||
# enable useless-suppression temporarily every now and then to clean them up
|
||||
enable=
|
||||
use-symbolic-message-instead
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ coverage==5.2.1
|
|||
mock-open==1.4.0
|
||||
mypy==0.780
|
||||
pre-commit==2.7.1
|
||||
pylint==2.4.4
|
||||
astroid==2.3.3
|
||||
pylint==2.6.0
|
||||
astroid==2.4.2
|
||||
pylint-strict-informational==0.1
|
||||
pytest-aiohttp==0.3.0
|
||||
pytest-cov==2.10.0
|
||||
|
|
Loading…
Add table
Reference in a new issue