__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:indexed_gzip 作者: pauldmccarthy 项目源码 文件源码
def check_data_valid(data, startval, endval=None):
    if endval is None:
        endval = len(data)

    chunksize = 10000000

    startval = int(startval)
    endval   = int(endval)

    offsets = np.arange(0, len(data), chunksize)
    args = []
    result = True
    for offset in offsets:
        s      = startval + offset
        e      = min(s + chunksize, endval)
        nelems = e - s
        test_chunk = data[offset:offset + nelems]
        args.append((s, e, test_chunk))

    pool = mp.Pool()
    result = all(pool.map(_check_chunk, args))
    pool.terminate()

    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号