Extract ruamel.yaml to util with secrets, lovelace ws decorators (#17958)

* Extract ruamel.yaml to util, ws decorators, secrets

* lint

* Extend SafeConstructor

Somehow my last commit is gone after rebase...

* lint

* Woof...

* Woof woof...

* Cleanup type hints

* Update homeassistant/scripts/check_config.py

* lint

* typing
This commit is contained in:
Bram Kragten
2018-10-31 13:49:54 +01:00
committed by Paulus Schoutsen
parent 1578187376
commit b763c0f902
10 changed files with 452 additions and 385 deletions

View File

@@ -30,7 +30,7 @@ _LOGGER = logging.getLogger(__name__)
MOCKS = {
'load': ("homeassistant.util.yaml.load_yaml", yaml.load_yaml),
'load*': ("homeassistant.config.load_yaml", yaml.load_yaml),
'secrets': ("homeassistant.util.yaml._secret_yaml", yaml._secret_yaml),
'secrets': ("homeassistant.util.yaml.secret_yaml", yaml.secret_yaml),
}
SILENCE = (
'homeassistant.scripts.check_config.yaml.clear_secret_cache',
@@ -198,7 +198,7 @@ def check(config_dir, secrets=False):
if secrets:
# Ensure !secrets point to the patched function
yaml.yaml.SafeLoader.add_constructor('!secret', yaml._secret_yaml)
yaml.yaml.SafeLoader.add_constructor('!secret', yaml.secret_yaml)
try:
hass = core.HomeAssistant()
@@ -223,7 +223,7 @@ def check(config_dir, secrets=False):
pat.stop()
if secrets:
# Ensure !secrets point to the original function
yaml.yaml.SafeLoader.add_constructor('!secret', yaml._secret_yaml)
yaml.yaml.SafeLoader.add_constructor('!secret', yaml.secret_yaml)
bootstrap.clear_secret_cache()
return res