Skip to content

Commit 40e86e1

Browse files
committed
add deprecate msg for xxxId attrs
1 parent e850230 commit 40e86e1

File tree

6 files changed

+27
-7
lines changed

6 files changed

+27
-7
lines changed

src/evohomeasync2/gateway.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
from __future__ import annotations
55

6-
from typing import TYPE_CHECKING, Final
6+
from typing import TYPE_CHECKING, Final, NoReturn
77

8+
from . import exceptions as exc
89
from .schema import SCH_GWY_STATUS
910
from .schema.const import (
1011
SZ_GATEWAY,
@@ -25,7 +26,15 @@
2526
from .schema import _EvoDictT
2627

2728

28-
class Gateway(ActiveFaultsBase, EntityBase):
29+
class _GatewayDeprecated: # pragma: no cover
30+
"""Deprecated attributes and methods removed from the evohome-client namespace."""
31+
32+
@property
33+
def systemId(self) -> NoReturn: # noqa: N802
34+
raise exc.DeprecationError(f"{self}: .gatewayId is deprecated, use .id")
35+
36+
37+
class Gateway(_GatewayDeprecated, ActiveFaultsBase, EntityBase):
2938
"""Instance of a location's gateway."""
3039

3140
STATUS_SCHEMA: Final[vol.Schema] = SCH_GWY_STATUS

src/evohomeasync2/hotwater.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
class _HotWaterDeprecated: # pragma: no cover
3838
"""Deprecated attributes and methods removed from the evohome-client namespace."""
3939

40-
@property
41-
def zoneId(self) -> NoReturn: # noqa: N802
42-
raise exc.DeprecationError(f"{self}: .zoneId is deprecated, use .id")
43-
4440
async def get_dhw_state(self, *args: Any, **kwargs: Any) -> NoReturn:
4541
raise exc.DeprecationError(
4642
f"{self}: .get_dhw_state() is deprecated, use Location.refresh_status()"

src/evohomeasync2/location.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
class _LocationDeprecated: # pragma: no cover
3434
"""Deprecated attributes and methods removed from the evohome-client namespace."""
3535

36+
@property
37+
def locationId(self) -> NoReturn: # noqa: N802
38+
raise exc.DeprecationError(f"{self}: .locationId is deprecated, use .id")
39+
3640
async def status(self, *args: Any, **kwargs: Any) -> NoReturn:
3741
raise exc.DeprecationError(
3842
f"{self}: .status() is deprecated, use .refresh_status()"

src/evohomeasync2/system.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
class _SystemDeprecated: # pragma: no cover
5555
"""Deprecated attributes and methods removed from the evohome-client namespace."""
5656

57+
@property
58+
def systemId(self) -> NoReturn: # noqa: N802
59+
raise exc.DeprecationError(f"{self}: .systemId is deprecated, use .id")
60+
5761
async def set_status_reset(self, *args: Any, **kwargs: Any) -> NoReturn:
5862
raise exc.DeprecationError(
5963
f"{self}: .set_status_reset() is deprecrated, use .reset_mode()"

src/evohomeasync2/zone.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ def log_as_resolved(fault: _EvoDictT) -> None:
125125
class _ZoneBaseDeprecated: # pragma: no cover
126126
"""Deprecated attributes and methods removed from the evohome-client namespace."""
127127

128+
@property
129+
def zoneId(self) -> NoReturn: # noqa: N802
130+
raise exc.DeprecationError(f"{self}: .zoneId is deprecated, use .id")
131+
128132
async def schedule(self) -> NoReturn:
129133
raise exc.DeprecationError(
130134
f"{self}: .schedule() is deprecrated, use .get_schedule()"

tests/tests/test_installs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
from pytest_snapshot.plugin import Snapshot # type: ignore[import-untyped]
1919

2020

21+
_DEPRECATED_ATTRS = ("locationId", "gatewayId", "systemId", "zoneId", "zone_type")
22+
23+
2124
def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
2225
folders = [
2326
p.name
@@ -36,7 +39,7 @@ def obj_to_dict(obj: object) -> dict[str, Any]:
3639
return {
3740
attr: getattr(obj, attr)
3841
for attr in get_property_methods(obj)
39-
if attr not in ("zoneId", "zone_type") # excl. deprecated attrs
42+
if attr not in _DEPRECATED_ATTRS
4043
}
4144

4245
with patch("evohomeasync2.broker.Broker.get", broker_get(install)):

0 commit comments

Comments
 (0)