diff --git a/homeassistant/runner.py b/homeassistant/runner.py index 4bac12ec399a50..102dbafe147f9b 100644 --- a/homeassistant/runner.py +++ b/homeassistant/runner.py @@ -175,7 +175,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()) - subprocess._USE_POSIX_SPAWN = "musllinux" in tag.platform # noqa: SLF001 + subprocess._USE_POSIX_SPAWN = "musllinux" in tag.platform # type: ignore[misc] # noqa: SLF001 def run(runtime_config: RuntimeConfig) -> int: diff --git a/homeassistant/util/frozen_dataclass_compat.py b/homeassistant/util/frozen_dataclass_compat.py index 6184e4564ebcd8..81ce9961a0baba 100644 --- a/homeassistant/util/frozen_dataclass_compat.py +++ b/homeassistant/util/frozen_dataclass_compat.py @@ -8,7 +8,10 @@ import dataclasses import sys -from typing import Any, dataclass_transform +from typing import TYPE_CHECKING, Any, cast, dataclass_transform + +if TYPE_CHECKING: + from _typeshed import DataclassInstance def _class_fields(cls: type, kw_only: bool) -> list[tuple[str, Any, Any]]: @@ -111,6 +114,8 @@ def __new__(*args: Any, **kwargs: Any) -> object: """ cls, *_args = args if dataclasses.is_dataclass(cls): + if TYPE_CHECKING: + cls = cast(type[DataclassInstance], cls) return object.__new__(cls) return cls._dataclass(*_args, **kwargs) diff --git a/requirements_test.txt b/requirements_test.txt index 19a60b6aa28942..87203daae96fc8 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -11,7 +11,7 @@ astroid==3.2.4 coverage==7.6.0 freezegun==1.5.1 mock-open==1.4.0 -mypy-dev==1.12.0a2 +mypy-dev==1.12.0a3 pre-commit==3.7.1 pydantic==1.10.17 pylint==3.2.6