Skip to content

Commit

Permalink
Add Todo for get_type_hints fix in Python 3.12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Nov 7, 2024
1 parent 9ab70c6 commit 5bae4b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/helpers/config_validation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Helpers for config validation using voluptuous."""

# PEP 563 seems to break typing.get_type_hints when used
# with PEP 695 syntax. Fixed in Python 3.13.
# with PEP 695 syntax. Fixed in Python 3.12.4.
# https://github.com/python/cpython/issues/114053
# from __future__ import annotations

from collections.abc import Callable, Hashable, Mapping
Expand Down Expand Up @@ -354,7 +355,7 @@ def ensure_list[_T](value: _T | None) -> list[_T] | list[Any]:
"""Wrap value in list if it is not one."""
if value is None:
return []
return cast("list[_T]", value) if isinstance(value, list) else [value]
return cast(list[_T], value) if isinstance(value, list) else [value]
def entity_id(value: Any) -> str:
Expand Down

0 comments on commit 5bae4b4

Please sign in to comment.