Module refinery.units.formats.archive.xtace

Expand source code Browse git
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from . import ArchiveUnit
from ....lib.thirdparty import acefile
from ....lib.structures import MemoryFile


class xtace(ArchiveUnit):
    """
    Extract files from an ACE archive.
    """
    def unpack(self, data):
        ace = acefile.open(MemoryFile(data, read_as_bytes=True))
        for member in ace.getmembers():
            member: acefile.AceMember
            comment = {} if not member.comment else {'comment': member.comment}
            yield self._pack(
                member.filename,
                member.datetime,
                lambda a=ace, m=member: a.read(m, pwd=self.args.pwd),
                **comment
            )

Classes

class xtace (*paths, list=False, join_path=False, drop_path=False, path=b'path', date=b'date', pwd=b'')

Extract files from an ACE archive.

Expand source code Browse git
class xtace(ArchiveUnit):
    """
    Extract files from an ACE archive.
    """
    def unpack(self, data):
        ace = acefile.open(MemoryFile(data, read_as_bytes=True))
        for member in ace.getmembers():
            member: acefile.AceMember
            comment = {} if not member.comment else {'comment': member.comment}
            yield self._pack(
                member.filename,
                member.datetime,
                lambda a=ace, m=member: a.read(m, pwd=self.args.pwd),
                **comment
            )

Ancestors

Methods

def unpack(self, data)
Expand source code Browse git
def unpack(self, data):
    ace = acefile.open(MemoryFile(data, read_as_bytes=True))
    for member in ace.getmembers():
        member: acefile.AceMember
        comment = {} if not member.comment else {'comment': member.comment}
        yield self._pack(
            member.filename,
            member.datetime,
            lambda a=ace, m=member: a.read(m, pwd=self.args.pwd),
            **comment
        )

Inherited members