cli.py 文件源码

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

项目:pysnappy 作者: aeroevan 项目源码 文件源码
def run(args):
    _profile = False
    if _profile:
        import pstats, cProfile
    fh_in = open(args.file, "rb")
    fh_out = open(args.output, "wb")
    if args.compress:
        if _profile:
            cProfile.runctx("stream_compress(fh_in, fh_out, args.framing, args.bytesize)", globals(), locals(), "Profile.prof")
        else:
            stream_compress(fh_in, fh_out, args.framing, args.bytesize)
    else:
        if _profile:
            cProfile.runctx("stream_decompress(fh_in, fh_out, args.framing, args.bytesize)", globals(), locals(), "Profile.prof")
        else:
            stream_decompress(fh_in, fh_out, args.framing, args.bytesize)

    if _profile:
        s = pstats.Stats("Profile.prof")
        s.strip_dirs().sort_stats("time").print_stats()

    fh_in.close()
    fh_out.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号