1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Cleanup deprecated alias in core (#158799)

This commit is contained in:
epenet
2025-12-13 09:29:15 +01:00
committed by GitHub
parent 90e4340595
commit 1e09bddb1d
2 changed files with 3 additions and 43 deletions

View File

@@ -84,12 +84,6 @@ from .exceptions import (
ServiceValidationError,
Unauthorized,
)
from .helpers.deprecation import (
DeferredDeprecatedAlias,
all_with_deprecated_constants,
check_if_deprecated_constant,
dir_with_deprecated_constants,
)
from .helpers.json import json_bytes, json_fragment
from .helpers.typing import VolSchemaType
from .util import dt as dt_util
@@ -161,18 +155,6 @@ class EventStateReportedData(EventStateEventData):
old_last_reported: datetime.datetime
def _deprecated_core_config() -> Any:
from . import core_config # noqa: PLC0415
return core_config.Config
# The Config class was moved to core_config in Home Assistant 2024.11
_DEPRECATED_Config = DeferredDeprecatedAlias(
_deprecated_core_config, "homeassistant.core_config.Config", "2025.11"
)
# How long to wait until things that run on startup have to finish.
TIMEOUT_EVENT_START = 15
@@ -280,6 +262,8 @@ def async_get_hass_or_none() -> HomeAssistant | None:
class ReleaseChannel(enum.StrEnum):
"""Release channel."""
BETA = "beta"
DEV = "dev"
NIGHTLY = "nightly"
@@ -2883,11 +2867,3 @@ class ServiceRegistry:
if TYPE_CHECKING:
target = cast(Callable[..., ServiceResponse], target)
return await self._hass.async_add_executor_job(target, service_call)
# These can be removed if no deprecated constant are in this module anymore
__getattr__ = functools.partial(check_if_deprecated_constant, module_globals=globals())
__dir__ = functools.partial(
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
)
__all__ = all_with_deprecated_constants(globals())

View File

@@ -49,7 +49,6 @@ from homeassistant.core import (
callback,
get_release_channel,
)
from homeassistant.core_config import Config
from homeassistant.exceptions import (
HomeAssistantError,
InvalidEntityFormatError,
@@ -64,12 +63,7 @@ from homeassistant.util import dt as dt_util
from homeassistant.util.async_ import create_eager_task
from homeassistant.util.read_only_dict import ReadOnlyDict
from .common import (
async_capture_events,
async_mock_service,
help_test_all,
import_and_test_deprecated_alias,
)
from .common import async_capture_events, async_mock_service
PST = dt_util.get_time_zone("America/Los_Angeles")
@@ -3019,16 +3013,6 @@ async def test_cancel_shutdown_job(hass: HomeAssistant) -> None:
assert not evt.is_set()
def test_all() -> None:
"""Test module.__all__ is correctly set."""
help_test_all(ha)
def test_deprecated_config(caplog: pytest.LogCaptureFixture) -> None:
"""Test deprecated Config class."""
import_and_test_deprecated_alias(caplog, ha, "Config", Config, "2025.11")
def test_one_time_listener_repr(hass: HomeAssistant) -> None:
"""Test one time listener repr."""