fix: use ruamel instead of yaml
This commit is contained in:
parent
2f274ac002
commit
d53d0a77cf
1 changed files with 5 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
from re import S
|
from re import S
|
||||||
from compose_viz.compose import Compose
|
from compose_viz.compose import Compose
|
||||||
from compose_viz.compose import Service
|
from compose_viz.compose import Service
|
||||||
import yaml
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
|
|
||||||
class Parser:
|
class Parser:
|
||||||
|
@ -13,9 +13,10 @@ class Parser:
|
||||||
# load the yaml file
|
# load the yaml file
|
||||||
with open(file_path, "r") as f:
|
with open(file_path, "r") as f:
|
||||||
try:
|
try:
|
||||||
yaml_data = yaml.safe_load(f)
|
yaml = YAML()
|
||||||
except yaml.YAMLError as exc:
|
yaml_data = yaml.load(f)
|
||||||
raise yaml.YAMLError
|
except YAML.YAMLError as exc:
|
||||||
|
raise YAML.YAMLError
|
||||||
# validate the yaml file
|
# validate the yaml file
|
||||||
if not yaml_data:
|
if not yaml_data:
|
||||||
print("Error: empty yaml file")
|
print("Error: empty yaml file")
|
||||||
|
|
Loading…
Reference in a new issue