Update Python version used for pylint (#63895)

This commit is contained in:
Marc Mueller 2022-01-11 13:41:57 +01:00 committed by GitHub
parent 277c12cf64
commit f3bc9fc740
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 25 additions and 30 deletions

View file

@ -139,7 +139,7 @@ class AzureEventHub:
self._max_delay = self._entry.options.get(CONF_MAX_DELAY, DEFAULT_MAX_DELAY)
self._shutdown = False
self._queue: asyncio.PriorityQueue[ # pylint: disable=unsubscriptable-object
self._queue: asyncio.PriorityQueue[
tuple[int, tuple[datetime, State | None]]
] = asyncio.PriorityQueue()
self._listener_remover: Callable[[], None] | None = None

View file

@ -154,7 +154,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
_LOGGER.error("API disabled, API must be enabled in the app")
raise AbortFlow("api_not_enabled") from ex
except Exception as ex: # pylint: disable=broad-except
except Exception as ex:
_LOGGER.error(
"Error connecting with Energy Device at %s",
ip_address,

View file

@ -50,7 +50,7 @@ class HWEnergyDeviceUpdateCoordinator(
"API disabled, API must be enabled in the app"
) from ex
except Exception as ex: # pylint: disable=broad-except
except Exception as ex:
raise UpdateFailed(
f"Error connecting with Energy Device at {self.api.host}"
) from ex
@ -82,7 +82,7 @@ class HWEnergyDeviceUpdateCoordinator(
except aiohwenergy.AiohwenergyException as ex:
raise UpdateFailed("Unknown Energy API error occurred") from ex
except Exception as ex: # pylint: disable=broad-except
except Exception as ex:
raise UpdateFailed(
f"Unknown error connecting with Energy Device at {self.api.host}"
) from ex

View file

@ -1,5 +1,4 @@
"""Support for Lupusec Home Security system."""
# pylint: disable=import-error
import logging
import lupupy

View file

@ -1,7 +1,6 @@
"""Support for Lupusec Security System binary sensors."""
from __future__ import annotations
# pylint: disable=import-error
from datetime import timedelta
import lupupy.constants as CONST

View file

@ -1,7 +1,6 @@
"""Support for Lupusec Security System switches."""
from __future__ import annotations
# pylint: disable=import-error
from datetime import timedelta
import lupupy.constants as CONST

View file

@ -240,7 +240,6 @@ class HomeAssistant:
def __init__(self) -> None:
"""Initialize new Home Assistant object."""
self.loop = asyncio.get_running_loop()
# pylint: disable-next=unsubscriptable-object
self._pending_tasks: list[asyncio.Future[Any]] = []
self._track_task = True
self.bus = EventBus(self)
@ -363,21 +362,21 @@ class HomeAssistant:
@callback
def async_add_job(
self, target: Callable[..., Awaitable[_R]], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@overload
@callback
def async_add_job(
self, target: Callable[..., Awaitable[_R] | _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@overload
@callback
def async_add_job(
self, target: Coroutine[Any, Any, _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@callback
@ -385,7 +384,7 @@ class HomeAssistant:
self,
target: Callable[..., Awaitable[_R] | _R] | Coroutine[Any, Any, _R],
*args: Any,
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
"""Add a job to be executed by the event loop or by an executor.
If the job is either a coroutine or decorated with @callback, it will be
@ -409,27 +408,27 @@ class HomeAssistant:
@callback
def async_add_hass_job(
self, hassjob: HassJob[Awaitable[_R]], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@overload
@callback
def async_add_hass_job(
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@callback
def async_add_hass_job(
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
"""Add a HassJob from within the event loop.
This method must be run in the event loop.
hassjob: HassJob to call.
args: parameters for method to call.
"""
task: asyncio.Future[_R] # pylint: disable=unsubscriptable-object
task: asyncio.Future[_R]
if hassjob.job_type == HassJobType.Coroutinefunction:
task = self.loop.create_task(
cast(Callable[..., Awaitable[_R]], hassjob.target)(*args)
@ -473,7 +472,7 @@ class HomeAssistant:
@callback
def async_add_executor_job(
self, target: Callable[..., T], *args: Any
) -> asyncio.Future[T]: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[T]:
"""Add an executor job from within the event loop."""
task = self.loop.run_in_executor(None, target, *args)
@ -497,20 +496,20 @@ class HomeAssistant:
@callback
def async_run_hass_job(
self, hassjob: HassJob[Awaitable[_R]], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@overload
@callback
def async_run_hass_job(
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@callback
def async_run_hass_job(
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
"""Run a HassJob from within the event loop.
This method must be run in the event loop.
@ -528,21 +527,21 @@ class HomeAssistant:
@callback
def async_run_job(
self, target: Callable[..., Awaitable[_R]], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@overload
@callback
def async_run_job(
self, target: Callable[..., Awaitable[_R] | _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@overload
@callback
def async_run_job(
self, target: Coroutine[Any, Any, _R], *args: Any
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
...
@callback
@ -550,7 +549,7 @@ class HomeAssistant:
self,
target: Callable[..., Awaitable[_R] | _R] | Coroutine[Any, Any, _R],
*args: Any,
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
) -> asyncio.Future[_R] | None:
"""Run a job from within the event loop.
This method must be run in the event loop.

View file

@ -41,7 +41,7 @@ def fire_coroutine_threadsafe(coro: Coroutine, loop: AbstractEventLoop) -> None:
def run_callback_threadsafe(
loop: AbstractEventLoop, callback: Callable[..., T], *args: Any
) -> concurrent.futures.Future[T]: # pylint: disable=unsubscriptable-object
) -> concurrent.futures.Future[T]:
"""Submit a callback object to a given event loop.
Return a concurrent.futures.Future to access the result.

View file

@ -8,10 +8,7 @@ from typing import Any
# mypy: disallow-any-generics
def kill_subprocess(
# pylint: disable=unsubscriptable-object # https://github.com/PyCQA/pylint/issues/4369
process: subprocess.Popen[Any],
) -> None:
def kill_subprocess(process: subprocess.Popen[Any]) -> None:
"""Force kill a subprocess and wait for it to exit."""
process.kill()
process.communicate()

View file

@ -17,7 +17,7 @@ forced_separate = [
combine_as_imports = true
[tool.pylint.MASTER]
py-version = "3.8"
py-version = "3.9"
ignore = [
"tests",
]
@ -76,6 +76,7 @@ good-names = [
# Enable once current issues are fixed:
# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension)
# consider-using-assignment-expr (Pylint CodeStyle extension)
# deprecated-typing-alias (temporarily while updating code to Python 3.9)
disable = [
"format",
"abstract-class-little-used",
@ -101,6 +102,7 @@ disable = [
"consider-using-f-string",
"consider-using-namedtuple-or-dataclass",
"consider-using-assignment-expr",
"deprecated-typing-alias",
]
enable = [
#"useless-suppression", # temporarily every now and then to clean them up