Total Complexity | 2 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import os |
||
2 | |||
3 | import yaml |
||
4 | |||
5 | import egon |
||
6 | |||
7 | |||
8 | def datasets(config_file=None): |
||
9 | """Return dataset configuration. |
||
10 | |||
11 | Parameters |
||
12 | ---------- |
||
13 | config_file : str, optional |
||
14 | Path of the dataset configuration file in YAML format. If not |
||
15 | supplied, a default configuration shipped with this package is |
||
16 | used. |
||
17 | |||
18 | Returns |
||
19 | ------- |
||
20 | dict |
||
21 | A nested dictionary containing the configuration as parsed from |
||
22 | the supplied file, or the default configuration if no file was |
||
23 | given. |
||
24 | |||
25 | """ |
||
26 | if not config_file: |
||
27 | package_path = egon.data.__path__[0] |
||
28 | config_file = os.path.join(package_path, "datasets.yml") |
||
29 | |||
30 | return yaml.load(open(config_file), Loader=yaml.SafeLoader) |
||
31 |