check_pending_files is used to resume any files that might been pending. It's called from filesagent/providers/network.
506703
function(options, cb) {
  if (os_name == 'windows') {
    path_arg = path.resolve(options.path);
    name_arg = path.resolve(options.name);
  } else {
    path_arg = '"' + options.path + '"';
    name_arg = '"' + options.name + '"';
  }
  var opts = {
    user: options.user,
    bin: node_bin,
    type: 'exec',
    args: [path.join(__dirname, 'upload.js'), path_arg, options.user, name_arg, options.size, options.file_id, options.total, options.port],
    opts: {
      env: process.env
    }
  };

  run_as_user(opts, function(err, out) {
    if (err) {
      logger.error("Upload error: " + err.message);
      return;
    }
    logger.info("Ran as user: " + out);
    if (out.indexOf("File succesfuly uploaded") != -1) {
      files.del(options.file_id);
      return;
    }
    if (out.includes("EPIPE") || out.includes("EACCES")) {
      files.update(options.file_id, options.path, options.size, options.user, options.name, options.resumable, function(err) {
        if (err) logger.error("Database update error");
        logger.info("Resume file option activated for ID: " + options.file_id);
      });
    }
  });
}
55318
function() {
            var waitingOrConnected = connectionManager.getWaitingOrConnected(),
                i;

            // ensure files are cancelled in reverse order which they were added
            // to avoid a flash of time where a queued file begins to upload before it is canceled
            if (waitingOrConnected.length) {
                for (i = waitingOrConnected.length - 1; i >= 0; i--) {
                    controller.cancel(waitingOrConnected[i]);
                }
            }

            connectionManager.reset();
        }
654015
def commit_pending?(path)
      status = ""
      Dir.chdir(path) do
        status = `git status 2>/dev/null`
      end
      return status.include?("Changes to be committed") || status.include?("Changes not staged for commit")
    end
497562
def _pending_of(self, workload):
        """"""
        pending = sum(list(scope.values()).count(False) for scope in workload.values())
        return pending
1001912
def ps(ui, repo, *pats, **opts):
	
	opts['short'] = True
	return pending(ui, repo, *pats, **opts)
530509
def pending(ui, repo, *pats, **opts):
	
	if codereview_disabled:
		raise hg_util.Abort(codereview_disabled)

	quick = opts.get('quick', False)
	short = opts.get('short', False)
	m = LoadAllCL(ui, repo, web=not quick and not short)
	names = m.keys()
	names.sort()
	for name in names:
		cl = m[name]
		if short:
			ui.write(name + "\t" + line1(cl.desc) + "\n")
		else:
			ui.write(cl.PendingText(quick=quick) + "\n")

	if short:
		return 0
	files = DefaultFiles(ui, repo, [])
	if len(files) > 0:
		s = "Changed files not in any CL:\n"
		for f in files:
			s += "\t" + f + "\n"
		ui.write(s)
642058
def is_ready(instance, pending=False):
    

    last_reload = lookup(instance, 'lastOperatingSystemReload', 'id')
    active_transaction = lookup(instance, 'activeTransaction', 'id')

    reloading = all((
        active_transaction,
        last_reload,
        last_reload == active_transaction,
    ))
    outstanding = False
    if pending:
        outstanding = active_transaction
    if instance.get('provisionDate') and not reloading and not outstanding:
        return True
    return False
725774
async def pendings(self, tasks=None):
        
        tasks = tasks or self.todo_tasks
        await asyncio.gather(*tasks, loop=self.loop)
1062874
boolean add(Path filename) {
    synchronized (pendingReplications) {
      PendingInfo found = pendingReplications.get(filename);
      if (found == null) {
        pendingReplications.put(filename, new PendingInfo(filename));
        return true;
      }
      return false;
    }
  }
1140427
def _check(self): # TODO: fix?
        """"""
        if self._returncode:
            rarfile.check_returncode(self, '')
        if self._remain != 0:
            raise rarfile.BadRarFile("Failed the read enough data")
629817
def is_pending(self):
        """"""
        return self.status == Status.published and self.timestamp >= arrow.now()
617509
def pending(self, partitions=None):
        
        if partitions is None:
            partitions = self.offsets.keys()

        total = 0
        reqs = []

        for partition in partitions:
            reqs.append(OffsetRequestPayload(self.topic, partition, -1, 1))

        resps = self.client.send_offset_request(reqs)
        for resp in resps:
            partition = resp.partition
            pending = resp.offsets[0]
            offset = self.offsets[partition]
            total += pending - offset

        return total
16886
function checkFileExists(filename, callback) {
  if (fs.exists !== undefined) {
    fs.exists(filename, callback);
  } else {
    fs.stat(filename, function (err) {
      callback(!err);
    });
  }
}
1007606
def has_pending(self):
        
        if self.workqueue:
            return True

        for assigned_unit in self.assigned_work.values():
            if self._pending_of(assigned_unit) > 0:
                return True

        return False
71869
private void refreshFileList()
      throws IOException {
    FileStatus[] files = fileSystem.globStatus(inputDirectoryAndPattern);
    for (FileStatus file : files) {
      String fileName = file.getPath().getName();
      if (!knownFileSet.contains(fileName)) {
        if (endFileNumber != -1) {
          // Sanity check against endFileNumber.
          int newFileIndex = parseFileIndex(fileName);
          Preconditions.checkState(newFileIndex < endFileNumber,
              "Found new file '%s' with index %s, which isn't less than endFileNumber %s!",
              fileName, newFileIndex, endFileNumber);
        }

        logger.atInfo().log(
            "Adding new file '%s' of size %s to knownFileSet.", fileName, file.getLen());
        knownFileSet.add(fileName);
        fileQueue.add(file);
      }
    }
  }
1326937
def isHeld(self):
        '''
            
        '''
        if not os.path.exists(self.lockPath):
            return False
        
        try:
            mtime = os.stat(self.lockPath).st_mtime
        except FileNotFoundError as e:
            return False
        
        if self.__checkExpiration(mtime):
            return False

        return True
1126036
def check_files_exist(filenames):
    ''''''
    files_not_found = [x for x in filenames if not os.path.exists(x)]
    if len(files_not_found):
        for filename in files_not_found:
            print('File not found: "', filename, '"', sep='', file=sys.stderr)
        raise Error('File(s) not found. Cannot continue')