Return information related to the types of archives available
778216
def get_archive_types():
    '''
    
    '''
    ret = copy.deepcopy(_bundle_types)
    for k, v in ret.items():
        v.pop('handler')
    return ret
486018
public static function getArchiveSlug()
    {
        global $wp_query;

        if ($wp_query && !is_tax() && (is_post_type_archive() || is_archive() || is_home() || is_search() || is_404())) {
            $postType = get_post_type();

            if (isset($wp_query->query_vars['post_type']) && !empty($wp_query->query_vars['post_type'])) {
                $postType = $wp_query->query_vars['post_type'];
            }

            if (is_home()) {
                $archiveSlug = 'archive-post';
            } elseif (is_post_type_archive() && is_search()) {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            } elseif (is_search()) {
                $archiveSlug = 'search';
            } elseif (is_404()) {
                $archiveSlug = 'e404';
            } elseif (is_author()) {
                $archiveSlug = 'author';
            } else {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            }

            return $archiveSlug;
        }

        return false;
    }
156858
function archiveResource(resource, primary, archive) {
        if (!resource.archive) { return true; }

        var name = resource.name;

        primary.bind(name);
        archive.bind(name);

        // get the archive criteria
        var criteria = resource.archive();

        log.info('Getting archive docs for ' + name);

        // find all the documents that match the archive criteria
        return getDocsToArchive(criteria, primary[name])
            .then(function (docs) {

                log.info('Found ' + docs.length + ' ' + name + ' docs to archive');

                // insert all of the documents into the archive database
                var deferred = Q.defer();
                archive[name].insert(docs, function (err, results) {
                    err ? deferred.reject(err) : deferred.resolve(results);
                });
                return deferred.promise;
            })
            .then(function () {

                log.info('Docs inserted into archive DB for ' + name + '. Now deleting docs in main db');

                // delete the data from the primary database
                var deferred = Q.defer();
                primary[name].remove(criteria, function (err, results) {

                    log.info('Deleting docs complete for ' + name);

                    err ? deferred.reject(err) : deferred.resolve(results);
                });
                return deferred.promise;

            });
    }
688283
def by_name(self, name, archived=False, limit=None, page=None):
        """"""
        if not archived:
            path = _path(self.adapter)
        else:
            path = _path(self.adapter, 'archived')
        return self._get(path, name=name, limit=limit, page=page)
145013
def get_export_allowable_types(cursor, exports_dirs, id, version):
    """"""
    request = get_current_request()
    type_settings = request.registry.settings['_type_info']
    type_names = [k for k, v in type_settings]
    type_infos = [v for k, v in type_settings]
    # We took the type_names directly from the setting this function uses to
    # check for valid types, so it should never raise an ExportError here
    file_tuples = get_export_files(cursor, id, version, type_names,
                                   exports_dirs, read_file=False)
    type_settings = dict(type_settings)
    for filename, mimetype, file_size, file_created, state, file_content \
            in file_tuples:
        type_name = filename.rsplit('.', 1)[-1]
        type_info = type_settings[type_name]
        yield {
            'format': type_info['user_friendly_name'],
            'filename': filename,
            'size': file_size,
            'created': file_created and file_created.isoformat() or None,
            'state': state,
            'details': type_info['description'],
            'path': request.route_path(
                'export', ident_hash=join_ident_hash(id, version),
                type=type_name, ignore=u'/{}'.format(filename))
            }
571614
def get_files_information(self):
        
        for k in self.get_files():
            yield k, self.get_files_types()[k], self.get_files_crc32()[k]
951528
def get_archive_formats():
    
    formats = [(name, registry[2]) for name, registry in
               _ARCHIVE_FORMATS.items()]
    formats.sort()
    return formats
500940
def choose_type(cls, content_type):
        """"""
        return cls.type_cls.SUBDIR if content_type in cls.subdir_types \
            else cls.type_cls.FILE
1311896
def _raw_records(self, identifier=None, rtype=None, name=None, content=None):
        """"""
        record_fields = {
            'id': identifier,
            'type': rtype,
            'hostname': name and self._relative_name(name),
            'destination': content,
        }
        # type/hostname/destination of the dnsrecord type are mandatory (even
        # when deleting), and must be queried if not all were specified:
        if all(record_fields.values()):
            return [record_fields]
        data = self._apicall('infoDnsRecords', domainname=self.domain)
        records = data.get('dnsrecords', [])
        return [
            record for record in records
            if all(record[k] == v for k, v in record_fields.items() if v)
        ]
776417
def unpack_archive(archive_format, archive_path, source_path):
    """"""
    if archive_format not in ('zip', 'tar'):
        raise ValueError('Unknown archive format "%s".' % archive_format)
    if archive_format == 'zip':
        with zipfile.ZipFile(archive_path) as archive:
            archive.extractall(source_path)
    if archive_format == 'tar':
        with tarfile.open(archive_path) as archive:
            archive.extractall(source_path)
795282
def get_archive_url(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/archive",
            headers={
                "Accept": Consts.mediaTypeMigrationPreview
            }
        )
        return data["data"]
462093
@Override
    public <X extends Archive<X>> X getAsType(Class<X> type, ArchivePath path, final ArchiveFormat archiveFormat) {
        Validate.notNull(type, "Type must be specified");
        Validate.notNull(path, "ArchivePath must be specified");
        Validate.notNull(archiveFormat, "ArchiveFormat must be specified");

        // Get stream importer/exporter bindings for specified format
        final ArchiveFormatStreamBindings formatBinding = new ArchiveFormatStreamBindings(archiveFormat);

        Node content = get(path);
        if (content == null) {
            return null;
        }

        Asset asset = content.getAsset();
        if (asset == null) {
            return null;
        }
        // If we already have an archive asset, just return it as-is; don't reimport
        if (asset.getClass() == ArchiveAsset.class) {
            return ArchiveAsset.class.cast(asset).getArchive().as(type);
        }

        InputStream stream = null;
        try {
            stream = asset.openStream();
            X archive = ShrinkWrap.create(formatBinding.getImporter(), path.get()).importFrom(stream).as(type);
            delete(path);
            add(new ArchiveAsset(archive, formatBinding.getExporter()), path);

            return archive;
        } finally {
            if (stream != null) {
                try {
                    stream.close();
                } catch (IOException e) {
                    throw new ArchiveImportException("Stream not closed after import", e);
                }
            }
        }
    }
1282638
def file_archive(class_obj: type) -> type:
    
    assert isinstance(class_obj, type), "class_obj is not a Class"
    global _file_archive_resource_type
    _file_archive_resource_type = class_obj
    return class_obj
1004360
@Override
    public <X extends Archive<X>> Collection<X> getAsType(Class<X> type, Filter<ArchivePath> filter) {
        return this.getArchive().getAsType(type, filter);
    }
1010403
def get_filetypes(self):
        # type: () -> List[str]
        
        if not self.is_requestable():
            return [resource.get_file_type() for resource in self.get_resources()]
        return self._get_stringlist_from_commastring('file_types')
417077
def archive(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "archive", value)
            assert os.path.exists(value), "'{0}' attribute: '{1}' file doesn't exists!".format("archive", value)
        self.__archive = value
754380
protected void getURIs(String lcacheArchives, String lcacheFiles) {
    String archives[] = StringUtils.getStrings(lcacheArchives);
    String files[] = StringUtils.getStrings(lcacheFiles);
    fileURIs = StringUtils.stringToURI(files);
    archiveURIs = StringUtils.stringToURI(archives);
  }