Remove unnecessary block use of pylint disable in components p-z (#100192)

This commit is contained in:
Erik Montnemery 2023-09-12 20:47:48 +02:00 committed by GitHub
parent 5fcb69e004
commit 09ad1a9a36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 16 deletions

View file

@ -13,7 +13,7 @@ from typing import Any, Final, Self, cast, final
from homeassistant.config_entries import ConfigEntry
# pylint: disable=[hass-deprecated-import]
# pylint: disable-next=hass-deprecated-import
from homeassistant.const import ( # noqa: F401
ATTR_UNIT_OF_MEASUREMENT,
CONF_UNIT_OF_MEASUREMENT,

View file

@ -551,7 +551,7 @@ class ShellyRpcAttributeEntity(ShellyRpcEntity, Entity):
class ShellySleepingBlockAttributeEntity(ShellyBlockAttributeEntity):
"""Represent a shelly sleeping block attribute entity."""
# pylint: disable=super-init-not-called
# pylint: disable-next=super-init-not-called
def __init__(
self,
coordinator: ShellyBlockCoordinator,
@ -625,7 +625,7 @@ class ShellySleepingRpcAttributeEntity(ShellyRpcAttributeEntity):
entity_description: RpcEntityDescription
# pylint: disable=super-init-not-called
# pylint: disable-next=super-init-not-called
def __init__(
self,
coordinator: ShellyRpcCoordinator,

View file

@ -911,7 +911,7 @@ class _ScriptRun:
async def _async_choose_step(self) -> None:
"""Choose a sequence."""
# pylint: disable=protected-access
# pylint: disable-next=protected-access
choose_data = await self._script._async_get_choose_data(self._step)
with trace_path("choose"):
@ -933,7 +933,7 @@ class _ScriptRun:
async def _async_if_step(self) -> None:
"""If sequence."""
# pylint: disable=protected-access
# pylint: disable-next=protected-access
if_data = await self._script._async_get_if_data(self._step)
test_conditions = False
@ -1047,7 +1047,7 @@ class _ScriptRun:
@async_trace_path("parallel")
async def _async_parallel_step(self) -> None:
"""Run a sequence in parallel."""
# pylint: disable=protected-access
# pylint: disable-next=protected-access
scripts = await self._script._async_get_parallel_scripts(self._step)
async def async_run_with_trace(idx: int, script: Script) -> None:
@ -1107,9 +1107,8 @@ class _QueuedScriptRun(_ScriptRun):
await super().async_run()
def _finish(self) -> None:
# pylint: disable=protected-access
if self.lock_acquired:
self._script._queue_lck.release()
self._script._queue_lck.release() # pylint: disable=protected-access
self.lock_acquired = False
super()._finish()

View file

@ -73,7 +73,7 @@ ALL_SERVICE_DESCRIPTIONS_CACHE = "all_service_descriptions_cache"
@cache
def _base_components() -> dict[str, ModuleType]:
"""Return a cached lookup of base components."""
# pylint: disable=import-outside-toplevel
# pylint: disable-next=import-outside-toplevel
from homeassistant.components import (
alarm_control_panel,
calendar,

View file

@ -937,7 +937,7 @@ class TemplateStateBase(State):
__delitem__ = _readonly
# 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:
"""Initialize template state."""
self._hass = hass

View file

@ -163,8 +163,7 @@ async def setup_and_run_hass(runtime_config: RuntimeConfig) -> int:
def _enable_posix_spawn() -> None:
"""Enable posix_spawn on Alpine Linux."""
# pylint: disable=protected-access
if subprocess._USE_POSIX_SPAWN:
if subprocess._USE_POSIX_SPAWN: # pylint: disable=protected-access
return
# 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()
# when using musl since cpython is not aware its supported.
tag = next(packaging.tags.sys_tags())
# pylint: disable-next=protected-access
subprocess._USE_POSIX_SPAWN = "musllinux" in tag.platform

View file

@ -30,7 +30,6 @@ import homeassistant.util.yaml.loader as yaml_loader
REQUIREMENTS = ("colorlog==6.7.0",)
_LOGGER = logging.getLogger(__name__)
# pylint: disable=protected-access
MOCKS: dict[str, tuple[str, Callable]] = {
"load": ("homeassistant.util.yaml.loader.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": {},
}
# pylint: disable=possibly-unused-variable
# pylint: disable-next=possibly-unused-variable
def mock_load(filename, secrets=None):
"""Mock hass.util.load_yaml to save config file names."""
res["yaml_files"][filename] = True
return MOCKS["load"][1](filename, secrets)
# pylint: disable=possibly-unused-variable
# pylint: disable-next=possibly-unused-variable
def mock_secrets(ldr, node):
"""Mock _get_secrets."""
try:
@ -201,7 +200,7 @@ def check(config_dir, secrets=False):
def secrets_proxy(*args):
secrets = Secrets(*args)
res["secret_cache"] = secrets._cache
res["secret_cache"] = secrets._cache # pylint: disable=protected-access
return secrets
try: