Skip to content

Commit

Permalink
Fix partial in enum for Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Dec 14, 2024
1 parent edb06c5 commit a657a8d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion miio/miot_device.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import sys
from enum import Enum
from functools import partial
from typing import Any, Optional, Union
Expand All @@ -9,6 +10,9 @@
from .device import Device, DeviceStatus # noqa: F401
from .exceptions import DeviceException

if sys.version_info >= (3, 11):
from enum import member

_LOGGER = logging.getLogger(__name__)


Expand All @@ -20,7 +24,12 @@ def _str2bool(x):

Int = int
Float = float
Bool = partial(_str2bool)

if sys.version_info >= (3, 11):
Bool = member(partial(_str2bool))
else:
Bool = partial(_str2bool)

Str = str


Expand Down

0 comments on commit a657a8d

Please sign in to comment.