Returns a map from an archive to its required archives
484926
Map<Archive, Set<Archive>> dependences() {
        Map<Archive, Set<Archive>> map = new HashMap<>();
        parsedArchives.values().stream()
            .flatMap(Deque::stream)
            .filter(a -> !a.isEmpty())
            .forEach(source -> {
                Set<Archive> deps = getDependences(source).collect(toSet());
                if (!deps.isEmpty()) {
                    map.put(source, deps);
                }
        });
        return map;
    }
930255
def get_archive_file_list(archive_filename):
    
    if archive_filename.endswith('.zip'):
        with closing(zipfile.ZipFile(archive_filename)) as zf:
            return add_directories(zf.namelist())
    elif archive_filename.endswith(('.tar.gz', '.tar.bz2', '.tar')):
        with closing(tarfile.open(archive_filename)) as tf:
            return add_directories(list(map(unicodify, tf.getnames())))
    else:
        ext = os.path.splitext(archive_filename)[-1]
        raise Failure('Unrecognized archive type: %s' % ext)
634674
function archive() {
            vm.error = undefined;
            var promises = [];
            vm.todos.filter(function (todo) {
                return todo.completed;
            }).forEach(function (todo) {
                promises.push(_archive(todo));
            });

            $q.all(promises).then(function () {
                _fetch();
            }).catch(function () {
                vm.error = 'An error occurred when archiving completed todos';
            });
        }
136709
def cat(ctx, archive_name, version):
    '''
    
    '''

    _generate_api(ctx)
    var = ctx.obj.api.get_archive(archive_name)

    with var.open('r', version=version) as f:
        for chunk in iter(lambda: f.read(1024 * 1024), ''):
            click.echo(chunk)
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);
                }
            }
        }
    }
1239245
def to_map
      if zip.nil?
        return alg.to_map(enc.to_map(fields))
      else
        return alg.to_map(enc.to_map(zip.to_map(fields)))
      end
    end
723685
def _search_archive(pattern, archive, verbosity=0, interactive=True):
    """"""
    grep = util.find_program("grep")
    if not grep:
        msg = "The grep(1) program is required for searching archive contents, please install it."
        raise util.PatoolError(msg)
    tmpdir = util.tmpdir()
    try:
        path = _extract_archive(archive, outdir=tmpdir, verbosity=-1)
        return util.run_checked([grep, "-r", "-e", pattern, "."], ret_ok=(0, 1), verbosity=1, cwd=path)
    finally:
        shutil.rmtree(tmpdir, onerror=rmtree_log_error)
852954
public Iterable<JarManifestModel> getManifestsByArchive(ArchiveModel archiveModel)
    {
        GraphTraversal<Vertex, Vertex> pipeline = new GraphTraversalSource(getGraphContext().getGraph()).V(archiveModel.getElement());
        pipeline.out(JarManifestModel.ARCHIVE);
        return new FramedVertexIterable<>(getGraphContext().getFramed(), pipeline.toList(), JarManifestModel.class);
    }
380766
def channels_archive(self, room_id, **kwargs):
        """"""
        return self.__call_api_post('channels.archive', roomId=room_id, kwargs=kwargs)
272111
def download_archive(self, name, file_path):
        
        uri = self.URI + "/archive/" + name
        return self._client.download(uri, file_path)
1196223
def _archive_cls(file, ext=''):
        
        cls = None
        filename = None
        if is_string(file):
            filename = file
        else:
            try:
                filename = file.name
            except AttributeError:
                raise UnrecognizedArchiveFormat(
                    "File object not a recognized archive format.")
        lookup_filename = filename + ext
        base, tail_ext = os.path.splitext(lookup_filename.lower())
        cls = extension_map.get(tail_ext)
        if not cls:
            base, ext = os.path.splitext(base)
            cls = extension_map.get(ext)
        if not cls:
            raise UnrecognizedArchiveFormat(
                "Path not a recognized archive format: %s" % filename)
        return cls
