Exemplo n.º 1
0
def merge_json_union(first, second, soft=False):
    with open(first, 'r+') as f_1:
        cfg_1 = json.loads(f_1.read())
        with open(second) as f_2:
            cfg_2 = json.loads(f_2.read())
            cfg_1 = settings.merge_dicts(cfg_1, cfg_2, soft)
        f_1.truncate(0)
        f_1.seek(0)
        f_1.write(json.dumps(cfg_1, indent=4, sort_keys=True))
Exemplo n.º 2
0
def merge_json_union(first, second, soft=False):
    with open(first, 'r+') as f_1:
        cfg_1 = json.loads(f_1.read())
        with open(second) as f_2:
            cfg_2 = json.loads(f_2.read())
            cfg_1 = settings.merge_dicts(cfg_1, cfg_2, soft)
        f_1.truncate(0)
        f_1.seek(0)
        f_1.write(json.dumps(cfg_1, indent=4, sort_keys=True))
Exemplo n.º 3
0
def merge_json_union(first_file: str, second_file: str,
                     soft: bool = False) -> None:
    with open(first_file, 'r+') as f_1:
        config_1 = json.loads(f_1.read())
        with open(second_file) as f_2:
            config_2 = json.loads(f_2.read())
            config_1 = settings.merge_dicts(config_1, config_2, soft)
        f_1.truncate(0)
        f_1.seek(0)
        f_1.write(json.dumps(config_1, indent=4, sort_keys=True))