From 0b2e371e79348d1951982e60e687fe85de9c1b13 Mon Sep 17 00:00:00 2001 From: Teemu R Date: Sat, 7 Oct 2017 17:41:51 +0200 Subject: [PATCH] =?UTF-8?q?move=20SmartDeviceException=20to=20SmartDevice,?= =?UTF-8?q?=20and=20remove=20types.py=20complet=E2=80=A6=20(#95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * move SmartDeviceException to SmartDevice, and remove types.py completely. fixes #94 * do not import skipIf anymore --- pyHS100/__init__.py | 3 +-- pyHS100/smartdevice.py | 8 +++++++- pyHS100/tests/test_pyHS100.py | 2 +- pyHS100/types.py | 5 ----- 4 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 pyHS100/types.py diff --git a/pyHS100/__init__.py b/pyHS100/__init__.py index ef5edf2e..800c221c 100644 --- a/pyHS100/__init__.py +++ b/pyHS100/__init__.py @@ -13,9 +13,8 @@ Module-specific errors are raised as `SmartDeviceException` and are expected to be handled by the user of the library. """ # flake8: noqa -from .smartdevice import SmartDevice +from .smartdevice import SmartDevice, SmartDeviceException from .smartplug import SmartPlug -from .types import SmartDeviceException from .smartbulb import SmartBulb from .protocol import TPLinkSmartHomeProtocol from .discover import Discover diff --git a/pyHS100/smartdevice.py b/pyHS100/smartdevice.py index d894c787..e68b7a94 100644 --- a/pyHS100/smartdevice.py +++ b/pyHS100/smartdevice.py @@ -20,12 +20,18 @@ import warnings from collections import defaultdict from typing import Any, Dict, List, Tuple, Optional -from .types import SmartDeviceException from .protocol import TPLinkSmartHomeProtocol _LOGGER = logging.getLogger(__name__) +class SmartDeviceException(Exception): + """ + SmartDeviceException gets raised for errors reported by device. + """ + pass + + class SmartDevice(object): # possible device features FEATURE_ENERGY_METER = 'ENE' diff --git a/pyHS100/tests/test_pyHS100.py b/pyHS100/tests/test_pyHS100.py index 17b41d2b..f899b429 100644 --- a/pyHS100/tests/test_pyHS100.py +++ b/pyHS100/tests/test_pyHS100.py @@ -1,4 +1,4 @@ -from unittest import TestCase, skip, skipIf +from unittest import TestCase, skip from voluptuous import Schema, Invalid, All, Any, Range, Coerce from functools import partial import datetime diff --git a/pyHS100/types.py b/pyHS100/types.py deleted file mode 100644 index 8152d32e..00000000 --- a/pyHS100/types.py +++ /dev/null @@ -1,5 +0,0 @@ -class SmartDeviceException(Exception): - """ - SmartDeviceException gets raised for errors reported by the plug. - """ - pass