Extract all the files inside the MPQ archive in memory.
359477
def extract(self):
        """"""
        if self.files:
            return dict((f, self.read_file(f)) for f in self.files)
        else:
            raise RuntimeError("Can't extract whole archive without listfile.")
1290188
def extract_archive(archive, verbosity=0, outdir=None, program=None, interactive=True):
    """"""
    util.check_existing_filename(archive)
    if verbosity >= 0:
        util.log_info("Extracting %s ..." % archive)
    return _extract_archive(archive, verbosity=verbosity, interactive=interactive, outdir=outdir, program=program)
977915
def extract_zip(zip_path, target_folder):
    
    with zipfile.ZipFile(zip_path) as archive:
        archive.extractall(target_folder)
162095
def archive_context(filename):
    
    tmpdir = tempfile.mkdtemp()
    log.warn('Extracting in %s', tmpdir)
    old_wd = os.getcwd()
    try:
        os.chdir(tmpdir)
        with ContextualZipFile(filename) as archive:
            archive.extractall()

        # going in the directory
        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
        os.chdir(subdir)
        log.warn('Now working in %s', subdir)
        yield

    finally:
        os.chdir(old_wd)
        shutil.rmtree(tmpdir)
550532
def extract(self, destination):
        """"""
        with tarfile.open(self.archive, 'r:') as tar:
            tar.extractall(path=destination)
1155498
function(archive, env) {

    // The extraction command
    var extract = [
      'tar',
      '-zxvf',
      archive,
      '-C',
      '/media',
      '&&',
      'mv',
      '/media/files_' + env + '/*',
      '/media'
    ];

    // Extract and remove
    return run('usermap', extract)
    .then(function() {
      return run('rm', ['-rf', '/media/files_' + env]);
    })
    .then(function() {
      return run('rm', ['-f', archive]);
    });

  }
820593
def files(
            self):
        
        relatedFilesResultsList = []
        relatedFilesResultsList[:] = [dict(l)
                                      for l in self.relatedFilesResultsList]
        return relatedFilesResultsList
519934
def find_all_files(self):
		
		files = self.find_files()
		subrepo_files = (
			posixpath.join(subrepo.location, filename)
			for subrepo in self.subrepos()
			for filename in subrepo.find_files()
		)
		return itertools.chain(files, subrepo_files)
1280103
def __populate_archive_files(self):
        """"""
        self.archive_files = []
        for _ptr in _bfd.archive_list_files(self._ptr):
            try:
                self.archive_files.append(Bfd(_ptr))
            except BfdException, err:
                #print "Error populating archive file list : %s" % err
                #print_exc()
                pass
404652
def _get_files(self) -> Iterator[str]:
        
        path = os.path.abspath(self.path)
        if os.path.isfile(path):
            path = os.path.dirname(path)

        for path in self._get_parents(path):
            for file_path in self._get_files_from_dir(path):
                yield file_path
1229938
def download_memory_dump(self, sha256, environment_id, dest_dir):
        """"""

        dest_path = os.path.join(dest_dir, 'memory.zip')
        if self.download(sha256, environment_id, VXSTREAM_DOWNLOAD_MEMORY, dest_path) is None:
            return None

        with open(dest_path, 'rb') as fp:
            blob = fp.read(1024)
            if b'No dump files available' in blob:
                logging.debug("memory dump not available for {} env {}".format(sha256, environment_id))
                return None

        logging.debug("extracting memory dump {} into {}".format(dest_path, dest_dir))
        p = Popen(['7z', 'x', '-y', '-o{}'.format(dest_dir), dest_path], stdout=PIPE, stderr=PIPE)
        stdout, stderr = p.communicate()

        file_list = []
        for file_path in [os.path.join(dest_dir, f) for f in os.listdir(dest_dir) if f != "memory.zip"]:
            file_list.append(file_path)

        # concatenate all these files into one file
        dest_path = os.path.join(dest_dir, 'memory.combined.mdmp')
        for file_path in file_list:
            logging.debug("concatenating {}".format(file_path))
            with open(file_path, 'rb') as input_fp:
                with open(dest_path, 'ab') as output_fp:
                    while True:
                        data = input_fp.read(io.DEFAULT_BUFFER_SIZE)
                        if data == b'':
                            break

                        output_fp.write(data)

        return file_list, dest_path
613044
def _explore_storage(self):
        """"""
        path = ''
        dirs = [path]
        while dirs:
            path = dirs.pop()
            subdirs, files = self.media_storage.listdir(path)
            for media_filename in files:
                yield os.path.join(path, media_filename)
            dirs.extend([os.path.join(path, subdir) for subdir in subdirs])
1295400
def do_extract(marfile, destdir, decompress):
    """"""
    with open(marfile, 'rb') as f:
        with MarReader(f) as m:
            m.extract(str(destdir), decompress=decompress)
687041
def extract_gzip (archive, compression, cmd, verbosity, interactive, outdir):
    """"""
    targetname = util.get_single_outfile(outdir, archive)
    try:
        with gzip.GzipFile(archive) as gzipfile:
            with open(targetname, 'wb') as targetfile:
                data = gzipfile.read(READ_SIZE_BYTES)
                while data:
                    targetfile.write(data)
                    data = gzipfile.read(READ_SIZE_BYTES)
    except Exception as err:
        msg = "error extracting %s to %s: %s" % (archive, targetname, err)
        raise util.PatoolError(msg)
    return None
143668
def GetAllFiles(self):
    
    for filepath in self._files:
      yield filepath

    for dirpath in self._dirs:
      for filepath in ArtifactRegistrySources._GetDirYamlFiles(dirpath):
        if filepath in self._files:
          continue
        yield filepath
404420
private void listArchive(Archive archive,
                               RelativeDirectory subdirectory,
                               Set<JavaFileObject.Kind> fileKinds,
                               boolean recurse,
                               ListBuffer<JavaFileObject> resultList) {
        // Get the files directly in the subdir
        List<String> files = archive.getFiles(subdirectory);
        if (files != null) {
            for (; !files.isEmpty(); files = files.tail) {
                String file = files.head;
                if (isValidFile(file, fileKinds)) {
                    resultList.append(archive.getFileObject(subdirectory, file));
                }
            }
        }
        if (recurse) {
            for (RelativeDirectory s: archive.getSubdirectories()) {
                if (subdirectory.contains(s)) {
                    // Because the archive map is a flat list of directories,
                    // the enclosing loop will pick up all child subdirectories.
                    // Therefore, there is no need to recurse deeper.
                    listArchive(archive, s, fileKinds, false, resultList);
                }
            }
        }
    }
405633
public void extract()
    {
        ExecutorService executor = Executors.newFixedThreadPool(this.extractorConfig.getThreadPoolSize());
        try
        {
            Map<Pair<RelatedFinder, Object>, List<MithraDataObject>> extract = extractData(executor);
            writeToFiles(executor, extract);
        }
        finally
        {
            executor.shutdown();
            try
            {
                executor.awaitTermination(extractorConfig.getTimeoutSeconds(), TimeUnit.SECONDS);
            }
            catch (InterruptedException e)
            {
                //
            }
        }
    }