projects/oscope/common/merge_json.py
def merge_with_quit_on_collision(*args):
    '''
    The idea is not to write performant code, but correct code (Which I couldn't find)
    '''
    args, = args
    final = {}
    for f in args:
        with open(f, 'r') as json_file:
            json_dict = json.load(json_file)
            if type(json_dict) is not dict:
                exit('file {} isnt a json dictionary'.fmt(f))
            for k in json_dict:
                if k in final:
                    exit('key {} in file {} already exists in a previously merged file'.fmt(k, f))
                else:
                    final[k] = json_dict[k]
    return final

    The idea is not to write performant code, but correct code (Which I couldn't find)
    
The idea is not to write performant code, but correct code (Which I couldn't find)
The idea is not to write performant code but correct code ( Which I couldn ' t find )
def merge_with_quit_on_collision(*args):
    args, = args
    final = {}
    for f in args:
        with open(f, 'r') as json_file:
            json_dict = json.load(json_file)
            if type(json_dict) is not dict:
                exit('file {} isnt a json dictionary'.fmt(f))
            for k in json_dict:
                if k in final:
                    exit('key {} in file {} already exists in a previously merged file'.fmt(k, f))
                else:
                    final[k] = json_dict[k]
    return final
def merge_with_quit_on_collision ( * args ) : args , = args final = { } for f in args : with open ( f , 'r' ) as json_file : json_dict = json . load ( json_file ) if type ( json_dict ) is not dict : exit ( 'file {} isnt a json dictionary' . fmt ( f ) ) for k in json_dict : if k in final : exit ( 'key {} in file {} already exists in a previously merged file' . fmt ( k , f ) ) else : final [ k ] = json_dict [ k ] return final
The idea is not to write performant code, but correct code (Which I couldn't find)
The idea is not to write performant code but correct code ( Which I couldn ' t find )
'''
    The idea is not to write performant code, but correct code (Which I couldn't find)
    '''