From 709e1de9c93b4429ea2e0a2a9dd38aa0cd5f6e5f Mon Sep 17 00:00:00 2001 From: pifou Date: Mon, 26 Oct 2020 23:09:04 +0100 Subject: [PATCH 01/14] add a mapping for every subclass of Device with DeviceType enum as key This make it easy to get the relevant subclasse of Device according to the DeviceType of the model info --- wideq/ac.py | 9 ++++++++- wideq/client.py | 17 +++++++++++++++++ wideq/dishwasher.py | 6 +++++- wideq/dryer.py | 6 +++++- wideq/refrigerator.py | 7 ++++++- wideq/washer.py | 6 +++++- 6 files changed, 46 insertions(+), 5 deletions(-) diff --git a/wideq/ac.py b/wideq/ac.py index 1a08070..52a4ec8 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -2,7 +2,7 @@ """ import enum -from .client import Device +from .client import Device, DeviceInfo, DeviceType from .util import lookup_enum from .core import FailedRequestError @@ -422,3 +422,10 @@ class ACStatus(object): def is_on(self): op = ACOp(lookup_enum('Operation', self.data, self.ac)) return op != ACOp.OFF + + def __str__(self): + return "ACStatus(%r %r)" % (self.ac, self.data) + + +# register device on the global mapping +DeviceInfo.mapping[DeviceType.AC] = ACDevice diff --git a/wideq/client.py b/wideq/client.py index dd6ed6c..77e2ecc 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -257,6 +257,16 @@ class DeviceInfo(object): This is populated from a JSON dictionary provided by the API. """ + """ + Each subclasse of Device need to be registered here : + DeviceType.AC: ACDevice, + DeviceType.KIMCHI_REFRIGERATOR: RefrigeratorDevice, + DeviceType.DISHWASHER: DishWasherDevice, + DeviceType.DRYER : DryerDevice, + DeviceType.WASHER : WasherDevice, + """ + mapping = dict() + def __init__(self, data: Dict[str, Any]) -> None: self.data = data @@ -286,6 +296,13 @@ class DeviceInfo(object): """Load JSON data describing the model's capabilities. """ return requests.get(self.model_info_url).json() + + def load_object(self): + """Load the registered subclasse Device object according to his type + """ + if self.type in DeviceInfo.mapping: + return DeviceInfo.mapping.get(self.type) + return Device BitValue = namedtuple('BitValue', ['options']) diff --git a/wideq/dishwasher.py b/wideq/dishwasher.py index f912eff..d5a9ced 100644 --- a/wideq/dishwasher.py +++ b/wideq/dishwasher.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device +from .client import Device, DeviceInfo, DeviceType from .util import lookup_enum, lookup_reference @@ -158,3 +158,7 @@ class DishWasherStatus(object): def error(self) -> str: """Get the current error.""" return lookup_reference('Error', self.data, self.dishwasher) + + +# register device on the global mapping +DeviceInfo.mapping[DeviceType.DISHWASHER] = DishWasherDevice diff --git a/wideq/dryer.py b/wideq/dryer.py index 0b25203..304bc03 100644 --- a/wideq/dryer.py +++ b/wideq/dryer.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device, _UNKNOWN +from .client import Device, _UNKNOWN, DeviceInfo, DeviceType from .util import lookup_enum, lookup_reference @@ -182,3 +182,7 @@ class DryerStatus(object): def error(self) -> str: """Get the current error.""" return lookup_reference('Error', self.data, self.dryer) + + +# register device on the global mapping +DeviceInfo.mapping[DeviceType.DRYER] = DryerDevice diff --git a/wideq/refrigerator.py b/wideq/refrigerator.py index 7dff39f..006495d 100644 --- a/wideq/refrigerator.py +++ b/wideq/refrigerator.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device +from .client import Device, DeviceInfo, DeviceType from .util import lookup_enum @@ -138,3 +138,8 @@ class RefrigeratorStatus(object): @property def water_filter_used_month(self): return self.data['WaterFilterUsedMonth'] + + +# register device on the global mapping +DeviceInfo.mapping[DeviceType.KIMCHI_REFRIGERATOR] = RefrigeratorDevice +DeviceInfo.mapping[DeviceType.REFRIGERATOR] = RefrigeratorDevice diff --git a/wideq/washer.py b/wideq/washer.py index 974d3be..6756b55 100644 --- a/wideq/washer.py +++ b/wideq/washer.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device +from .client import Device, DeviceInfo, DeviceType from .util import lookup_enum, lookup_reference @@ -121,3 +121,7 @@ class WasherStatus(object): def error(self) -> str: """Get the current error.""" return lookup_reference('Error', self.data, self.washer) + + +# register device on the global mapping +DeviceInfo.mapping[DeviceType.WASHER] = WasherDevice From 4fda55aba0cf3f7eb0519c1179117657ce4d74c7 Mon Sep 17 00:00:00 2001 From: pifou Date: Mon, 26 Oct 2020 23:19:52 +0100 Subject: [PATCH 02/14] fix mypy errors --- wideq/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wideq/client.py b/wideq/client.py index 77e2ecc..fddd97b 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -265,7 +265,7 @@ class DeviceInfo(object): DeviceType.DRYER : DryerDevice, DeviceType.WASHER : WasherDevice, """ - mapping = dict() + mapping : dict[DeviceType, Device] = {} def __init__(self, data: Dict[str, Any]) -> None: self.data = data @@ -296,9 +296,9 @@ class DeviceInfo(object): """Load JSON data describing the model's capabilities. """ return requests.get(self.model_info_url).json() - + def load_object(self): - """Load the registered subclasse Device object according to his type + """Load the registered subclasse Device object according to his type """ if self.type in DeviceInfo.mapping: return DeviceInfo.mapping.get(self.type) From 696f65e122502f4638b4018726b6948d753a9aef Mon Sep 17 00:00:00 2001 From: pifou Date: Mon, 26 Oct 2020 23:26:32 +0100 Subject: [PATCH 03/14] Update client.py --- wideq/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index fddd97b..44572b4 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -265,7 +265,7 @@ class DeviceInfo(object): DeviceType.DRYER : DryerDevice, DeviceType.WASHER : WasherDevice, """ - mapping : dict[DeviceType, Device] = {} + mapping: dict[DeviceType, Device()] = {} def __init__(self, data: Dict[str, Any]) -> None: self.data = data From 743622dea060979116cc65b5e3a7e90b041abe3f Mon Sep 17 00:00:00 2001 From: pifou Date: Mon, 26 Oct 2020 23:28:57 +0100 Subject: [PATCH 04/14] Update client.py --- wideq/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index 44572b4..6efb2de 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -265,7 +265,7 @@ class DeviceInfo(object): DeviceType.DRYER : DryerDevice, DeviceType.WASHER : WasherDevice, """ - mapping: dict[DeviceType, Device()] = {} + mapping: dict[DeviceType, object] = {} def __init__(self, data: Dict[str, Any]) -> None: self.data = data From 1bcf1bd1f1a7bf40edcd6a2ee343baa024eb2c15 Mon Sep 17 00:00:00 2001 From: pifou Date: Mon, 26 Oct 2020 23:35:33 +0100 Subject: [PATCH 05/14] Update client.py --- wideq/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index 6efb2de..a9b61b2 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -265,7 +265,7 @@ class DeviceInfo(object): DeviceType.DRYER : DryerDevice, DeviceType.WASHER : WasherDevice, """ - mapping: dict[DeviceType, object] = {} + mapping: typing.Dict[DeviceType, object] = {} def __init__(self, data: Dict[str, Any]) -> None: self.data = data From 70f0a32ed2bb2c7c4c7f344ff03dc757638b7b9b Mon Sep 17 00:00:00 2001 From: pifou Date: Mon, 26 Oct 2020 23:40:15 +0100 Subject: [PATCH 06/14] Update client.py --- wideq/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index a9b61b2..7134dcc 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -265,7 +265,7 @@ class DeviceInfo(object): DeviceType.DRYER : DryerDevice, DeviceType.WASHER : WasherDevice, """ - mapping: typing.Dict[DeviceType, object] = {} + mapping: Dict[DeviceType, object] = {} def __init__(self, data: Dict[str, Any]) -> None: self.data = data From 763b6e50059ffb65102e040d9af985982c984129 Mon Sep 17 00:00:00 2001 From: pifou Date: Tue, 27 Oct 2020 20:34:32 +0100 Subject: [PATCH 07/14] refactoring move mapping declaration into util.py with local import into the the module-level function device_classes add client.get_device_class adapt example.py with AC monitoring --- example.py | 6 ++---- wideq/ac.py | 6 +----- wideq/client.py | 36 +++++++++++++++++++----------------- wideq/dishwasher.py | 6 +----- wideq/dryer.py | 6 +----- wideq/refrigerator.py | 7 +------ wideq/util.py | 21 ++++++++++++++++++++- wideq/washer.py | 6 +----- 8 files changed, 46 insertions(+), 48 deletions(-) diff --git a/example.py b/example.py index 001d6d2..7d82b5d 100755 --- a/example.py +++ b/example.py @@ -77,13 +77,11 @@ def ac_mon(client, device_id): its status such as its temperature and operation mode. """ - device = client.get_device(device_id) - if device.type != wideq.DeviceType.AC: + ac = client.get_device_class(device_id) + if not isinstance(ac, 'ACDevice'): print('This is not an AC device.') return - ac = wideq.ACDevice(client, device) - try: ac.monitor_start() except wideq.core.NotConnectedError: diff --git a/wideq/ac.py b/wideq/ac.py index 52a4ec8..54bf93e 100644 --- a/wideq/ac.py +++ b/wideq/ac.py @@ -2,7 +2,7 @@ """ import enum -from .client import Device, DeviceInfo, DeviceType +from .client import Device from .util import lookup_enum from .core import FailedRequestError @@ -425,7 +425,3 @@ class ACStatus(object): def __str__(self): return "ACStatus(%r %r)" % (self.ac, self.data) - - -# register device on the global mapping -DeviceInfo.mapping[DeviceType.AC] = ACDevice diff --git a/wideq/client.py b/wideq/client.py index 7134dcc..4587e91 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -12,6 +12,7 @@ from typing import Any, Dict, Generator, List, Optional from . import core + #: Represents an unknown enum value. _UNKNOWN = 'Unknown' LOGGER = logging.getLogger("wideq.client") @@ -138,6 +139,24 @@ class Client(object): return device return None + def get_device_class(self, device_id): + """Look up a subclass of Device object by device ID. + + Return a Device instance if no subclass exists for the device type. + Return None if the device does not exist. + """ + from . import util + + deviceInfo = self.get_device(device_id) + if deviceInfo == None: + return None + classes = util.device_classes() + if deviceInfo.type in classes: + return classes.get(deviceInfo.type)(self, deviceInfo) + LOGGER.debug('No specific subclass for deviceType %s, using default', deviceInfo.type) + return Device(self, deviceInfo) + + @classmethod def load(cls, state: Dict[str, Any]) -> 'Client': """Load a client from serialized state. @@ -257,16 +276,6 @@ class DeviceInfo(object): This is populated from a JSON dictionary provided by the API. """ - """ - Each subclasse of Device need to be registered here : - DeviceType.AC: ACDevice, - DeviceType.KIMCHI_REFRIGERATOR: RefrigeratorDevice, - DeviceType.DISHWASHER: DishWasherDevice, - DeviceType.DRYER : DryerDevice, - DeviceType.WASHER : WasherDevice, - """ - mapping: Dict[DeviceType, object] = {} - def __init__(self, data: Dict[str, Any]) -> None: self.data = data @@ -297,13 +306,6 @@ class DeviceInfo(object): """ return requests.get(self.model_info_url).json() - def load_object(self): - """Load the registered subclasse Device object according to his type - """ - if self.type in DeviceInfo.mapping: - return DeviceInfo.mapping.get(self.type) - return Device - BitValue = namedtuple('BitValue', ['options']) EnumValue = namedtuple('EnumValue', ['options']) diff --git a/wideq/dishwasher.py b/wideq/dishwasher.py index d5a9ced..f912eff 100644 --- a/wideq/dishwasher.py +++ b/wideq/dishwasher.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device, DeviceInfo, DeviceType +from .client import Device from .util import lookup_enum, lookup_reference @@ -158,7 +158,3 @@ class DishWasherStatus(object): def error(self) -> str: """Get the current error.""" return lookup_reference('Error', self.data, self.dishwasher) - - -# register device on the global mapping -DeviceInfo.mapping[DeviceType.DISHWASHER] = DishWasherDevice diff --git a/wideq/dryer.py b/wideq/dryer.py index 304bc03..0b25203 100644 --- a/wideq/dryer.py +++ b/wideq/dryer.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device, _UNKNOWN, DeviceInfo, DeviceType +from .client import Device, _UNKNOWN from .util import lookup_enum, lookup_reference @@ -182,7 +182,3 @@ class DryerStatus(object): def error(self) -> str: """Get the current error.""" return lookup_reference('Error', self.data, self.dryer) - - -# register device on the global mapping -DeviceInfo.mapping[DeviceType.DRYER] = DryerDevice diff --git a/wideq/refrigerator.py b/wideq/refrigerator.py index 006495d..7dff39f 100644 --- a/wideq/refrigerator.py +++ b/wideq/refrigerator.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device, DeviceInfo, DeviceType +from .client import Device from .util import lookup_enum @@ -138,8 +138,3 @@ class RefrigeratorStatus(object): @property def water_filter_used_month(self): return self.data['WaterFilterUsedMonth'] - - -# register device on the global mapping -DeviceInfo.mapping[DeviceType.KIMCHI_REFRIGERATOR] = RefrigeratorDevice -DeviceInfo.mapping[DeviceType.REFRIGERATOR] = RefrigeratorDevice diff --git a/wideq/util.py b/wideq/util.py index 67aef76..e4c52d8 100644 --- a/wideq/util.py +++ b/wideq/util.py @@ -1,6 +1,6 @@ from typing import TypeVar -from .client import Device +from .client import Device, DeviceType T = TypeVar('T', bound=Device) @@ -29,3 +29,22 @@ def lookup_reference(attr: str, data: dict, device: T) -> str: if value is None: return 'Off' return value + + +def device_classes(): + """The mapping of every Device subclass related to the DeviceType enum + """ + from .ac import ACDevice + from .dryer import DryerDevice + from .dishwasher import DishWasherDevice + from .washer import WasherDevice + from .refrigerator import RefrigeratorDevice + + return { + DeviceType.AC: ACDevice, + DeviceType.KIMCHI_REFRIGERATOR: RefrigeratorDevice, + DeviceType.REFRIGERATOR: RefrigeratorDevice, + DeviceType.DISHWASHER: DishWasherDevice, + DeviceType.DRYER : DryerDevice, + DeviceType.WASHER : WasherDevice, + } diff --git a/wideq/washer.py b/wideq/washer.py index 6756b55..974d3be 100644 --- a/wideq/washer.py +++ b/wideq/washer.py @@ -1,7 +1,7 @@ import enum from typing import Optional -from .client import Device, DeviceInfo, DeviceType +from .client import Device from .util import lookup_enum, lookup_reference @@ -121,7 +121,3 @@ class WasherStatus(object): def error(self) -> str: """Get the current error.""" return lookup_reference('Error', self.data, self.washer) - - -# register device on the global mapping -DeviceInfo.mapping[DeviceType.WASHER] = WasherDevice From 4afd5685cb5d9ff24aa405b23fc89ac97a301ffa Mon Sep 17 00:00:00 2001 From: pifou Date: Tue, 27 Oct 2020 23:09:44 +0100 Subject: [PATCH 08/14] fix tox warnings and errors --- wideq/client.py | 10 +++++----- wideq/util.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wideq/client.py b/wideq/client.py index 4587e91..776e304 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -146,17 +146,17 @@ class Client(object): Return None if the device does not exist. """ from . import util - + deviceInfo = self.get_device(device_id) - if deviceInfo == None: + if not deviceInfo: return None classes = util.device_classes() if deviceInfo.type in classes: return classes.get(deviceInfo.type)(self, deviceInfo) - LOGGER.debug('No specific subclass for deviceType %s, using default', deviceInfo.type) + LOGGER.debug('No specific subclass for deviceType %s, using default', + deviceInfo.type) return Device(self, deviceInfo) - - + @classmethod def load(cls, state: Dict[str, Any]) -> 'Client': """Load a client from serialized state. diff --git a/wideq/util.py b/wideq/util.py index e4c52d8..200ecf0 100644 --- a/wideq/util.py +++ b/wideq/util.py @@ -45,6 +45,6 @@ def device_classes(): DeviceType.KIMCHI_REFRIGERATOR: RefrigeratorDevice, DeviceType.REFRIGERATOR: RefrigeratorDevice, DeviceType.DISHWASHER: DishWasherDevice, - DeviceType.DRYER : DryerDevice, - DeviceType.WASHER : WasherDevice, + DeviceType.DRYER: DryerDevice, + DeviceType.WASHER: WasherDevice, } From db6c6f631b51d8fc0b804c17455725ace3a938d8 Mon Sep 17 00:00:00 2001 From: pifou Date: Tue, 27 Oct 2020 23:15:48 +0100 Subject: [PATCH 09/14] Update client.py --- wideq/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index 776e304..b7d68b7 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -154,7 +154,7 @@ class Client(object): if deviceInfo.type in classes: return classes.get(deviceInfo.type)(self, deviceInfo) LOGGER.debug('No specific subclass for deviceType %s, using default', - deviceInfo.type) + deviceInfo.type) return Device(self, deviceInfo) @classmethod From 649299eacf317c11afaafafd5c2636a4a983f8b4 Mon Sep 17 00:00:00 2001 From: pifou Date: Wed, 28 Oct 2020 22:33:42 +0100 Subject: [PATCH 10/14] remove ac-mon command from example.py remove ac-mon command, use only 'mon' command as generic command for any device --- example.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/example.py b/example.py index 7d82b5d..f0b8510 100755 --- a/example.py +++ b/example.py @@ -34,9 +34,9 @@ def ls(client): print('{0.id}: {0.name} ({0.type.name} {0.model_id})'.format(device)) -def mon(client, device_id): - """Monitor any device, displaying generic information about its - status. +def gen_mon(client, device_id): + """Monitor any other device but AC device, + displaying generic information about its status. """ device = client.get_device(device_id) @@ -72,16 +72,11 @@ def mon(client, device_id): pass -def ac_mon(client, device_id): +def ac_mon(ac): """Monitor an AC/HVAC device, showing higher-level information about its status such as its temperature and operation mode. """ - ac = client.get_device_class(device_id) - if not isinstance(ac, 'ACDevice'): - print('This is not an AC device.') - return - try: ac.monitor_start() except wideq.core.NotConnectedError: @@ -104,6 +99,8 @@ def ac_mon(client, device_id): 'on' if state.is_on else 'off' ) ) + else: + print('no state. Wait 1 more second.') except KeyboardInterrupt: pass @@ -111,6 +108,18 @@ def ac_mon(client, device_id): ac.monitor_stop() +def mon(client, device_id): + """Monitor any device, displaying generic information about its + status. + """ + + device_class = client.get_device_class(device_id) + if isinstance(device_class, wideq.ACDevice): + ac_mon(device_class) + else: + gen_mon(client, device_id) + + class UserError(Exception): """A user-visible command-line error. """ @@ -183,7 +192,6 @@ def ac_config(client, device_id): EXAMPLE_COMMANDS = { 'ls': ls, 'mon': mon, - 'ac-mon': ac_mon, 'set-temp': set_temp, 'set-temp-freezer': set_temp_freezer, 'turn': turn, From bf77fd0f7c15cadc69cecff55199384ada2ae64d Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 28 Oct 2020 22:49:54 +0100 Subject: [PATCH 11/14] Update wideq/client.py Co-authored-by: Adrian Sampson --- wideq/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index b7d68b7..76428f3 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -152,7 +152,7 @@ class Client(object): return None classes = util.device_classes() if deviceInfo.type in classes: - return classes.get(deviceInfo.type)(self, deviceInfo) + return classes[deviceInfo.type](self, deviceInfo) LOGGER.debug('No specific subclass for deviceType %s, using default', deviceInfo.type) return Device(self, deviceInfo) From 4ac98be93673b2139e936ba764d1244856c90c49 Mon Sep 17 00:00:00 2001 From: pifou Date: Wed, 28 Oct 2020 22:53:53 +0100 Subject: [PATCH 12/14] fix latest discussion lower-level --- example.py | 4 ++-- wideq/client.py | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/example.py b/example.py index f0b8510..efe516f 100755 --- a/example.py +++ b/example.py @@ -35,7 +35,7 @@ def ls(client): def gen_mon(client, device_id): - """Monitor any other device but AC device, + """Monitor any other device but AC device, displaying generic information about its status. """ @@ -113,7 +113,7 @@ def mon(client, device_id): status. """ - device_class = client.get_device_class(device_id) + device_class = client.get_device_obj(device_id) if isinstance(device_class, wideq.ACDevice): ac_mon(device_class) else: diff --git a/wideq/client.py b/wideq/client.py index 76428f3..c14164d 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -10,7 +10,7 @@ import re from collections import namedtuple from typing import Any, Dict, Generator, List, Optional -from . import core +from . import core, util #: Represents an unknown enum value. @@ -139,23 +139,22 @@ class Client(object): return device return None - def get_device_class(self, device_id): + def get_device_obj(self, device_id): """Look up a subclass of Device object by device ID. Return a Device instance if no subclass exists for the device type. Return None if the device does not exist. """ - from . import util - deviceInfo = self.get_device(device_id) - if not deviceInfo: + device_info = self.get_device(device_id) + if not device_info: return None classes = util.device_classes() - if deviceInfo.type in classes: - return classes[deviceInfo.type](self, deviceInfo) + if device_info.type in classes: + return classes[device_info.type](self, device_info) LOGGER.debug('No specific subclass for deviceType %s, using default', - deviceInfo.type) - return Device(self, deviceInfo) + device_info.type) + return Device(self, device_info) @classmethod def load(cls, state: Dict[str, Any]) -> 'Client': From d6a8a95d015eaad87ea3e2d4c8c1926ea1d3bc86 Mon Sep 17 00:00:00 2001 From: pifou Date: Wed, 28 Oct 2020 22:56:36 +0100 Subject: [PATCH 13/14] rollback for util import into client.py --- wideq/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index c14164d..1ed7732 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -10,7 +10,7 @@ import re from collections import namedtuple from typing import Any, Dict, Generator, List, Optional -from . import core, util +from . import core #: Represents an unknown enum value. @@ -145,6 +145,7 @@ class Client(object): Return a Device instance if no subclass exists for the device type. Return None if the device does not exist. """ + from . import util device_info = self.get_device(device_id) if not device_info: From b675a8782afa41d5367111ccc7d1799e7a38648d Mon Sep 17 00:00:00 2001 From: pifou Date: Wed, 28 Oct 2020 22:58:55 +0100 Subject: [PATCH 14/14] indentation fix in client.py --- wideq/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wideq/client.py b/wideq/client.py index 1ed7732..2d5b416 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -145,7 +145,7 @@ class Client(object): Return a Device instance if no subclass exists for the device type. Return None if the device does not exist. """ - from . import util + from . import util device_info = self.get_device(device_id) if not device_info: