The source project of this merge request has been removed.
Allow empty YAML files
If a YAML file is empty, the error message is unhelpful:
File "/data/workspace/Repositories/pt-modelling/pygwinc/params/loader.py", line 14, in sql_params
params.update(Struct.from_file(THIS_DIR / "sql.yaml"))
File "/data/workspace/Repositories/pygwinc/gwinc/struct.py", line 365, in from_file
return cls.from_yaml(f)
File "/data/workspace/Repositories/pygwinc/gwinc/struct.py", line 299, in from_yaml
return cls(d)
File "/data/workspace/Repositories/pygwinc/gwinc/struct.py", line 89, in __init__
self.update(dict(*args, **kwargs))
TypeError: 'NoneType' object is not iterable
In the above file, sql.yaml
is empty so yaml.load
returns None
. I think the correct behaviour here would be to return an empty dict, but whatever. This fixes it.