Skip to content

Commit

Permalink
feat: add support for propcache v1.0.0+
Browse files Browse the repository at this point in the history
v1.0.0 moved the public api to propcache.api

see aio-libs/propcache#21
see aio-libs/propcache#18
see aio-libs/propcache#19
  • Loading branch information
bdraco committed Oct 6, 2024
1 parent 55f748a commit a721cd5
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions yalexs/_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Compat for external lib versions."""

try:
from propcache.api import cached_property
except ImportError:
from ._compat import cached_property

__all__ = ("cached_property",)
2 changes: 1 addition & 1 deletion yalexs/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, Union

from .backports.enum import StrEnum
from propcache import cached_property
from ._compat import cached_property
from .lock import LockDoorStatus, LockStatus
from .time import epoch_to_datetime, parse_datetime
from .users import YaleUser, get_user_info
Expand Down
2 changes: 1 addition & 1 deletion yalexs/api_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .doorbell import Doorbell
from .lock import Lock, LockDoorStatus, determine_door_state, door_state_to_string
from .time import parse_datetime
from propcache import cached_property
from ._compat import cached_property

API_EXCEPTION_RETRY_TIME = 0.1
API_RETRY_TIME = 2.5
Expand Down
2 changes: 1 addition & 1 deletion yalexs/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enum import Enum
from typing import Any

from propcache import cached_property
from ._compat import cached_property
from .device import DeviceDetail


Expand Down
2 changes: 1 addition & 1 deletion yalexs/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any

from propcache import cached_property
from ._compat import cached_property


class Device:
Expand Down
2 changes: 1 addition & 1 deletion yalexs/doorbell.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from yalexs.exceptions import ContentTokenExpired

from propcache import cached_property
from ._compat import cached_property
from .device import Device, DeviceDetail
from .time import parse_datetime

Expand Down
2 changes: 1 addition & 1 deletion yalexs/keypad.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .device import DeviceDetail
from propcache import cached_property
from ._compat import cached_property

BATTERY_LEVEL_FULL = "Full"
BATTERY_LEVEL_MEDIUM = "Medium"
Expand Down
2 changes: 1 addition & 1 deletion yalexs/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import datetime
from enum import Enum

from propcache import cached_property
from ._compat import cached_property
from .bridge import BridgeDetail, BridgeStatus
from .device import Device, DeviceDetail
from .keypad import KeypadDetail
Expand Down
2 changes: 1 addition & 1 deletion yalexs/manager/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from .gateway import Gateway
from .subscriber import SubscriberMixin
from .ratelimit import _RateLimitChecker
from propcache import cached_property
from .._compat import cached_property
from .socketio import SocketIORunner

_LOGGER = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion yalexs/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Any

from propcache import cached_property
from ._compat import cached_property

USER_CACHE = {}

Expand Down

0 comments on commit a721cd5

Please sign in to comment.