Returns the class that can read this archive based on archive suffix.
        Returns:
            Class that can read this archive or None if no such exists.
544995
def extractor_cls(self):
        
        file_cls = None

        # only catches ".gz", even from ".tar.gz"
        if self.is_tar:
            file_cls = TarFile
        elif self.is_zip:
            file_cls = ZipFile
        else:
            logger.info("Couldn't recognize archive suffix: {0}.".format(
                self.suffix))

        return file_cls
300889
def get_archive_format (filename):
    """"""
    mime, compression = util.guess_mime(filename)
    if not (mime or compression):
        raise util.PatoolError("unknown archive format for file `%s'" % filename)
    if mime in ArchiveMimetypes:
        format = ArchiveMimetypes[mime]
    else:
        raise util.PatoolError("unknown archive format for file `%s' (mime-type is `%s')" % (filename, mime))
    if format == compression:
        # file cannot be in same format compressed
        compression = None
    return format, compression
265567
def _get_item_class(self, url):
        
        if '/layers/' in url:
            return Layer
        elif '/tables/' in url:
            return Table
        elif '/sets/' in url:
            return Set
        # elif '/documents/' in url:
        #     return Document
        else:
            raise NotImplementedError("No support for catalog results of type %s" % url)
201203
def archiver_for_path(path_name):
  
  if path_name.endswith('.tar.gz'):
    return TGZ
  elif path_name.endswith('.tar.bz2'):
    return TBZ2
  else:
    _, ext = os.path.splitext(path_name)
    if ext:
      ext = ext[1:]  # Trim leading '.'.
    if not ext:
      raise ValueError('Could not determine archive type of path {}'.format(path_name))
    return create_archiver(ext)
1037149
def build_archive(cls, **kwargs):
        
        if cls._archive is None:
            cls._archive = cls(**kwargs)
        return cls._archive
1004360
@Override
    public <X extends Archive<X>> Collection<X> getAsType(Class<X> type, Filter<ArchivePath> filter) {
        return this.getArchive().getAsType(type, filter);
    }
831171
def read(self):
        
        logging.debug('Read {x.__class__.__name__} [{x.name}]'.format(x=self))
        request_url = self._artifactory.drive + '/api/{uri}/{x.name}'.format(uri=self._uri, x=self)
        r = self._session.get(
            request_url,
            auth=self._auth,
        )
        if 404 == r.status_code or 400 == r.status_code:
            logging.debug('{x.__class__.__name__} [{x.name}] does not exist'.format(x=self))
            return False
        else:
            logging.debug('{x.__class__.__name__} [{x.name}] exist'.format(x=self))
            r.raise_for_status()
            response = r.json()
            self.raw = response
            self._read_response(response)
            return True
447177
def get_archiver(self, kind):
    

    archivers = {
        'tar': TarArchiver,
        'tbz2': Tbz2Archiver,
        'tgz': TgzArchiver,
        'zip': ZipArchiver,
    }

    return archivers[kind]()
1115941
def recordItemClass(self, record=None):
        
        if record is not None:
            key = type(record)
        else:
            key = None
        
        return self._recordItemClass.get(key, self._recordItemClass[None])
446852
def read_partition(self, i):
        
        self._load_metadata()
        if i < 0 or i >= self.npartitions:
            raise IndexError('%d is out of range' % i)

        return self._get_partition(i)
754310
@Override
    public <X extends Archive<X>> X getAsType(Class<X> type, String path) {
        return this.getArchive().getAsType(type, path);
    }
157459
private Object readItem() {

        Object itemRead = null;

        try {

            currentChunkStatus.incrementItemsTouchedInCurrentChunk();

            // call read listeners before and after the actual read
            for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
                readListenerProxy.beforeRead();
            }

            itemRead = readerProxy.readItem();

            for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
                readListenerProxy.afterRead(itemRead);
            }

            // itemRead == null means we reached the end of
            // the readerProxy "resultset"
            if (itemRead == null) {
                currentChunkStatus.markReadNull();
                currentChunkStatus.decrementItemsTouchedInCurrentChunk();
            }

        } catch (Exception e) {
            runtimeStepExecution.setException(e);
            for (ItemReadListenerProxy readListenerProxy : itemReadListeners) {
                readListenerProxy.onReadError(e);
            }
            if (!currentChunkStatus.isRetryingAfterRollback()) {
                if (retryReadException(e)) {
                    if (!retryHandler.isRollbackException(e)) {
                        // retry without rollback
                        itemRead = readItem();
                    } else {
                        // retry with rollback
                        currentChunkStatus.markForRollbackWithRetry(e);
                    }
                } else if (skipReadException(e)) {
                    currentItemStatus.setSkipped(true);
                    runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();
                } else {
                    throw new BatchContainerRuntimeException(e);
                }
            } else {
                // coming from a rollback retry
                if (skipReadException(e)) {
                    currentItemStatus.setSkipped(true);
                    runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue();

                } else if (retryReadException(e)) {
                    if (!retryHandler.isRollbackException(e)) {
                        // retry without rollback
                        itemRead = readItem();
                    } else {
                        // retry with rollback
                        currentChunkStatus.markForRollbackWithRetry(e);
                    }
                } else {
                    throw new BatchContainerRuntimeException(e);
                }
            }

        } catch (Throwable e) {
            throw new BatchContainerRuntimeException(e);
        }

        logger.exiting(sourceClass, "readItem", itemRead == null ? "<null>" : itemRead);
        return itemRead;
    }
