From 9de69600f04f9f59fd4dc48fb638af2ce4446d60 Mon Sep 17 00:00:00 2001 From: Tom Harris Date: Mon, 19 Feb 2018 18:16:49 -0500 Subject: [PATCH] lint cleanup --- .../components/binary_sensor/insteon_plm.py | 6 +++--- homeassistant/components/fan/insteon_plm.py | 3 +-- homeassistant/components/insteon_plm.py | 14 +++++++------- homeassistant/components/light/insteon_plm.py | 3 +-- homeassistant/components/sensor/insteon_plm.py | 3 +-- homeassistant/components/switch/insteon_plm.py | 7 +++---- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/binary_sensor/insteon_plm.py b/homeassistant/components/binary_sensor/insteon_plm.py index 50466179771..ecb688893b4 100644 --- a/homeassistant/components/binary_sensor/insteon_plm.py +++ b/homeassistant/components/binary_sensor/insteon_plm.py @@ -20,10 +20,10 @@ SENSOR_TYPES = {'openClosedSensor': 'opening', 'doorSensor': 'door', 'leakSensor': 'moisture'} + @asyncio.coroutine def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the INSTEON PLM device class for the hass platform.""" - state_list = [] plm = hass.data['insteon_plm'] @@ -43,7 +43,7 @@ class InsteonPLMBinarySensor(BinarySensorDevice): """A Class for an Insteon device state.""" def __init__(self, hass, device, state_key): - """Initialize the binarysensor.""" + """Initialize the INSTEON PLM binary sensor.""" self._hass = hass self._insteon_device_state = device.states[state_key] self._insteon_device = device @@ -65,7 +65,7 @@ class InsteonPLMBinarySensor(BinarySensorDevice): @property def name(self): - """Return the name of the node. (used for Entity_ID)""" + """Return the name of the node (used for Entity_ID).""" name = '' if self._insteon_device_state.group == 0x01: name = self._insteon_device.id diff --git a/homeassistant/components/fan/insteon_plm.py b/homeassistant/components/fan/insteon_plm.py index a50a0039474..2174f6aeef5 100644 --- a/homeassistant/components/fan/insteon_plm.py +++ b/homeassistant/components/fan/insteon_plm.py @@ -30,7 +30,6 @@ _LOGGER = logging.getLogger(__name__) @asyncio.coroutine def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the INSTEON PLM device class for the hass platform.""" - state_list = [] plm = hass.data['insteon_plm'] @@ -72,7 +71,7 @@ class InsteonPLMFan(FanEntity): @property def name(self): - """Return the name of the node. (used for Entity_ID)""" + """Return the name of the node (used for Entity_ID).""" name = '' if self._insteon_device_state.group == 0x01: name = self._insteon_device.id diff --git a/homeassistant/components/insteon_plm.py b/homeassistant/components/insteon_plm.py index 7290d2bfca4..546ae7c1542 100644 --- a/homeassistant/components/insteon_plm.py +++ b/homeassistant/components/insteon_plm.py @@ -46,7 +46,6 @@ def async_setup(hass, config): @callback def async_plm_new_device(device): """Detect device from transport to be delegated to platform.""" - for state_key in device.states: platform_info = ipdb[device.states[state_key]] platform = platform_info.platform @@ -119,11 +118,9 @@ State = collections.namedtuple('Product', 'stateType platform') class IPDB(object): - """Embodies the INSTEON Product Database static data -and access methods.""" - + """Embodies the INSTEON Product Database static data and access methods.""" def __init__(self): - + """Create the INSTEON Product Database (IPDB).""" from insteonplm.states.onOff import (OnOffSwitch, OnOffSwitch_OutletTop, OnOffSwitch_OutletBottom, @@ -148,17 +145,20 @@ and access methods.""" State(VariableSensor, 'sensor'), State(DimmableSwitch_Fan, 'fan'), - State(DimmableSwitch, 'light') - ] + State(DimmableSwitch, 'light')] def __len__(self): + """Return the number of INSTEON state types mapped to HA platforms.""" return len(self.states) def __iter__(self): + """Itterate through the INSTEON state types to HA platforms.""" for product in self.states: yield product def __getitem__(self, key): + """Return a Home Assistant platform from an INSTEON state type. + """ for state in self.states: if isinstance(key, state.stateType): return state diff --git a/homeassistant/components/light/insteon_plm.py b/homeassistant/components/light/insteon_plm.py index 7272e127448..7fde9b36a5b 100644 --- a/homeassistant/components/light/insteon_plm.py +++ b/homeassistant/components/light/insteon_plm.py @@ -22,7 +22,6 @@ MAX_BRIGHTNESS = 255 @asyncio.coroutine def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Insteon PLM device.""" - state_list = [] plm = hass.data['insteon_plm'] @@ -61,7 +60,7 @@ class InsteonPLMDimmerDevice(Light): @property def name(self): - """Return the name of the node. (used for Entity_ID)""" + """Return the name of the node (used for Entity_ID).""" name = '' if self._insteon_device_state.group == 0x01: name = self._insteon_device.id diff --git a/homeassistant/components/sensor/insteon_plm.py b/homeassistant/components/sensor/insteon_plm.py index 656eadd539e..7d2f4474d3a 100644 --- a/homeassistant/components/sensor/insteon_plm.py +++ b/homeassistant/components/sensor/insteon_plm.py @@ -19,7 +19,6 @@ _LOGGER = logging.getLogger(__name__) @asyncio.coroutine def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the INSTEON PLM device class for the hass platform.""" - state_list = [] plm = hass.data['insteon_plm'] @@ -58,7 +57,7 @@ class InsteonPLMSensorDevice(Entity): @property def name(self): - """Return the name of the node. (used for Entity_ID)""" + """Return the name of the node (used for Entity_ID).""" name = '' if self._insteon_device_state.group == 0x01: name = self._insteon_device.id diff --git a/homeassistant/components/switch/insteon_plm.py b/homeassistant/components/switch/insteon_plm.py index 26c38570e08..9ac1e9fc94f 100644 --- a/homeassistant/components/switch/insteon_plm.py +++ b/homeassistant/components/switch/insteon_plm.py @@ -19,7 +19,6 @@ _LOGGER = logging.getLogger(__name__) @asyncio.coroutine def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the INSTEON PLM device class for the hass platform.""" - state_list = [] plm = hass.data['insteon_plm'] @@ -65,7 +64,7 @@ class InsteonPLMSwitchDevice(SwitchDevice): @property def name(self): - """Return the name of the node. (used for Entity_ID)""" + """Return the name of the node (used for Entity_ID).""" name = '' if self._insteon_device_state.group == 0x01: name = self._insteon_device.id @@ -99,7 +98,7 @@ class InsteonPLMSwitchDevice(SwitchDevice): @asyncio.coroutine def async_turn_off(self, **kwargs): - """Turn device off""" + """Turn device off.""" self._insteon_device_state.off() @@ -160,5 +159,5 @@ class InsteonPLMOpenClosedDevice(SwitchDevice): @asyncio.coroutine def async_turn_off(self, **kwargs): - """Turn device off""" + """Turn device off.""" self._insteon_device_state.close()