(file, proc_func)
return rows
A multi-processing wrapper for loading SQuAD data file.
A multi-processing wrapper for loading SQuAD data file.
A multi - processing wrapper for loading SQuAD data file .
def flatten_json(file, proc_func):
    '''A multi-processing wrapper for loading SQuAD data file.'''
    with open(file) as f:
        data = json.load(f)['data']
    with ProcessPoolExecutor(max_workers=args.threads) as executor:
        rows = executor.map(proc_func, data)
    rows = sum(rows, [])
    return rows
def flatten_json ( file , proc_func ) : with open ( file ) as f : data = json . load ( f ) [ 'data' ] with ProcessPoolExecutor ( max_workers = args . threads ) as executor : rows = executor . map ( proc_func , data ) rows = sum ( rows , [ ] ) return rows