Update docstrings to match PEP257

This commit is contained in:
Fabian Affolter 2016-03-07 18:49:31 +01:00
parent 7ff9aecd4e
commit b8a40457ee
40 changed files with 371 additions and 483 deletions

View file

@ -37,8 +37,8 @@ SERVICE_HANDLERS = {
def listen(hass, service, callback):
"""Setup listener for discovery of specific service.
"""
Setup listener for discovery of specific service.
Service can be a string or a list/tuple.
"""
if isinstance(service, str):
@ -55,10 +55,7 @@ def listen(hass, service, callback):
def discover(hass, service, discovered=None, component=None, hass_config=None):
"""Fire discovery event.
Can ensure a component is loaded.
"""
"""Fire discovery event. Can ensure a component is loaded."""
if component is not None:
bootstrap.setup_component(hass, component, hass_config)
@ -73,7 +70,7 @@ def discover(hass, service, discovered=None, component=None, hass_config=None):
def setup(hass, config):
""" Starts a discovery service. """
"""Starts a discovery service."""
logger = logging.getLogger(__name__)
from netdisco.service import DiscoveryService
@ -84,13 +81,13 @@ def setup(hass, config):
lock = threading.Lock()
def new_service_listener(service, info):
""" Called when a new service is found. """
"""Called when a new service is found."""
with lock:
logger.info("Found new service: %s %s", service, info)
component = SERVICE_HANDLERS.get(service)
# We do not know how to handle this service
# We do not know how to handle this service.
if not component:
return
@ -105,7 +102,7 @@ def setup(hass, config):
# pylint: disable=unused-argument
def start_discovery(event):
""" Start discovering. """
"""Start discovering."""
netdisco = DiscoveryService(SCAN_INTERVAL)
netdisco.add_listener(new_service_listener)
netdisco.start()