当前位置: 首页>>代码示例>>Python>>正文


Python lzma.decompress方法代码示例

本文整理汇总了Python中lzma.decompress方法的典型用法代码示例。如果您正苦于以下问题:Python lzma.decompress方法的具体用法?Python lzma.decompress怎么用?Python lzma.decompress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lzma的用法示例。


在下文中一共展示了lzma.decompress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DecompressBrotli

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def DecompressBrotli(string):
    """
    DecompressBrotli(string) -> str
    Returns the original form of the given string compressed \
using Google's brotli compression method., passed without delimiters.

    """
    number = 0
    for character in string:
        ordinal = OrdinalLookup.get(character, ord(character))
        number = number * 255 + ordinal - (ordinal > gap)
    compressed = []
    while number > 1:
        compressed = [number % 256] + compressed
        number //= 256
    return brotli.decompress(bytes(compressed)).decode("ascii") 
开发者ID:somebody1234,项目名称:Charcoal,代码行数:18,代码来源:compression.py

示例2: DecompressLZMA

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def DecompressLZMA(string):
    """
    DecompressBrotli(string) -> str
    Returns the original form of the given string compressed \
using Google's brotli compression method., passed without delimiters.

    """
    number = 0
    for character in string:
        ordinal = OrdinalLookup.get(character, ord(character))
        number = number * 255 + ordinal - (ordinal > gap)
    compressed = []
    while number > 1:
        compressed = [number % 256] + compressed
        number //= 256
    return lzma.decompress(
        bytes(compressed),
        format=lzma.FORMAT_RAW,
        filters=[{'id': lzma.FILTER_LZMA2, 'preset': 9 | lzma.PRESET_EXTREME}]
    ).decode("ascii") 
开发者ID:somebody1234,项目名称:Charcoal,代码行数:22,代码来源:compression.py

示例3: __init__

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def __init__(self, file_or_filenames):
        self._f = MultiFileReader(file_or_filenames)

        try:
            self._header = read_header(self._f)
            if (self._f.size != self._header.size):
                raise IncorrectFileSize(
                    'File size should be {0}, {1} bytes found'
                    .format(self._header.size, self._f.size))
        except FileFormatException:
            self._f.close()
            raise

        self._refs = RefList(self._f,
                             self._header.encoding,
                             offset=self._header.refs_offset)

        self._g = MultiFileReader(file_or_filenames)
        self._store = Store(self._g,
                            self._header.store_offset,
                            COMPRESSIONS[self._header.compression].decompress,
                            self._header.content_types) 
开发者ID:itkach,项目名称:slob,代码行数:24,代码来源:slob.py

示例4: get

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def get(self, step_id: str):
        try:
            cur = self.conn.cursor()
            cur.execute('SELECT signature FROM steps WHERE step_id=? ',
                        (step_id,))
            res = cur.fetchone()
        except sqlite3.DatabaseError as e:
            env.logger.warning(
                f'Failed to get step signature for step {step_id}: {e}')
            return None
        if res:
            try:
                return pickle.loads(lzma.decompress(res[0]))
            except Exception as e:
                env.logger.warning(
                    f'Failed to load signature for step {step_id}: {e}')
                return None
        else:
            return None 
开发者ID:vatlab,项目名称:sos,代码行数:21,代码来源:signatures.py

示例5: download_latest_frida

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def download_latest_frida(device: Device):
    latest_release = requests.get(FRIDA_LATEST_RELEASE_URL).json()
    arch = get_architecture(device)

    for asset in latest_release['assets']:
        release_name = asset['name']
        if "server" in release_name and "android-{}.xz".format(arch) in release_name:
            eprint("⚡ Downloading {}...".format(release_name))
            xz_file = requests.get(asset['browser_download_url'])

            eprint("⚡ Extracting {}...".format(release_name))
            server_binary = lzma.decompress(xz_file.content)

            eprint("⚡ Writing {}...".format(release_name))
            with open(release_name[:-3], "wb") as f:  # remove extension
                f.write(server_binary)
            return release_name[:-3] 
开发者ID:Hamz-a,项目名称:frida-android-helper,代码行数:19,代码来源:server.py

