a | b/medacy/tools/read_config.py | ||
---|---|---|---|
1 | import json |
||
2 | import os |
||
3 | |||
4 | from medacy import __file__ as medacy_root |
||
5 | |||
6 | |||
7 | _config_path = os.path.join(os.path.dirname(medacy_root), "../config.json") |
||
8 | assert os.path.isfile(_config_path) |
||
9 | |||
10 | |||
11 | def read_config(key): |
||
12 | """ |
||
13 | Reads medaCy's config file and returns the value at a given key |
||
14 | :param key: the desired key |
||
15 | :return: the value at that key |
||
16 | """ |
||
17 | with open(_config_path, "rb") as f: |
||
18 | config = json.load(f) |
||
19 | |||
20 | return config[key] |
||
21 |