Remove unnecessary block use of pylint disable in components p-z (#100192)
This commit is contained in:
parent
5fcb69e004
commit
09ad1a9a36
7 changed files with 14 additions and 16 deletions
|
@ -13,7 +13,7 @@ from typing import Any, Final, Self, cast, final
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
|
||||||
# pylint: disable=[hass-deprecated-import]
|
# pylint: disable-next=hass-deprecated-import
|
||||||
from homeassistant.const import ( # noqa: F401
|
from homeassistant.const import ( # noqa: F401
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
CONF_UNIT_OF_MEASUREMENT,
|
CONF_UNIT_OF_MEASUREMENT,
|
||||||
|
|
|
@ -551,7 +551,7 @@ class ShellyRpcAttributeEntity(ShellyRpcEntity, Entity):
|
||||||
class ShellySleepingBlockAttributeEntity(ShellyBlockAttributeEntity):
|
class ShellySleepingBlockAttributeEntity(ShellyBlockAttributeEntity):
|
||||||
"""Represent a shelly sleeping block attribute entity."""
|
"""Represent a shelly sleeping block attribute entity."""
|
||||||
|
|
||||||
# pylint: disable=super-init-not-called
|
# pylint: disable-next=super-init-not-called
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: ShellyBlockCoordinator,
|
coordinator: ShellyBlockCoordinator,
|
||||||
|
@ -625,7 +625,7 @@ class ShellySleepingRpcAttributeEntity(ShellyRpcAttributeEntity):
|
||||||
|
|
||||||
entity_description: RpcEntityDescription
|
entity_description: RpcEntityDescription
|
||||||
|
|
||||||
# pylint: disable=super-init-not-called
|
# pylint: disable-next=super-init-not-called
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: ShellyRpcCoordinator,
|
coordinator: ShellyRpcCoordinator,
|
||||||
|
|
|
@ -911,7 +911,7 @@ class _ScriptRun:
|
||||||
|
|
||||||
async def _async_choose_step(self) -> None:
|
async def _async_choose_step(self) -> None:
|
||||||
"""Choose a sequence."""
|
"""Choose a sequence."""
|
||||||
# pylint: disable=protected-access
|
# pylint: disable-next=protected-access
|
||||||
choose_data = await self._script._async_get_choose_data(self._step)
|
choose_data = await self._script._async_get_choose_data(self._step)
|
||||||
|
|
||||||
with trace_path("choose"):
|
with trace_path("choose"):
|
||||||
|
@ -933,7 +933,7 @@ class _ScriptRun:
|
||||||
|
|
||||||
async def _async_if_step(self) -> None:
|
async def _async_if_step(self) -> None:
|
||||||
"""If sequence."""
|
"""If sequence."""
|
||||||
# pylint: disable=protected-access
|
# pylint: disable-next=protected-access
|
||||||
if_data = await self._script._async_get_if_data(self._step)
|
if_data = await self._script._async_get_if_data(self._step)
|
||||||
|
|
||||||
test_conditions = False
|
test_conditions = False
|
||||||
|
@ -1047,7 +1047,7 @@ class _ScriptRun:
|
||||||
@async_trace_path("parallel")
|
@async_trace_path("parallel")
|
||||||
async def _async_parallel_step(self) -> None:
|
async def _async_parallel_step(self) -> None:
|
||||||
"""Run a sequence in parallel."""
|
"""Run a sequence in parallel."""
|
||||||
# pylint: disable=protected-access
|
# pylint: disable-next=protected-access
|
||||||
scripts = await self._script._async_get_parallel_scripts(self._step)
|
scripts = await self._script._async_get_parallel_scripts(self._step)
|
||||||
|
|
||||||
async def async_run_with_trace(idx: int, script: Script) -> None:
|
async def async_run_with_trace(idx: int, script: Script) -> None:
|
||||||
|
@ -1107,9 +1107,8 @@ class _QueuedScriptRun(_ScriptRun):
|
||||||
await super().async_run()
|
await super().async_run()
|
||||||
|
|
||||||
def _finish(self) -> None:
|
def _finish(self) -> None:
|
||||||
# pylint: disable=protected-access
|
|
||||||
if self.lock_acquired:
|
if self.lock_acquired:
|
||||||
self._script._queue_lck.release()
|
self._script._queue_lck.release() # pylint: disable=protected-access
|
||||||
self.lock_acquired = False
|
self.lock_acquired = False
|
||||||
super()._finish()
|
super()._finish()
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ ALL_SERVICE_DESCRIPTIONS_CACHE = "all_service_descriptions_cache"
|
||||||
@cache
|
@cache
|
||||||
def _base_components() -> dict[str, ModuleType]:
|
def _base_components() -> dict[str, ModuleType]:
|
||||||
"""Return a cached lookup of base components."""
|
"""Return a cached lookup of base components."""
|
||||||
# pylint: disable=import-outside-toplevel
|
# pylint: disable-next=import-outside-toplevel
|
||||||
from homeassistant.components import (
|
from homeassistant.components import (
|
||||||
alarm_control_panel,
|
alarm_control_panel,
|
||||||
calendar,
|
calendar,
|
||||||
|
|
|
@ -937,7 +937,7 @@ class TemplateStateBase(State):
|
||||||
__delitem__ = _readonly
|
__delitem__ = _readonly
|
||||||
|
|
||||||
# Inheritance is done so functions that check against State keep working
|
# Inheritance is done so functions that check against State keep working
|
||||||
# pylint: disable=super-init-not-called
|
# pylint: disable-next=super-init-not-called
|
||||||
def __init__(self, hass: HomeAssistant, collect: bool, entity_id: str) -> None:
|
def __init__(self, hass: HomeAssistant, collect: bool, entity_id: str) -> None:
|
||||||
"""Initialize template state."""
|
"""Initialize template state."""
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
|
|
|
@ -163,8 +163,7 @@ async def setup_and_run_hass(runtime_config: RuntimeConfig) -> int:
|
||||||
|
|
||||||
def _enable_posix_spawn() -> None:
|
def _enable_posix_spawn() -> None:
|
||||||
"""Enable posix_spawn on Alpine Linux."""
|
"""Enable posix_spawn on Alpine Linux."""
|
||||||
# pylint: disable=protected-access
|
if subprocess._USE_POSIX_SPAWN: # pylint: disable=protected-access
|
||||||
if subprocess._USE_POSIX_SPAWN:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# The subprocess module does not know about Alpine Linux/musl
|
# The subprocess module does not know about Alpine Linux/musl
|
||||||
|
@ -172,6 +171,7 @@ def _enable_posix_spawn() -> None:
|
||||||
# less efficient. This is a workaround to force posix_spawn()
|
# less efficient. This is a workaround to force posix_spawn()
|
||||||
# when using musl since cpython is not aware its supported.
|
# when using musl since cpython is not aware its supported.
|
||||||
tag = next(packaging.tags.sys_tags())
|
tag = next(packaging.tags.sys_tags())
|
||||||
|
# pylint: disable-next=protected-access
|
||||||
subprocess._USE_POSIX_SPAWN = "musllinux" in tag.platform
|
subprocess._USE_POSIX_SPAWN = "musllinux" in tag.platform
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ import homeassistant.util.yaml.loader as yaml_loader
|
||||||
REQUIREMENTS = ("colorlog==6.7.0",)
|
REQUIREMENTS = ("colorlog==6.7.0",)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
# pylint: disable=protected-access
|
|
||||||
MOCKS: dict[str, tuple[str, Callable]] = {
|
MOCKS: dict[str, tuple[str, Callable]] = {
|
||||||
"load": ("homeassistant.util.yaml.loader.load_yaml", yaml_loader.load_yaml),
|
"load": ("homeassistant.util.yaml.loader.load_yaml", yaml_loader.load_yaml),
|
||||||
"load*": ("homeassistant.config.load_yaml", yaml_loader.load_yaml),
|
"load*": ("homeassistant.config.load_yaml", yaml_loader.load_yaml),
|
||||||
|
@ -166,13 +165,13 @@ def check(config_dir, secrets=False):
|
||||||
"secret_cache": {},
|
"secret_cache": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
# pylint: disable=possibly-unused-variable
|
# pylint: disable-next=possibly-unused-variable
|
||||||
def mock_load(filename, secrets=None):
|
def mock_load(filename, secrets=None):
|
||||||
"""Mock hass.util.load_yaml to save config file names."""
|
"""Mock hass.util.load_yaml to save config file names."""
|
||||||
res["yaml_files"][filename] = True
|
res["yaml_files"][filename] = True
|
||||||
return MOCKS["load"][1](filename, secrets)
|
return MOCKS["load"][1](filename, secrets)
|
||||||
|
|
||||||
# pylint: disable=possibly-unused-variable
|
# pylint: disable-next=possibly-unused-variable
|
||||||
def mock_secrets(ldr, node):
|
def mock_secrets(ldr, node):
|
||||||
"""Mock _get_secrets."""
|
"""Mock _get_secrets."""
|
||||||
try:
|
try:
|
||||||
|
@ -201,7 +200,7 @@ def check(config_dir, secrets=False):
|
||||||
|
|
||||||
def secrets_proxy(*args):
|
def secrets_proxy(*args):
|
||||||
secrets = Secrets(*args)
|
secrets = Secrets(*args)
|
||||||
res["secret_cache"] = secrets._cache
|
res["secret_cache"] = secrets._cache # pylint: disable=protected-access
|
||||||
return secrets
|
return secrets
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue