fix: use ruamel instead of yaml

This commit is contained in:
uccu 2022-05-17 00:53:29 +08:00
parent 2f274ac002
commit d53d0a77cf

View file

@ -1,7 +1,7 @@
from re import S
from compose_viz.compose import Compose
from compose_viz.compose import Service
import yaml
from ruamel.yaml import YAML
class Parser:
@ -13,9 +13,10 @@ class Parser:
# load the yaml file
with open(file_path, "r") as f:
try:
yaml_data = yaml.safe_load(f)
except yaml.YAMLError as exc:
raise yaml.YAMLError
yaml = YAML()
yaml_data = yaml.load(f)
except YAML.YAMLError as exc:
raise YAML.YAMLError
# validate the yaml file
if not yaml_data:
print("Error: empty yaml file")