Fix PEP257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-08 00:06:04 +01:00
1 parent 4f536ac63d
commit 897b5c668f
8 files changed
+145 -141

No files matched your search

+14 -16
View File
@@ -34,8 +34,7 @@ ERROR_LOG_FILENAME = 'home-assistant.log'
def setup_component(hass, domain, config=None):
""" Setup a component and all its dependencies. """
"""Setup a component and all its dependencies."""
if domain in hass.config.components:
return True
@@ -58,7 +57,7 @@ def setup_component(hass, domain, config=None):
def _handle_requirements(hass, component, name):
""" Installs requirements for component. """
"""Install the requirements for a component."""
if hass.config.skip_pip or not hasattr(component, 'REQUIREMENTS'):
return True
@@ -126,7 +125,7 @@ def _setup_component(hass, domain, config):
def prepare_setup_platform(hass, config, domain, platform_name):
""" Loads a platform and makes sure dependencies are setup. """
"""Load a platform and makes sure dependencies are setup."""
_ensure_loader_prepared(hass)
platform_path = PLATFORM_FORMAT.format(domain, platform_name)
@@ -158,7 +157,7 @@ def prepare_setup_platform(hass, config, domain, platform_name):
def mount_local_lib_path(config_dir):
""" Add local library to Python Path """
"""Add local library to Python Path."""
sys.path.insert(0, os.path.join(config_dir, 'lib'))
@@ -166,8 +165,7 @@ def mount_local_lib_path(config_dir):
def from_config_dict(config, hass=None, config_dir=None, enable_log=True,
verbose=False, daemon=False, skip_pip=False,
log_rotate_days=None):
"""
Tries to configure Home Assistant from a config dict.
"""Try to configure Home Assistant from a config dict.
Dynamically loads required components and its dependencies.
"""
@@ -209,7 +207,7 @@ def from_config_dict(config, hass=None, config_dir=None, enable_log=True,
_LOGGER.info('Home Assistant core initialized')
# give event decorators access to HASS
# Give event decorators access to HASS
event_decorators.HASS = hass
service.HASS = hass
@@ -222,9 +220,9 @@ def from_config_dict(config, hass=None, config_dir=None, enable_log=True,
def from_config_file(config_path, hass=None, verbose=False, daemon=False,
skip_pip=True, log_rotate_days=None):
"""
Reads the configuration file and tries to start all the required
functionality. Will add functionality to 'hass' parameter if given,
"""Read the configuration file and try to start all the functionality.
Will add functionality to 'hass' parameter if given,
instantiates a new Home Assistant object if 'hass' is not given.
"""
if hass is None:
@@ -244,7 +242,7 @@ def from_config_file(config_path, hass=None, verbose=False, daemon=False,
def enable_logging(hass, verbose=False, daemon=False, log_rotate_days=None):
""" Setup the logging for home assistant. """
"""Setup the logging."""
if not daemon:
logging.basicConfig(level=logging.INFO)
fmt = ("%(log_color)s%(asctime)s %(levelname)s (%(threadName)s) "
@@ -297,7 +295,7 @@ def enable_logging(hass, verbose=False, daemon=False, log_rotate_days=None):
def process_ha_config_upgrade(hass):
""" Upgrade config if necessary. """
"""Upgrade config if necessary."""
version_path = hass.config.path('.HA_VERSION')
try:
@@ -322,11 +320,11 @@ def process_ha_config_upgrade(hass):
def process_ha_core_config(hass, config):
""" Processes the [homeassistant] section from the config. """
"""Process the [homeassistant] section from the config."""
hac = hass.config
def set_time_zone(time_zone_str):
""" Helper method to set time zone in HA. """
"""Helper method to set time zone."""
if time_zone_str is None:
return
@@ -397,6 +395,6 @@ def process_ha_core_config(hass, config):
def _ensure_loader_prepared(hass):
""" Ensure Home Assistant loader is prepared. """
"""Ensure Home Assistant loader is prepared."""
if not loader.PREPARED:
loader.prepare(hass)