rpm.py 文件源码

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

项目:crypto-detector 作者: Wind-River 项目源码 文件源码
def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9):
        """Open bzip2 compressed cpio archive name for reading or writing.
           Appending is not allowed.
        """
        if len(mode) > 1 or mode not in "rw":
            raise ValueError("mode must be 'r' or 'w'.")

        try:
            import bz2
        except ImportError:
            raise CompressionError("bz2 module is not available")

        if fileobj is not None:
            fileobj = _BZ2Proxy(fileobj, mode)
        else:
            fileobj = bz2.BZ2File(name, mode, compresslevel=compresslevel)

        try:
            t = cls.cpioopen(name, mode, fileobj)
        except IOError:
            raise ReadError("not a bzip2 file")
        t._extfileobj = False
        return t
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号