Skip to content
Snippets Groups Projects
Commit 8157f820 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

struct: fix yaml loader

and use in load_struct
parent 9789e84a
No related branches found
No related tags found
1 merge request!63Struct improvements
...@@ -276,7 +276,7 @@ class Struct(object): ...@@ -276,7 +276,7 @@ class Struct(object):
"""Create Struct from YAML string. """Create Struct from YAML string.
""" """
d = yaml.load(y) d = yaml.load(y, Loader=yaml_loader)
return cls.from_dict(d) return cls.from_dict(d)
...@@ -320,8 +320,7 @@ class Struct(object): ...@@ -320,8 +320,7 @@ class Struct(object):
with open(path, 'r') as f: with open(path, 'r') as f:
if ext in ['.yaml', '.yml']: if ext in ['.yaml', '.yml']:
d = yaml.load(f, Loader=yaml_loader) return cls.from_yaml(f)
return cls.from_dict(d)
elif ext == '.mat': elif ext == '.mat':
s = loadmat(f, squeeze_me=True, struct_as_record=False) s = loadmat(f, squeeze_me=True, struct_as_record=False)
return cls.from_matstruct(s) return cls.from_matstruct(s)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment