diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 26dc2b977c6..6a0d6540688 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -48,7 +48,7 @@ def async_setup_component(hass: core.HomeAssistant, domain: str, config: Optional[Dict]=None) -> bool: """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: _LOGGER.debug('Component %s already set up.', domain) @@ -79,8 +79,7 @@ def _handle_requirements(hass: core.HomeAssistant, component, name: str) -> bool: """Install the requirements for a component. - Asyncio don't support file operation jet. - This method need to run in a executor. + This method needs to run in an executor. """ if hass.config.skip_pip or not hasattr(component, 'REQUIREMENTS'): return True @@ -539,7 +538,7 @@ def log_exception(ex, domain, config, hass): def async_log_exception(ex, domain, config, hass): """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) _PERSISTENT_VALIDATION.add(domain) diff --git a/homeassistant/config.py b/homeassistant/config.py index 0e2192b3152..bde0f648354 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -133,6 +133,7 @@ def create_default_config(config_dir, detect_location=True): """Create a default configuration file in given configuration directory. 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) 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): - """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) return config_path if os.path.isfile(config_path) else None 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) if not isinstance(conf_dict, dict): @@ -222,8 +229,7 @@ def load_yaml_config_file(config_path): def process_ha_config_upgrade(hass): """Upgrade config if necessary. - Asyncio don't support file operation jet. - This method need to run in a executor. + This method needs to run in an executor. """ version_path = hass.config.path(VERSION_FILE) diff --git a/homeassistant/loader.py b/homeassistant/loader.py index a19d835543d..dc68d3f1d46 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -42,8 +42,7 @@ _LOGGER = logging.getLogger(__name__) def prepare(hass: 'HomeAssistant'): """Prepare the loading of components. - Asyncio don't support file operation jet. - This method need to run in a executor. + This method needs to run in an executor. """ global PREPARED # pylint: disable=global-statement