mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Remove previously deprecated StrEnum backport (#146477)
This commit is contained in:
parent
4a8faad62e
commit
4836930cb1
@ -1,29 +0,0 @@
|
||||
"""Enum backports from standard lib.
|
||||
|
||||
This file contained the backport of the StrEnum of Python 3.11.
|
||||
|
||||
Since we have dropped support for Python 3.10, we can remove this backport.
|
||||
This file is kept for now to avoid breaking custom components that might
|
||||
import it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import StrEnum as _StrEnum
|
||||
from functools import partial
|
||||
|
||||
from homeassistant.helpers.deprecation import (
|
||||
DeprecatedAlias,
|
||||
all_with_deprecated_constants,
|
||||
check_if_deprecated_constant,
|
||||
dir_with_deprecated_constants,
|
||||
)
|
||||
|
||||
# StrEnum deprecated as of 2024.5 use enum.StrEnum instead.
|
||||
_DEPRECATED_StrEnum = DeprecatedAlias(_StrEnum, "enum.StrEnum", "2025.5")
|
||||
|
||||
__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
|
||||
__dir__ = partial(
|
||||
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
|
||||
)
|
||||
__all__ = all_with_deprecated_constants(globals())
|
@ -25,12 +25,6 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
|
||||
constant=re.compile(r"^cached_property$"),
|
||||
),
|
||||
],
|
||||
"homeassistant.backports.enum": [
|
||||
ObsoleteImportMatch(
|
||||
reason="We can now use the Python 3.11 provided enum.StrEnum instead",
|
||||
constant=re.compile(r"^StrEnum$"),
|
||||
),
|
||||
],
|
||||
"homeassistant.backports.functools": [
|
||||
ObsoleteImportMatch(
|
||||
reason="replaced by propcache.api.cached_property",
|
||||
|
@ -2,17 +2,13 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import StrEnum
|
||||
from functools import cached_property # pylint: disable=hass-deprecated-import
|
||||
from types import ModuleType
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.backports import (
|
||||
enum as backports_enum,
|
||||
functools as backports_functools,
|
||||
)
|
||||
from homeassistant.backports import functools as backports_functools
|
||||
|
||||
from .common import import_and_test_deprecated_alias
|
||||
|
||||
@ -20,7 +16,6 @@ from .common import import_and_test_deprecated_alias
|
||||
@pytest.mark.parametrize(
|
||||
("module", "replacement", "breaks_in_ha_version"),
|
||||
[
|
||||
(backports_enum, StrEnum, "2025.5"),
|
||||
(backports_functools, cached_property, "2025.5"),
|
||||
],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user