Fix PEP257 issues

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

View file

@ -26,7 +26,7 @@ _LOGGER = logging.getLogger(__name__)
def get_scanner(hass, config):
"""Validates configuration and returns a Tomato scanner."""
"""Validate the configuration and returns a Tomato scanner."""
if not validate_config(config,
{DOMAIN: [CONF_HOST, CONF_USERNAME,
CONF_PASSWORD, CONF_HTTP_ID]},
@ -37,13 +37,10 @@ def get_scanner(hass, config):
class TomatoDeviceScanner(object):
"""This class queries a wireless router running Tomato firmware
for connected devices.
"""This class queries a wireless router running Tomato firmware."""
A description of the Tomato API can be found on
http://paulusschoutsen.nl/blog/2013/10/tomato-api-documentation/
"""
def __init__(self, config):
"""Initialize the scanner."""
host, http_id = config[CONF_HOST], config[CONF_HTTP_ID]
username, password = config[CONF_USERNAME], config[CONF_PASSWORD]
@ -64,15 +61,13 @@ class TomatoDeviceScanner(object):
self.success_init = self._update_tomato_info()
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_tomato_info()
return [item[1] for item in self.last_results['wldev']]
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."""
filter_named = [item[0] for item in self.last_results['dhcpd_lease']
if item[2] == device]
@ -83,8 +78,9 @@ class TomatoDeviceScanner(object):
@Throttle(MIN_TIME_BETWEEN_SCANS)
def _update_tomato_info(self):
"""Ensures the information from the Tomato router is up to date.
Returns boolean if scanning successful.
"""Ensure the information from the Tomato router is up to date.
Return boolean if scanning successful.
"""
with self.lock:
self.logger.info("Scanning")