Return the maximum revision for all files under a given location
551742
def get_revision(self, location):
        
        # Note: taken from setuptools.command.egg_info
        revision = 0

        for base, dirs, files in os.walk(location):
            if self.dirname not in dirs:
                dirs[:] = []
                continue    # no sense walking uncontrolled subdirs
            dirs.remove(self.dirname)
            entries_fn = os.path.join(base, self.dirname, 'entries')
            if not os.path.exists(entries_fn):
                ## FIXME: should we warn?
                continue
            f = open(entries_fn)
            data = f.read()
            f.close()

            if data.startswith('8') or data.startswith('9') or data.startswith('10'):
                data = list(map(str.splitlines, data.split('\n\x0c\n')))
                del data[0][0]  # get rid of the '8'
                dirurl = data[0][3]
                revs = [int(d[9]) for d in data if len(d)>9 and d[9]]+[0]
                if revs:
                    localrev = max(revs)
                else:
                    localrev = 0
            elif data.startswith('<?xml'):
                dirurl = _svn_xml_url_re.search(data).group(1)    # get repository URL
                revs = [int(m.group(1)) for m in _svn_rev_re.finditer(data)]+[0]
                if revs:
                    localrev = max(revs)
                else:
                    localrev = 0
            else:
                logger.warn("Unrecognized .svn/entries format; skipping %s", base)
                dirs[:] = []
                continue
            if base == location:
                base_url = dirurl+'/'   # save the root url
            elif not dirurl.startswith(base_url):
                dirs[:] = []
                continue    # not part of the same svn tree, skip it
            revision = max(revision, localrev)
        return revision
1114041
def max_repetition_level(self, path):
        """"""
        max_level = 0
        for part in path:
            element = self.schema_element(part)
            if element.repetition_type == parquet_thrift.FieldRepetitionType.REQUIRED:
                max_level += 1
        return max_level
414873
def all_posts(self):
        """"""
        rev = self.db.get('site:rev')
        if int(rev) != self.revision:
            self.reload_site()

        return self._all_posts
463061
protected void pullBulkRevisions(List<RevisionInternal> bulkRevs) {

        int nRevs = bulkRevs.size();
        if (nRevs == 0) {
            return;
        }
        Log.d(TAG, "%s bulk-fetching %d remote revisions...", this, nRevs);
        Log.d(TAG, "%s bulk-fetching remote revisions: %s", this, bulkRevs);

        if (!canBulkGet) {
            pullBulkWithAllDocs(bulkRevs);
            return;
        }

        Log.v(TAG, "%s: POST _bulk_get", this);
        final List<RevisionInternal> remainingRevs = new ArrayList<RevisionInternal>(bulkRevs);

        ++httpConnectionCount;

        final RemoteBulkDownloaderRequest downloader;
        try {
            downloader = new RemoteBulkDownloaderRequest(
                    clientFactory,
                    remote,
                    true,
                    bulkRevs,
                    db,
                    this.requestHeaders,
                    new RemoteBulkDownloaderRequest.BulkDownloaderDocument() {
                        public void onDocument(Map<String, Object> props, long size) {
                            // Got a revision!
                            // Find the matching revision in 'remainingRevs' and get its sequence:
                            RevisionInternal rev;
                            if (props.get("_id") != null) {
                                rev = new RevisionInternal(props, size);
                            } else {
                                rev = new RevisionInternal((String) props.get("id"),
                                        (String) props.get("rev"), false);
                            }

                            int pos = remainingRevs.indexOf(rev);
                            if (pos > -1) {
                                rev.setSequence(remainingRevs.get(pos).getSequence());
                                remainingRevs.remove(pos);
                            } else {
                                Log.w(TAG, "%s : Received unexpected rev rev", this);
                            }

                            if (props.get("_id") != null) {
                                // Add to batcher ... eventually it will be fed to -insertRevisions:.
                                queueDownloadedRevision(rev);
                            } else {
                                Status status = statusFromBulkDocsResponseItem(props);
                                Throwable err = new CouchbaseLiteException(status);
                                revisionFailed(rev, err);
                            }
                        }
                    },
                    new RemoteRequestCompletion() {
                        public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
                            // The entire _bulk_get is finished:
                            if (e != null) {
                                setError(e);
                                completedChangesCount.addAndGet(remainingRevs.size());
                            }
                            --httpConnectionCount;
                            // Start another task if there are still revisions waiting to be pulled:
                            pullRemoteRevisions();

                            if (cancellables != null && cancellables.values() != null && remoteRequest != null)
                                cancellables.values().remove(remoteRequest);
                        }
                    }
            );
        } catch (Exception e) {
            Log.e(TAG, "%s: pullBulkRevisions Exception: %s", this, e);
            return;
        }

        downloader.setAuthenticator(getAuthenticator());
        // set compressed request - gzip
        downloader.setCompressedRequest(canSendCompressedRequests());

        synchronized (remoteRequestExecutor) {
            if (!remoteRequestExecutor.isShutdown()) {
                Future future = remoteRequestExecutor.submit(downloader);
                pendingFutures.add(future);
                cancellables.put(future, downloader);
            }
        }
    }
