Update pylint to 2.9.5 (#53496)

This commit is contained in:
Marc Mueller 2021-07-26 16:17:15 +02:00 committed by GitHub
parent af8f594939
commit 46c3495ae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 16 additions and 26 deletions

View File

@ -1,7 +1,7 @@
"""Auth provider that validates credentials via an external command."""
from __future__ import annotations
import asyncio.subprocess
import asyncio
import collections
from collections.abc import Mapping
import logging
@ -64,7 +64,7 @@ class CommandLineAuthProvider(AuthProvider):
"""Validate a username and password."""
env = {"username": username, "password": password}
try:
process = await asyncio.subprocess.create_subprocess_exec( # pylint: disable=no-member
process = await asyncio.create_subprocess_exec(
self.config[CONF_COMMAND],
*self.config[CONF_ARGS],
env=env,

View File

@ -376,13 +376,13 @@ def adb_decorator(override_available=False):
err,
)
await self.aftv.adb_close()
self._attr_available = False # pylint: disable=protected-access
self._attr_available = False
return None
except Exception:
# An unforeseen exception occurred. Close the ADB connection so that
# it doesn't happen over and over again, then raise the exception.
await self.aftv.adb_close()
self._attr_available = False # pylint: disable=protected-access
self._attr_available = False
raise
return _adb_exception_catcher

View File

@ -134,7 +134,7 @@ def get_data(hass: HomeAssistant, config: dict) -> CO2SignalResponse:
_LOGGER.exception("Unexpected exception")
raise UnknownError from err
except Exception as err: # pylint: disable=broad-except
except Exception as err:
_LOGGER.exception("Unexpected exception")
raise UnknownError from err

View File

@ -53,6 +53,8 @@ class TurboJPEGSingleton:
def __init__(self):
"""Try to create TurboJPEG only once."""
# pylint: disable=unused-private-member
# https://github.com/PyCQA/pylint/issues/4681
try:
# TurboJPEG checks for libturbojpeg
# when its created, but it imports

View File

@ -117,7 +117,6 @@ class PlugwiseConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
_version = _properties.get("version", "n/a")
_name = f"{ZEROCONF_MAP.get(_product, _product)} v{_version}"
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
self.context["title_placeholders"] = {
CONF_HOST: self.discovery_info[CONF_HOST],
CONF_NAME: _name,

View File

@ -60,8 +60,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
if rendered_args == args:
# No template used. default behavior
# pylint: disable=no-member
create_process = asyncio.subprocess.create_subprocess_shell(
create_process = asyncio.create_subprocess_shell(
cmd,
stdin=None,
stdout=asyncio.subprocess.PIPE,
@ -72,8 +71,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
# (which uses shell=False) for security
shlexed_cmd = [prog] + shlex.split(rendered_args)
# pylint: disable=no-member
create_process = asyncio.subprocess.create_subprocess_exec(
create_process = asyncio.create_subprocess_exec(
*shlexed_cmd,
stdin=None,
stdout=asyncio.subprocess.PIPE,

View File

@ -382,14 +382,14 @@ class HomeAssistant:
self.loop.call_soon_threadsafe(self.async_create_task, target)
@callback
def async_create_task(self, target: Awaitable) -> asyncio.tasks.Task:
def async_create_task(self, target: Awaitable) -> asyncio.Task:
"""Create a task from within the eventloop.
This method must be run in the event loop.
target: target to call.
"""
task: asyncio.tasks.Task = self.loop.create_task(target)
task: asyncio.Task = self.loop.create_task(target)
if self._track_task:
self._pending_tasks.append(task)

View File

@ -504,7 +504,7 @@ class _ScriptRun:
task.cancel()
unsub()
async def _async_run_long_action(self, long_task: asyncio.tasks.Task) -> None:
async def _async_run_long_action(self, long_task: asyncio.Task) -> None:
"""Run a long task while monitoring for stop request."""
async def async_cancel_long_task() -> None:

View File

@ -10,7 +10,7 @@ jsonpickle==1.4.1
mock-open==1.4.0
mypy==0.902
pre-commit==2.13.0
pylint==2.9.3
pylint==2.9.5
pipdeptree==1.0.0
pylint-strict-informational==0.1
pytest-aiohttp==0.3.0

View File

@ -61,10 +61,7 @@ async def test_config_not_valid_service_names(hass):
)
@patch(
"homeassistant.components.shell_command.asyncio.subprocess"
".create_subprocess_shell"
)
@patch("homeassistant.components.shell_command.asyncio.create_subprocess_shell")
async def test_template_render_no_template(mock_call, hass):
"""Ensure shell_commands without templates get rendered properly."""
mock_call.return_value = mock_process_creator(error=False)
@ -84,10 +81,7 @@ async def test_template_render_no_template(mock_call, hass):
assert cmd == "ls /bin"
@patch(
"homeassistant.components.shell_command.asyncio.subprocess"
".create_subprocess_exec"
)
@patch("homeassistant.components.shell_command.asyncio.create_subprocess_exec")
async def test_template_render(mock_call, hass):
"""Ensure shell_commands with templates get rendered properly."""
hass.states.async_set("sensor.test_state", "Works")
@ -111,10 +105,7 @@ async def test_template_render(mock_call, hass):
assert ("ls", "/bin", "Works") == cmd
@patch(
"homeassistant.components.shell_command.asyncio.subprocess"
".create_subprocess_shell"
)
@patch("homeassistant.components.shell_command.asyncio.create_subprocess_shell")
@patch("homeassistant.components.shell_command._LOGGER.error")
async def test_subprocess_error(mock_error, mock_call, hass):
"""Test subprocess that returns an error."""