Skip to content
Snippets Groups Projects
Unverified Commit 2599faa6 authored by Marc Mueller's avatar Marc Mueller Committed by GitHub
Browse files

Fix method subtyping [helpers] (#134213)

parent 3df91cfb
No related branches found
No related tags found
No related merge requests found
...@@ -509,25 +509,25 @@ class _ComponentSet(set[str]): ...@@ -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 ...@@ -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): ...@@ -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."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment