1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-10 14:26:56 +08:00

yml afe load

This commit is contained in:
Young
2021-02-17 05:17:18 +00:00
committed by you-n-g
parent 77830a546e
commit 50d5fcf61e
6 changed files with 7 additions and 7 deletions

View File

@@ -128,10 +128,10 @@ def parse_config(config):
# Check whether config is file
if os.path.exists(config):
with open(config, "r") as f:
return yaml.load(f, Loader=yaml.SafeLoader)
return yaml.safe_load(f)
# Check whether the str can be parsed
try:
return yaml.load(config)
return yaml.safe_load(config)
except BaseException:
raise ValueError("cannot parse config!")