fix some comments spell (#4082)

* fix some comments

* fix in an executor

* address paulus comments
This commit is contained in:
Pascal Vizeli 2016-10-28 21:26:52 +02:00 committed by GitHub
parent 65bd7d2326
commit 825ee3612d
3 changed files with 14 additions and 10 deletions

View File

@ -48,7 +48,7 @@ def async_setup_component(hass: core.HomeAssistant, domain: str,
config: Optional[Dict]=None) -> bool: config: Optional[Dict]=None) -> bool:
"""Setup a component and all its dependencies. """Setup a component and all its dependencies.
This method need to run in a executor. This method is a coroutine.
""" """
if domain in hass.config.components: if domain in hass.config.components:
_LOGGER.debug('Component %s already set up.', domain) _LOGGER.debug('Component %s already set up.', domain)
@ -79,8 +79,7 @@ def _handle_requirements(hass: core.HomeAssistant, component,
name: str) -> bool: name: str) -> bool:
"""Install the requirements for a component. """Install the requirements for a component.
Asyncio don't support file operation jet. This method needs to run in an executor.
This method need to run in a executor.
""" """
if hass.config.skip_pip or not hasattr(component, 'REQUIREMENTS'): if hass.config.skip_pip or not hasattr(component, 'REQUIREMENTS'):
return True return True
@ -539,7 +538,7 @@ def log_exception(ex, domain, config, hass):
def async_log_exception(ex, domain, config, hass): def async_log_exception(ex, domain, config, hass):
"""Generate log exception for config validation. """Generate log exception for config validation.
Need to run in a async loop. This method must be run in the event loop.
""" """
message = 'Invalid config for [{}]: '.format(domain) message = 'Invalid config for [{}]: '.format(domain)
_PERSISTENT_VALIDATION.add(domain) _PERSISTENT_VALIDATION.add(domain)

View File

@ -133,6 +133,7 @@ def create_default_config(config_dir, detect_location=True):
"""Create a default configuration file in given configuration directory. """Create a default configuration file in given configuration directory.
Return path to new config file if success, None if failed. Return path to new config file if success, None if failed.
This method needs to run in an executor.
""" """
config_path = os.path.join(config_dir, YAML_CONFIG_FILE) config_path = os.path.join(config_dir, YAML_CONFIG_FILE)
version_path = os.path.join(config_dir, VERSION_FILE) version_path = os.path.join(config_dir, VERSION_FILE)
@ -200,14 +201,20 @@ def async_hass_config_yaml(hass):
def find_config_file(config_dir): def find_config_file(config_dir):
"""Look in given directory for supported configuration files.""" """Look in given directory for supported configuration files.
Async friendly.
"""
config_path = os.path.join(config_dir, YAML_CONFIG_FILE) config_path = os.path.join(config_dir, YAML_CONFIG_FILE)
return config_path if os.path.isfile(config_path) else None return config_path if os.path.isfile(config_path) else None
def load_yaml_config_file(config_path): def load_yaml_config_file(config_path):
"""Parse a YAML configuration file.""" """Parse a YAML configuration file.
This method needs to run in an executor.
"""
conf_dict = load_yaml(config_path) conf_dict = load_yaml(config_path)
if not isinstance(conf_dict, dict): if not isinstance(conf_dict, dict):
@ -222,8 +229,7 @@ def load_yaml_config_file(config_path):
def process_ha_config_upgrade(hass): def process_ha_config_upgrade(hass):
"""Upgrade config if necessary. """Upgrade config if necessary.
Asyncio don't support file operation jet. This method needs to run in an executor.
This method need to run in a executor.
""" """
version_path = hass.config.path(VERSION_FILE) version_path = hass.config.path(VERSION_FILE)

View File

@ -42,8 +42,7 @@ _LOGGER = logging.getLogger(__name__)
def prepare(hass: 'HomeAssistant'): def prepare(hass: 'HomeAssistant'):
"""Prepare the loading of components. """Prepare the loading of components.
Asyncio don't support file operation jet. This method needs to run in an executor.
This method need to run in a executor.
""" """
global PREPARED # pylint: disable=global-statement global PREPARED # pylint: disable=global-statement