1127900
def is_archive_file(name):
    # type: (str) -> bool
    """"""
    ext = splitext(name)[1].lower()
    if ext in ARCHIVE_EXTENSIONS:
        return True
    return False
1179760
def readObject(self):
        
        ref = self.readInteger(False)

        if ref & REFERENCE_BIT == 0:
            obj = self.context.getObject(ref >> 1)

            if obj is None:
                raise pyamf.ReferenceError('Unknown reference %d' % (ref >> 1,))

            if self.use_proxies is True:
                obj = self.readProxy(obj)

            return obj

        ref >>= 1

        class_def = self._getClassDefinition(ref)
        alias = class_def.alias

        obj = alias.createInstance(codec=self)
        obj_attrs = dict()

        self.context.addObject(obj)

        if class_def.encoding in (ObjectEncoding.EXTERNAL, ObjectEncoding.PROXY):
            obj.__readamf__(DataInput(self))

            if self.use_proxies is True:
                obj = self.readProxy(obj)

            return obj
        elif class_def.encoding == ObjectEncoding.DYNAMIC:
            self._readStatic(class_def, obj_attrs)
            self._readDynamic(class_def, obj_attrs)
        elif class_def.encoding == ObjectEncoding.STATIC:
            self._readStatic(class_def, obj_attrs)
        else:
            raise pyamf.DecodeError("Unknown object encoding")

        alias.applyAttributes(obj, obj_attrs, codec=self)

        if self.use_proxies is True:
            obj = self.readProxy(obj)

        return obj
1256110
def memory_enumerator(buffer_, *args, **kwargs):
    """"""

    _LOGGER.debug("Enumerating through (%d) bytes of archive data.",
                  len(buffer_))

    def opener(archive_res):
        _LOGGER.debug("Opening from (%d) bytes (memory_enumerator).",
                      len(buffer_))

        _archive_read_open_memory(archive_res, buffer_)

    if 'entry_cls' not in kwargs:
        kwargs['entry_cls'] = _ArchiveEntryItReadable

    return _enumerator(opener,
                       *args,
                       **kwargs)
969393
private ClassDescriptor getItemClassDescriptor(ObjectReferenceDescriptor ord, List hintClasses)
    {   
        DescriptorRepository repo = ord.getClassDescriptor().getRepository();

        if (hintClasses == null || hintClasses.isEmpty())
        {
            return repo.getDescriptorFor(ord.getItemClass()); 
        }
        
        Class resultClass = (Class) hintClasses.get(0);
        
        for (Iterator iter = hintClasses.iterator(); iter.hasNext();)
        {
            Class clazz = (Class) iter.next();
            Class superClazz = clazz.getSuperclass();

            if (superClazz != null && resultClass.equals(superClazz.getSuperclass()))
            {
                continue; // skip if we already have a super superclass 
            }
           
            if (hintClasses.contains(superClazz))
            {
                resultClass = superClazz;   // use superclass if it's in the hints
            }
        }

        return repo.getDescriptorFor(resultClass);
    }
9463
def data_from_archive(self):
        
        archive_data = {}

        archive_data['runtime_deps'] = self.runtime_deps
        archive_data['build_deps'] = [
            ['BuildRequires', 'python2-devel']] + self.build_deps

        archive_data['py_modules'] = self.py_modules
        archive_data['scripts'] = self.scripts

        archive_data['home_page'] = self.home_page
        archive_data['description'] = self.description
        archive_data['summary'] = self.summary

        archive_data['license'] = self.license
        archive_data['has_pth'] = self.has_pth
        archive_data['has_extension'] = self.has_extension
        archive_data['has_test_suite'] = self.has_test_suite

        archive_data['python_versions'] = self.versions_from_archive

        (archive_data['doc_files'],
         archive_data['doc_license']) = self.separate_license_files(
             self.doc_files)

        archive_data['dirname'] = self.archive.top_directory

        return archive_data