rpm.py 文件源码

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

项目:crypto-detector 作者: Wind-River 项目源码 文件源码
def xzopen(cls, name, mode="r", fileobj=None, compresslevel=6):
        """
        Open xz 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 lzma
        except ImportError:
            raise CompressionError("lzma module is not available")

        if fileobj is not None:
            fileobj = _XZProxy(fileobj, mode)
        else:
            fileobj = lzma.LZMAFile(name, mode) # options={'level': compresslevel, 'dict_size': 20 }

        try:
            t = cls.cpioopen(name, mode, fileobj)
        except IOError:
            raise ReadError("not a XZ file")
        t._extfileobj = False
        return t

    # All *open() methods are registered here.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号