示例6: extract_cpio

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def extract_cpio(reader):
    data = reader.read()
    decompress = None
    idx = data.find(XZ_MAGIC)
    if idx != -1:
        decompress = xz_decompress
        pos = idx
    idx = data.find(GZIP_MAGIC)
    if idx != -1 and decompress is None:
        decompress = gzip_decompress
        pos = idx
    if decompress is None:
        return None
    data = decompress(data[pos:])
    return data 
开发者ID:milisarge,项目名称:malfs-milis,代码行数:17,代码来源:rpm2cpio.py

示例7: bz2_pack

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def bz2_pack(source):
    """
    Returns `source` as bzip2-compressed Python script
    """
    import bz2
    compressed = base64.b64encode(bz2.compress(
        source.encode('utf-8'))).decode('utf-8')
    return f'import bz2,base64;exec(bz2.decompress(base64.b64decode("{compressed}")))' 
开发者ID:PyObfx,项目名称:PyObfx,代码行数:10,代码来源:packer.py

示例8: gz_pack

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def gz_pack(source):
    """
    Returns `source` as gzip-compressed Python script
    """
    import zlib
    compressed = base64.b64encode(zlib.compress(source.encode('utf-8'))).decode('utf-8')
    return f'import zlib,base64;exec(zlib.decompress(base64.b64decode("{compressed}")))' 
开发者ID:PyObfx,项目名称:PyObfx,代码行数:9,代码来源:packer.py

示例9: lzma_pack

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def lzma_pack(source):
    """
    Returns `source` as lzma-compressed Python script
    """
    import lzma
    compressed = base64.b64encode(lzma.compress(source.encode('utf-8'))).decode('utf-8')
    return f'import lzma,base64;exec(lzma.decompress(base64.b64decode("{compressed}")))' 
开发者ID:PyObfx,项目名称:PyObfx,代码行数:9,代码来源:packer.py

示例10: download_list

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def download_list(url='http://verteiler5.mediathekview.de/Filmliste-akt.xz', path='filme.json', tmp_path='filme.xz'):        
    
    print('download {}'.format(url))

    with urllib.request.urlopen(url) as response, \
        open(tmp_path, 'wb') as tmp_fp, \
        open(path, 'wb') as fp:

        data = response.read()
        tmp_fp.write(data)
        data = lzma.decompress(data)
        fp.write(data) 
开发者ID:hcmlab,项目名称:vadnet,代码行数:14,代码来源:playlist.py

示例11: decode

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def decode(self, buf, out=None):

            # normalise inputs
            buf = ensure_contiguous_ndarray(buf)
            if out is not None:
                out = ensure_contiguous_ndarray(out)

            # do decompression
            dec = _lzma.decompress(buf, format=self.format, filters=self.filters)

            # handle destination
            return ndarray_copy(dec, out) 
开发者ID:zarr-developers,项目名称:numcodecs,代码行数:14,代码来源:lzma.py

示例12: xz_decompress

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def xz_decompress(data):
    if HAS_LZMA_MODULE:
        return lzma.decompress(data)
    unxz = subprocess.Popen(['unxz'],
                            stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE)
    data = unxz.communicate(input=data)[0]
    return data 
开发者ID:milisarge,项目名称:malfs-milis,代码行数:10,代码来源:rpm2cpio.py

示例13: decompress

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def decompress(data, outlen):
    lzma_header = struct.pack('<BIQ', PROPERTIES, DICT_SIZE, outlen)
    lzma_data = lzma_header + data
    decompressed = lzma.decompress(lzma_data)
    return decompressed 
开发者ID:sviehb,项目名称:jefferson,代码行数:7,代码来源:jffs2_lzma.py

示例14: _zlib

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def _zlib(f, size):
    data = f.read(size)
    return zlib.decompress(data, -zlib.MAX_WBITS) 
开发者ID:isra17,项目名称:nrs,代码行数:5,代码来源:fileform.py

示例15: _bzip2

# 需要导入模块: import lzma [as 别名]
# 或者: from lzma import decompress [as 别名]
def _bzip2(f, size):
    from nrs.ext import bzlib
    data = f.read(size)
    return bytes(bzlib.decompress(data)) 
开发者ID:isra17,项目名称:nrs,代码行数:6,代码来源:fileform.py


注:本文中的lzma.decompress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。