mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Update Python version used for pylint (#63895)
This commit is contained in:
parent
277c12cf64
commit
f3bc9fc740
@ -139,7 +139,7 @@ class AzureEventHub:
|
|||||||
self._max_delay = self._entry.options.get(CONF_MAX_DELAY, DEFAULT_MAX_DELAY)
|
self._max_delay = self._entry.options.get(CONF_MAX_DELAY, DEFAULT_MAX_DELAY)
|
||||||
|
|
||||||
self._shutdown = False
|
self._shutdown = False
|
||||||
self._queue: asyncio.PriorityQueue[ # pylint: disable=unsubscriptable-object
|
self._queue: asyncio.PriorityQueue[
|
||||||
tuple[int, tuple[datetime, State | None]]
|
tuple[int, tuple[datetime, State | None]]
|
||||||
] = asyncio.PriorityQueue()
|
] = asyncio.PriorityQueue()
|
||||||
self._listener_remover: Callable[[], None] | None = None
|
self._listener_remover: Callable[[], None] | None = None
|
||||||
|
@ -154,7 +154,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
_LOGGER.error("API disabled, API must be enabled in the app")
|
_LOGGER.error("API disabled, API must be enabled in the app")
|
||||||
raise AbortFlow("api_not_enabled") from ex
|
raise AbortFlow("api_not_enabled") from ex
|
||||||
|
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Error connecting with Energy Device at %s",
|
"Error connecting with Energy Device at %s",
|
||||||
ip_address,
|
ip_address,
|
||||||
|
@ -50,7 +50,7 @@ class HWEnergyDeviceUpdateCoordinator(
|
|||||||
"API disabled, API must be enabled in the app"
|
"API disabled, API must be enabled in the app"
|
||||||
) from ex
|
) from ex
|
||||||
|
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex:
|
||||||
raise UpdateFailed(
|
raise UpdateFailed(
|
||||||
f"Error connecting with Energy Device at {self.api.host}"
|
f"Error connecting with Energy Device at {self.api.host}"
|
||||||
) from ex
|
) from ex
|
||||||
@ -82,7 +82,7 @@ class HWEnergyDeviceUpdateCoordinator(
|
|||||||
except aiohwenergy.AiohwenergyException as ex:
|
except aiohwenergy.AiohwenergyException as ex:
|
||||||
raise UpdateFailed("Unknown Energy API error occurred") from ex
|
raise UpdateFailed("Unknown Energy API error occurred") from ex
|
||||||
|
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex:
|
||||||
raise UpdateFailed(
|
raise UpdateFailed(
|
||||||
f"Unknown error connecting with Energy Device at {self.api.host}"
|
f"Unknown error connecting with Energy Device at {self.api.host}"
|
||||||
) from ex
|
) from ex
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Support for Lupusec Home Security system."""
|
"""Support for Lupusec Home Security system."""
|
||||||
# pylint: disable=import-error
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import lupupy
|
import lupupy
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for Lupusec Security System binary sensors."""
|
"""Support for Lupusec Security System binary sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# pylint: disable=import-error
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import lupupy.constants as CONST
|
import lupupy.constants as CONST
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for Lupusec Security System switches."""
|
"""Support for Lupusec Security System switches."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
# pylint: disable=import-error
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
import lupupy.constants as CONST
|
import lupupy.constants as CONST
|
||||||
|
@ -240,7 +240,6 @@ class HomeAssistant:
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize new Home Assistant object."""
|
"""Initialize new Home Assistant object."""
|
||||||
self.loop = asyncio.get_running_loop()
|
self.loop = asyncio.get_running_loop()
|
||||||
# pylint: disable-next=unsubscriptable-object
|
|
||||||
self._pending_tasks: list[asyncio.Future[Any]] = []
|
self._pending_tasks: list[asyncio.Future[Any]] = []
|
||||||
self._track_task = True
|
self._track_task = True
|
||||||
self.bus = EventBus(self)
|
self.bus = EventBus(self)
|
||||||
@ -363,21 +362,21 @@ class HomeAssistant:
|
|||||||
@callback
|
@callback
|
||||||
def async_add_job(
|
def async_add_job(
|
||||||
self, target: Callable[..., Awaitable[_R]], *args: Any
|
self, target: Callable[..., Awaitable[_R]], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@callback
|
@callback
|
||||||
def async_add_job(
|
def async_add_job(
|
||||||
self, target: Callable[..., Awaitable[_R] | _R], *args: Any
|
self, target: Callable[..., Awaitable[_R] | _R], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@callback
|
@callback
|
||||||
def async_add_job(
|
def async_add_job(
|
||||||
self, target: Coroutine[Any, Any, _R], *args: Any
|
self, target: Coroutine[Any, Any, _R], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
@ -385,7 +384,7 @@ class HomeAssistant:
|
|||||||
self,
|
self,
|
||||||
target: Callable[..., Awaitable[_R] | _R] | Coroutine[Any, Any, _R],
|
target: Callable[..., Awaitable[_R] | _R] | Coroutine[Any, Any, _R],
|
||||||
*args: Any,
|
*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.
|
"""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
|
If the job is either a coroutine or decorated with @callback, it will be
|
||||||
@ -409,27 +408,27 @@ class HomeAssistant:
|
|||||||
@callback
|
@callback
|
||||||
def async_add_hass_job(
|
def async_add_hass_job(
|
||||||
self, hassjob: HassJob[Awaitable[_R]], *args: Any
|
self, hassjob: HassJob[Awaitable[_R]], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@callback
|
@callback
|
||||||
def async_add_hass_job(
|
def async_add_hass_job(
|
||||||
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
|
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_hass_job(
|
def async_add_hass_job(
|
||||||
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
|
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.
|
"""Add a HassJob from within the event loop.
|
||||||
|
|
||||||
This method must be run in the event loop.
|
This method must be run in the event loop.
|
||||||
hassjob: HassJob to call.
|
hassjob: HassJob to call.
|
||||||
args: parameters for method 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:
|
if hassjob.job_type == HassJobType.Coroutinefunction:
|
||||||
task = self.loop.create_task(
|
task = self.loop.create_task(
|
||||||
cast(Callable[..., Awaitable[_R]], hassjob.target)(*args)
|
cast(Callable[..., Awaitable[_R]], hassjob.target)(*args)
|
||||||
@ -473,7 +472,7 @@ class HomeAssistant:
|
|||||||
@callback
|
@callback
|
||||||
def async_add_executor_job(
|
def async_add_executor_job(
|
||||||
self, target: Callable[..., T], *args: Any
|
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."""
|
"""Add an executor job from within the event loop."""
|
||||||
task = self.loop.run_in_executor(None, target, *args)
|
task = self.loop.run_in_executor(None, target, *args)
|
||||||
|
|
||||||
@ -497,20 +496,20 @@ class HomeAssistant:
|
|||||||
@callback
|
@callback
|
||||||
def async_run_hass_job(
|
def async_run_hass_job(
|
||||||
self, hassjob: HassJob[Awaitable[_R]], *args: Any
|
self, hassjob: HassJob[Awaitable[_R]], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@callback
|
@callback
|
||||||
def async_run_hass_job(
|
def async_run_hass_job(
|
||||||
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
|
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_run_hass_job(
|
def async_run_hass_job(
|
||||||
self, hassjob: HassJob[Awaitable[_R] | _R], *args: Any
|
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.
|
"""Run a HassJob from within the event loop.
|
||||||
|
|
||||||
This method must be run in the event loop.
|
This method must be run in the event loop.
|
||||||
@ -528,21 +527,21 @@ class HomeAssistant:
|
|||||||
@callback
|
@callback
|
||||||
def async_run_job(
|
def async_run_job(
|
||||||
self, target: Callable[..., Awaitable[_R]], *args: Any
|
self, target: Callable[..., Awaitable[_R]], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@callback
|
@callback
|
||||||
def async_run_job(
|
def async_run_job(
|
||||||
self, target: Callable[..., Awaitable[_R] | _R], *args: Any
|
self, target: Callable[..., Awaitable[_R] | _R], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
@callback
|
@callback
|
||||||
def async_run_job(
|
def async_run_job(
|
||||||
self, target: Coroutine[Any, Any, _R], *args: Any
|
self, target: Coroutine[Any, Any, _R], *args: Any
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
...
|
...
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
@ -550,7 +549,7 @@ class HomeAssistant:
|
|||||||
self,
|
self,
|
||||||
target: Callable[..., Awaitable[_R] | _R] | Coroutine[Any, Any, _R],
|
target: Callable[..., Awaitable[_R] | _R] | Coroutine[Any, Any, _R],
|
||||||
*args: Any,
|
*args: Any,
|
||||||
) -> asyncio.Future[_R] | None: # pylint: disable=unsubscriptable-object
|
) -> asyncio.Future[_R] | None:
|
||||||
"""Run a job from within the event loop.
|
"""Run a job from within the event loop.
|
||||||
|
|
||||||
This method must be run in the event loop.
|
This method must be run in the event loop.
|
||||||
|
@ -41,7 +41,7 @@ def fire_coroutine_threadsafe(coro: Coroutine, loop: AbstractEventLoop) -> None:
|
|||||||
|
|
||||||
def run_callback_threadsafe(
|
def run_callback_threadsafe(
|
||||||
loop: AbstractEventLoop, callback: Callable[..., T], *args: Any
|
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.
|
"""Submit a callback object to a given event loop.
|
||||||
|
|
||||||
Return a concurrent.futures.Future to access the result.
|
Return a concurrent.futures.Future to access the result.
|
||||||
|
@ -8,10 +8,7 @@ from typing import Any
|
|||||||
# mypy: disallow-any-generics
|
# mypy: disallow-any-generics
|
||||||
|
|
||||||
|
|
||||||
def kill_subprocess(
|
def kill_subprocess(process: subprocess.Popen[Any]) -> None:
|
||||||
# pylint: disable=unsubscriptable-object # https://github.com/PyCQA/pylint/issues/4369
|
|
||||||
process: subprocess.Popen[Any],
|
|
||||||
) -> None:
|
|
||||||
"""Force kill a subprocess and wait for it to exit."""
|
"""Force kill a subprocess and wait for it to exit."""
|
||||||
process.kill()
|
process.kill()
|
||||||
process.communicate()
|
process.communicate()
|
||||||
|
@ -17,7 +17,7 @@ forced_separate = [
|
|||||||
combine_as_imports = true
|
combine_as_imports = true
|
||||||
|
|
||||||
[tool.pylint.MASTER]
|
[tool.pylint.MASTER]
|
||||||
py-version = "3.8"
|
py-version = "3.9"
|
||||||
ignore = [
|
ignore = [
|
||||||
"tests",
|
"tests",
|
||||||
]
|
]
|
||||||
@ -76,6 +76,7 @@ good-names = [
|
|||||||
# Enable once current issues are fixed:
|
# Enable once current issues are fixed:
|
||||||
# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension)
|
# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension)
|
||||||
# consider-using-assignment-expr (Pylint CodeStyle extension)
|
# consider-using-assignment-expr (Pylint CodeStyle extension)
|
||||||
|
# deprecated-typing-alias (temporarily while updating code to Python 3.9)
|
||||||
disable = [
|
disable = [
|
||||||
"format",
|
"format",
|
||||||
"abstract-class-little-used",
|
"abstract-class-little-used",
|
||||||
@ -101,6 +102,7 @@ disable = [
|
|||||||
"consider-using-f-string",
|
"consider-using-f-string",
|
||||||
"consider-using-namedtuple-or-dataclass",
|
"consider-using-namedtuple-or-dataclass",
|
||||||
"consider-using-assignment-expr",
|
"consider-using-assignment-expr",
|
||||||
|
"deprecated-typing-alias",
|
||||||
]
|
]
|
||||||
enable = [
|
enable = [
|
||||||
#"useless-suppression", # temporarily every now and then to clean them up
|
#"useless-suppression", # temporarily every now and then to clean them up
|
||||||
|
Loading…
x
Reference in New Issue
Block a user