1 6
import json
2 6
from typing import Dict, List, Optional
3

4 6
from tomodachi.helpers.dict import merge_dicts
5

6

7 6
def parse_config_files(config_files: List[str]) -> Optional[Dict]:
8 6
    if not config_files:
9 6
        return None
10 6
    if isinstance(config_files, str):
11 0
        config_files = [config_files]
12

13 6
    configuration = {}  # type: Dict
14

15 6
    for config_file in config_files:
16 6
        with open(config_file) as f:
17 6
            data = f.read()
18 6
            json_data = json.loads(data)
19

20 6
            configuration = merge_dicts(configuration, json_data)
21

22 6
    return configuration

Read our documentation on viewing source code .

Loading