def mergeIntoSingleObject(guessedObjectArray):
    keys = reduce(lambda a, e: a.union(set(e.keys())), guessedObjectArray, set())
    merged = {}
    for obj in guessedObjectArray:
        for key in keys:
            value = obj.get(key, set([ST_NONE]))
            if type(value) == dict:
                merged[key] = value
            elif type(value) == list:
                merged[key] = mergeIntoSingleObject(value)
            elif key in merged:
                merged[key] = merged[key].union(value)
            else:
                merged[key] = value
    return [merged]
dataset/ETHPy150Open safx/swift-idl/json2idl.py/mergeIntoSingleObject/original