19191
def _archive_extensions():
        
        if six.PY3:
            ext_map = {}
            fmt_map = {}
            for key, exts, desc in shutil.get_unpack_formats():
                fmt_map[key] = exts[0]
                for ext in exts:
                    ext_map[ext] = key
        else:
            ext_map = {'.tar': 'tar',
                       '.tar.bz2': 'bztar',
                       '.tar.gz': 'gztar',
                       '.tar.xz': 'xztar',
                       '.tbz2': 'bztar',
                       '.tgz': 'gztar',
                       '.txz': 'xztar',
                       '.zip': 'zip'}
            fmt_map = {'bztar': '.tar.bz2',
                       'gztar': '.tar.gz',
                       'tar': '.tar',
                       'xztar': '.tar.xz',
                       'zip': '.zip'}
        return ext_map, fmt_map
1294975
private Collection<Node> collectPersistenceXml(final Archive<?> archive) {
        final Collection<Node> nodes = new LinkedList<Node>(getPersistenceDescriptors(archive));
        for (Node node : collectSubArchives(archive)) {
            if (node.getAsset() instanceof ArchiveAsset) {
                final ArchiveAsset archiveAsset = (ArchiveAsset) node.getAsset();
                nodes.addAll(collectPersistenceXml(archiveAsset.getArchive()));
            }
        }
        return nodes;
    }
333045
function map() {
  var cache = {};
  if (!cache.extensions) cache.extensions = require('./lib/exts.json');
  if (!cache.languages) cache.languages = require('./lib/lang.json');
  return cache;
}
190209
def from_archive(archive_filename, py_interpreter=sys.executable):
    
    with _extract_to_tempdir(archive_filename) as root_dir:
        data = _setup_py_run_from_dir(root_dir, py_interpreter)
    return data
696008
def archive_history_item(item, destination, no_color):
    
    log_src, description = split_history_item(item.strip())

    # Get relative path for log:
    # {provider}/{image}/{instance}/{timestamp}.log
    log_dest = os.path.sep.join(log_src.rsplit(os.path.sep, 4)[1:])

    # Get results src and destination based on log paths.
    results_src = log_src.rsplit('.', 1)[0] + '.results'
    results_dest = log_dest.rsplit('.', 1)[0] + '.results'

    destination_path = os.path.join(destination, log_dest)
    log_dir = os.path.dirname(destination_path)

    try:
        if not os.path.isdir(log_dir):
            os.makedirs(log_dir)

        # Copy results and log files to archive directory.
        shutil.copyfile(log_src, destination_path)
        shutil.copyfile(results_src, os.path.join(destination, results_dest))
    except Exception as error:
        echo_style(
            'Unable to archive history item: %s' % error,
            no_color,
            fg='red'
        )
        sys.exit(1)
    else:
        # Only update the archive results log if no error occur.
        update_history_log(
            os.path.join(destination, '.history'),
            description=description,
            test_log=log_dest
        )
655117
private MapCollections<K, V> getCollection() {
        @WeakOuter
        class InteropMapCollections extends MapCollections<K, V> {
            @Override
            protected int colGetSize() {
                return mSize;
            }

            @Override
            protected Object colGetEntry(int index, int offset) {
                return mArray[(index<<1) + offset];
            }

            @Override
            protected int colIndexOfKey(Object key) {
                return key == null ? indexOfNull() : indexOf(key, key.hashCode());
            }

            @Override
            protected int colIndexOfValue(Object value) {
                return indexOfValue(value);
            }

            @Override
            protected Map<K, V> colGetMap() {
                return ArrayMap.this;
            }

            @Override
            protected void colPut(K key, V value) {
                put(key, value);
            }

            @Override
            protected V colSetValue(int index, V value) {
                return setValueAt(index, value);
            }

            @Override
            protected void colRemoveAt(int index) {
                removeAt(index);
            }

            @Override
            protected void colClear() {
                clear();
            }
        }
        if (mCollections == null) {
            mCollections = new InteropMapCollections();
        }
        return mCollections;
    }