transparentunzip.py 文件源码

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

项目:hgvm-builder 作者: BD2KGenomics 项目源码 文件源码
def __init__(self, stream):
        """
        Encapsulate the given stream in an unzipper.
        """

        # Keep the stream
        self.stream = stream

        # Make a decompressor with the accept a gzip header flag.
        # See <http://stackoverflow.com/a/22311297/402891>.
        # Will get None'd out after we're done decompressing and it is flushed.
        self.decompressor = zlib.decompressobj(zlib.MAX_WBITS + 16)

        # Are we really compressed? This gets set to True if we successfully
        # read the first block, and False if we failed to read the first block.
        # If it's False, there's no need to try to decompress any more blocks.
        self.header_read = None

        # We need to do lines ourselves, so we need to keep a buffer
        self.buffer = ""

        # Track out throughput
        self.compressed_bytes = 0
        self.uncompressed_bytes = 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号