lint cleanup

This commit is contained in:
Tom Harris
2018-02-19 18:16:49 -05:00
parent 9367a17dc9
commit 9de69600f0
6 changed files with 16 additions and 20 deletions

View File

@@ -20,10 +20,10 @@ SENSOR_TYPES = {'openClosedSensor': 'opening',
'doorSensor': 'door', 'doorSensor': 'door',
'leakSensor': 'moisture'} 'leakSensor': 'moisture'}
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the INSTEON PLM device class for the hass platform.""" """Set up the INSTEON PLM device class for the hass platform."""
state_list = [] state_list = []
plm = hass.data['insteon_plm'] plm = hass.data['insteon_plm']
@@ -43,7 +43,7 @@ class InsteonPLMBinarySensor(BinarySensorDevice):
"""A Class for an Insteon device state.""" """A Class for an Insteon device state."""
def __init__(self, hass, device, state_key): def __init__(self, hass, device, state_key):
"""Initialize the binarysensor.""" """Initialize the INSTEON PLM binary sensor."""
self._hass = hass self._hass = hass
self._insteon_device_state = device.states[state_key] self._insteon_device_state = device.states[state_key]
self._insteon_device = device self._insteon_device = device
@@ -65,7 +65,7 @@ class InsteonPLMBinarySensor(BinarySensorDevice):
@property @property
def name(self): def name(self):
"""Return the name of the node. (used for Entity_ID)""" """Return the name of the node (used for Entity_ID)."""
name = '' name = ''
if self._insteon_device_state.group == 0x01: if self._insteon_device_state.group == 0x01:
name = self._insteon_device.id name = self._insteon_device.id

View File

@@ -30,7 +30,6 @@ _LOGGER = logging.getLogger(__name__)
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the INSTEON PLM device class for the hass platform.""" """Set up the INSTEON PLM device class for the hass platform."""
state_list = [] state_list = []
plm = hass.data['insteon_plm'] plm = hass.data['insteon_plm']
@@ -72,7 +71,7 @@ class InsteonPLMFan(FanEntity):
@property @property
def name(self): def name(self):
"""Return the name of the node. (used for Entity_ID)""" """Return the name of the node (used for Entity_ID)."""
name = '' name = ''
if self._insteon_device_state.group == 0x01: if self._insteon_device_state.group == 0x01:
name = self._insteon_device.id name = self._insteon_device.id

View File

@@ -46,7 +46,6 @@ def async_setup(hass, config):
@callback @callback
def async_plm_new_device(device): def async_plm_new_device(device):
"""Detect device from transport to be delegated to platform.""" """Detect device from transport to be delegated to platform."""
for state_key in device.states: for state_key in device.states:
platform_info = ipdb[device.states[state_key]] platform_info = ipdb[device.states[state_key]]
platform = platform_info.platform platform = platform_info.platform
@@ -119,11 +118,9 @@ State = collections.namedtuple('Product', 'stateType platform')
class IPDB(object): class IPDB(object):
"""Embodies the INSTEON Product Database static data """Embodies the INSTEON Product Database static data and access methods."""
and access methods."""
def __init__(self): def __init__(self):
"""Create the INSTEON Product Database (IPDB)."""
from insteonplm.states.onOff import (OnOffSwitch, from insteonplm.states.onOff import (OnOffSwitch,
OnOffSwitch_OutletTop, OnOffSwitch_OutletTop,
OnOffSwitch_OutletBottom, OnOffSwitch_OutletBottom,
@@ -148,17 +145,20 @@ and access methods."""
State(VariableSensor, 'sensor'), State(VariableSensor, 'sensor'),
State(DimmableSwitch_Fan, 'fan'), State(DimmableSwitch_Fan, 'fan'),
State(DimmableSwitch, 'light') State(DimmableSwitch, 'light')]
]
def __len__(self): def __len__(self):
"""Return the number of INSTEON state types mapped to HA platforms."""
return len(self.states) return len(self.states)
def __iter__(self): def __iter__(self):
"""Itterate through the INSTEON state types to HA platforms."""
for product in self.states: for product in self.states:
yield product yield product
def __getitem__(self, key): def __getitem__(self, key):
"""Return a Home Assistant platform from an INSTEON state type.
"""
for state in self.states: for state in self.states:
if isinstance(key, state.stateType): if isinstance(key, state.stateType):
return state return state

View File

@@ -22,7 +22,6 @@ MAX_BRIGHTNESS = 255
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the Insteon PLM device.""" """Set up the Insteon PLM device."""
state_list = [] state_list = []
plm = hass.data['insteon_plm'] plm = hass.data['insteon_plm']
@@ -61,7 +60,7 @@ class InsteonPLMDimmerDevice(Light):
@property @property
def name(self): def name(self):
"""Return the name of the node. (used for Entity_ID)""" """Return the name of the node (used for Entity_ID)."""
name = '' name = ''
if self._insteon_device_state.group == 0x01: if self._insteon_device_state.group == 0x01:
name = self._insteon_device.id name = self._insteon_device.id

View File

@@ -19,7 +19,6 @@ _LOGGER = logging.getLogger(__name__)
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the INSTEON PLM device class for the hass platform.""" """Set up the INSTEON PLM device class for the hass platform."""
state_list = [] state_list = []
plm = hass.data['insteon_plm'] plm = hass.data['insteon_plm']
@@ -58,7 +57,7 @@ class InsteonPLMSensorDevice(Entity):
@property @property
def name(self): def name(self):
"""Return the name of the node. (used for Entity_ID)""" """Return the name of the node (used for Entity_ID)."""
name = '' name = ''
if self._insteon_device_state.group == 0x01: if self._insteon_device_state.group == 0x01:
name = self._insteon_device.id name = self._insteon_device.id

View File

@@ -19,7 +19,6 @@ _LOGGER = logging.getLogger(__name__)
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the INSTEON PLM device class for the hass platform.""" """Set up the INSTEON PLM device class for the hass platform."""
state_list = [] state_list = []
plm = hass.data['insteon_plm'] plm = hass.data['insteon_plm']
@@ -65,7 +64,7 @@ class InsteonPLMSwitchDevice(SwitchDevice):
@property @property
def name(self): def name(self):
"""Return the name of the node. (used for Entity_ID)""" """Return the name of the node (used for Entity_ID)."""
name = '' name = ''
if self._insteon_device_state.group == 0x01: if self._insteon_device_state.group == 0x01:
name = self._insteon_device.id name = self._insteon_device.id
@@ -99,7 +98,7 @@ class InsteonPLMSwitchDevice(SwitchDevice):
@asyncio.coroutine @asyncio.coroutine
def async_turn_off(self, **kwargs): def async_turn_off(self, **kwargs):
"""Turn device off""" """Turn device off."""
self._insteon_device_state.off() self._insteon_device_state.off()
@@ -160,5 +159,5 @@ class InsteonPLMOpenClosedDevice(SwitchDevice):
@asyncio.coroutine @asyncio.coroutine
def async_turn_off(self, **kwargs): def async_turn_off(self, **kwargs):
"""Turn device off""" """Turn device off."""
self._insteon_device_state.close() self._insteon_device_state.close()