mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Replace pylint protected-access with Ruff SLF001 (#115735)
This commit is contained in:
@@ -1230,12 +1230,11 @@ class HomeAssistant:
|
||||
|
||||
def _cancel_cancellable_timers(self) -> None:
|
||||
"""Cancel timer handles marked as cancellable."""
|
||||
# pylint: disable-next=protected-access
|
||||
handles: Iterable[asyncio.TimerHandle] = self.loop._scheduled # type: ignore[attr-defined]
|
||||
handles: Iterable[asyncio.TimerHandle] = self.loop._scheduled # type: ignore[attr-defined] # noqa: SLF001
|
||||
for handle in handles:
|
||||
if (
|
||||
not handle.cancelled()
|
||||
and (args := handle._args) # pylint: disable=protected-access
|
||||
and (args := handle._args) # noqa: SLF001
|
||||
and type(job := args[0]) is HassJob
|
||||
and job.cancel_on_shutdown
|
||||
):
|
||||
@@ -1347,7 +1346,7 @@ class Event(Generic[_DataT]):
|
||||
# _as_dict is marked as protected
|
||||
# to avoid callers outside of this module
|
||||
# from misusing it by mistake.
|
||||
"context": self.context._as_dict, # pylint: disable=protected-access
|
||||
"context": self.context._as_dict, # noqa: SLF001
|
||||
}
|
||||
|
||||
def as_dict(self) -> ReadOnlyDict[str, Any]:
|
||||
@@ -1842,7 +1841,7 @@ class State:
|
||||
# _as_dict is marked as protected
|
||||
# to avoid callers outside of this module
|
||||
# from misusing it by mistake.
|
||||
"context": self.context._as_dict, # pylint: disable=protected-access
|
||||
"context": self.context._as_dict, # noqa: SLF001
|
||||
}
|
||||
|
||||
def as_dict(
|
||||
@@ -1897,7 +1896,7 @@ class State:
|
||||
# _as_dict is marked as protected
|
||||
# to avoid callers outside of this module
|
||||
# from misusing it by mistake.
|
||||
context = state_context._as_dict # pylint: disable=protected-access
|
||||
context = state_context._as_dict # noqa: SLF001
|
||||
compressed_state: CompressedState = {
|
||||
COMPRESSED_STATE_STATE: self.state,
|
||||
COMPRESSED_STATE_ATTRIBUTES: self.attributes,
|
||||
@@ -3078,7 +3077,7 @@ class Config:
|
||||
"elevation": self.elevation,
|
||||
# We don't want any integrations to use the name of the unit system
|
||||
# so we are using the private attribute here
|
||||
"unit_system_v2": self.units._name, # pylint: disable=protected-access
|
||||
"unit_system_v2": self.units._name, # noqa: SLF001
|
||||
"location_name": self.location_name,
|
||||
"time_zone": self.time_zone,
|
||||
"external_url": self.external_url,
|
||||
|
||||
Reference in New Issue
Block a user