mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +00:00
Fix method subtyping [helpers] (#134213)
This commit is contained in:
parent
3df91cfba5
commit
2599faa622
@ -509,25 +509,25 @@ class _ComponentSet(set[str]):
|
|||||||
self._top_level_components = top_level_components
|
self._top_level_components = top_level_components
|
||||||
self._all_components = all_components
|
self._all_components = all_components
|
||||||
|
|
||||||
def add(self, component: str) -> None:
|
def add(self, value: str) -> None:
|
||||||
"""Add a component to the store."""
|
"""Add a component to the store."""
|
||||||
if "." not in component:
|
if "." not in value:
|
||||||
self._top_level_components.add(component)
|
self._top_level_components.add(value)
|
||||||
self._all_components.add(component)
|
self._all_components.add(value)
|
||||||
else:
|
else:
|
||||||
platform, _, domain = component.partition(".")
|
platform, _, domain = value.partition(".")
|
||||||
if domain in BASE_PLATFORMS:
|
if domain in BASE_PLATFORMS:
|
||||||
self._all_components.add(platform)
|
self._all_components.add(platform)
|
||||||
return super().add(component)
|
return super().add(value)
|
||||||
|
|
||||||
def remove(self, component: str) -> None:
|
def remove(self, value: str) -> None:
|
||||||
"""Remove a component from the store."""
|
"""Remove a component from the store."""
|
||||||
if "." in component:
|
if "." in value:
|
||||||
raise ValueError("_ComponentSet does not support removing sub-components")
|
raise ValueError("_ComponentSet does not support removing sub-components")
|
||||||
self._top_level_components.remove(component)
|
self._top_level_components.remove(value)
|
||||||
return super().remove(component)
|
return super().remove(value)
|
||||||
|
|
||||||
def discard(self, component: str) -> None:
|
def discard(self, value: str) -> None:
|
||||||
"""Remove a component from the store."""
|
"""Remove a component from the store."""
|
||||||
raise NotImplementedError("_ComponentSet does not support discard, use remove")
|
raise NotImplementedError("_ComponentSet does not support discard, use remove")
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from collections.abc import Callable, Coroutine
|
from collections.abc import Callable, Coroutine
|
||||||
import sys
|
import sys
|
||||||
|
from types import TracebackType
|
||||||
from typing import Any, Self
|
from typing import Any, Self
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
@ -58,7 +59,12 @@ class HassHttpXAsyncClient(httpx.AsyncClient):
|
|||||||
"""Prevent an integration from reopen of the client via context manager."""
|
"""Prevent an integration from reopen of the client via context manager."""
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def __aexit__(self, *args: object) -> None:
|
async def __aexit__(
|
||||||
|
self,
|
||||||
|
exc_type: type[BaseException] | None = None,
|
||||||
|
exc_value: BaseException | None = None,
|
||||||
|
traceback: TracebackType | None = None,
|
||||||
|
) -> None:
|
||||||
"""Prevent an integration from close of the client via context manager."""
|
"""Prevent an integration from close of the client via context manager."""
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user