File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 15
15
16
16
try :
17
17
import ruamel .yaml as yaml
18
+
19
+ yaml_load = yaml .YAML (typ = 'safe' , pure = True ).load
18
20
except ImportError :
19
21
try :
20
22
import yaml
23
+ yaml_load = yaml .safe_load
21
24
except ImportError :
22
25
yaml = None
23
26
@@ -417,11 +420,11 @@ def json(path: Path) -> Union[dict, list]:
417
420
418
421
@staticmethod
419
422
def yaml (path : Path ) -> Union [dict , list ]:
420
- if yaml is None :
421
- print ('Yaml parser is not installed. To parse yaml files PyYaml (or ruamel.yaml ) is required.' )
423
+ if yaml_load is None :
424
+ print ('Yaml parser is not installed. To parse yaml files ruamel.yaml (or PyYaml ) is required.' )
422
425
raise ImportError ('yaml' )
423
426
with path .open () as fp :
424
- return yaml . safe_load (fp )
427
+ return yaml_load (fp )
425
428
426
429
@staticmethod
427
430
def ini (path : Path ) -> dict :
You can’t perform that action at this time.
0 commit comments