Fix PEP257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-07 21:18:53 +01:00
1 parent f6bc1a4575
commit cc7a4d545e
17 files changed
+156 -246

No files matched your search

@@ -32,7 +32,7 @@ _DEVICES_REGEX = re.compile(
# pylint: disable=unused-argument
def get_scanner(hass, config):
"""Validates configuration and returns a THOMSON scanner."""
"""Validate the configuration and return a THOMSON scanner."""
if not validate_config(config,
{DOMAIN: [CONF_HOST, CONF_USERNAME, CONF_PASSWORD]},
_LOGGER):
@@ -44,11 +44,10 @@ def get_scanner(hass, config):
class ThomsonDeviceScanner(object):
"""
This class queries a router running THOMSON firmware for connected devices.
Adapted from ASUSWRT scanner.
"""
"""This class queries a router running THOMSON firmware."""
def __init__(self, config):
"""Initialize the scanner."""
self.host = config[CONF_HOST]
self.username = config[CONF_USERNAME]
self.password = config[CONF_PASSWORD]
@@ -57,19 +56,17 @@ class ThomsonDeviceScanner(object):
self.last_results = {}
# Test the router is accessible
# Test the router is accessible.
data = self.get_thomson_data()
self.success_init = data is not None
def scan_devices(self):
"""
Scans for new devices and return a list containing found device IDs.
"""
"""Scan for new devices and return a list with found device IDs."""
self._update_info()
return [client['mac'] for client in self.last_results]
def get_device_name(self, device):
"""Returns the name of the given device or None if we don't know."""
"""Return the name of the given device or None if we don't know."""
if not self.last_results:
return None
for client in self.last_results:
@@ -79,9 +76,9 @@ class ThomsonDeviceScanner(object):
@Throttle(MIN_TIME_BETWEEN_SCANS)
def _update_info(self):
"""
Ensures the information from the THOMSON router is up to date.
Returns boolean if scanning successful.
"""Ensure the information from the THOMSON router is up to date.
Return boolean if scanning successful.
"""
if not self.success_init:
return False
@@ -92,7 +89,7 @@ class ThomsonDeviceScanner(object):
if not data:
return False
# flag C stands for CONNECTED
# Flag C stands for CONNECTED
active_clients = [client for client in data.values() if
client['status'].find('C') != -1]
self.last_results = active_clients