1355628
private long lastModified(Set<File> files) {
    long result = 0;
    for (File file : files) {
      if (file.lastModified() > result)
        result = file.lastModified();
    }
    return result;
  }
739526
def _get_next_files(self):
        
        fnlist = self.__files[:16]
        self.__files = self.__files[16:]
        return fnlist
25348
def _max_timestamps(dirname_full, remove, compare_tstamp):
    """"""
    tstamp = _get_timestamp_cached(dirname_full, remove)
    return max_none((tstamp, compare_tstamp))
642637
def _rev(repo):
    '''
    
    '''
    try:
        repo_info = dict(six.iteritems(CLIENT.info(repo['repo'])))
    except (pysvn._pysvn.ClientError, TypeError,
            KeyError, AttributeError) as exc:
        log.error(
            'Error retrieving revision ID for svnfs remote %s '
            '(cachedir: %s): %s',
            repo['url'], repo['repo'], exc
        )
    else:
        return repo_info['revision'].number
    return None
398578
def location_in_cache( revision = nil )
      begin
        elements = [cache, repo_type, split_url, revision].flatten.compact.collect { |i| i.to_s } 
        File.join( elements )
      rescue => e
        raise CacheCalculationError.new(e.msg + e.backtrace.to_s)
      end
    end
1176421
def get_version(svn=False, limit=3):
    ""
    v = '.'.join([str(i) for i in VERSION[:limit]])
    if svn and limit >= 3:
        from django.utils.version import get_svn_revision
        import os
        svn_rev = get_svn_revision(os.path.dirname(__file__))
        if svn_rev:
            v = '%s.%s' % (v, svn_rev)
    return v
179728
def last_update_time(self) -> float:
        """"""
        stdout = self.stdout_interceptor
        stderr = self.stderr_interceptor

        return max([
            self._last_update_time,
            stdout.last_write_time if stdout else 0,
            stderr.last_write_time if stderr else 0,
        ])
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
33130
def last_revision(self, mod: YangIdentifier) -> ModuleId:
        
        revs = [mn for mn in self.modules if mn[0] == mod]
        if not revs:
            raise ModuleNotRegistered(mod)
        return sorted(revs, key=lambda x: x[1])[-1]
547366
def get_revision_limit(self):
        
        url = '/'.join((self.database_url, '_revs_limit'))
        resp = self.r_session.get(url)
        resp.raise_for_status()

        try:
            ret = int(resp.text)
        except ValueError:
            raise CloudantDatabaseException(400, response_to_json_dict(resp))

        return ret
470022
def filesFromHere_explore(self, astr_startPath = '/'):
            
            self.l_fwd  = []
            self.treeExplore(startPath = astr_startPath, f=self.fwd)
            self.l_allFiles = [f.split('/') for f in self.l_fwd]
            for i in range(0, len(self.l_allFiles)):
                self.l_allFiles[i][0] = '/'
            return self.l_fwd
279342
def list_revisions(path)
      resp = request('/files/list_revisions', path: path)
      entries = resp['entries'].map { |e| FileMetadata.new(e) }
      return entries, resp['is_deleted']
    end
524858
def _find_newest_ckpt(ckpt_dir):
    """"""
    full_paths = [
        os.path.join(ckpt_dir, fname) for fname in os.listdir(ckpt_dir)
        if fname.startswith("experiment_state") and fname.endswith(".json")
    ]
    return max(full_paths)