If we reach the end of the file, we simply open the next, until we \
        run out of archives to process
551294
def get_next_line(self):
        """"""

        line = self.freq_file.readline().strip().split()
        if len(line) < 1:
            self.load_genotypes()
            line = self.freq_file.readline().strip().split()
        info_line = self.info_file.readline().strip().split()
        info = float(info_line[4])
        exp_freq = float(info_line[3])
        return line, info, exp_freq
758648
async def next(self) -> Any:
        """"""
        # So, if we're at BOF, we need to skip till the boundary.
        if self._at_eof:
            return
        await self._maybe_release_last_part()
        if self._at_bof:
            await self._read_until_first_boundary()
            self._at_bof = False
        else:
            await self._read_boundary()
        if self._at_eof:  # we just read the last boundary, nothing to do there
            return
        self._last_part = await self.fetch_next_part()
        return self._last_part
603146
private void closeCurrentPartFile() throws Exception {
		if (isWriterOpen) {
			writer.close();
			isWriterOpen = false;
		}

		if (currentPartPath != null) {
			Path inProgressPath = getInProgressPathFor(currentPartPath);
			Path pendingPath = getPendingPathFor(currentPartPath);
			fs.rename(inProgressPath, pendingPath);
			LOG.debug("Moving in-progress bucket {} to pending file {}", inProgressPath, pendingPath);
			this.bucketState.pendingFiles.add(currentPartPath.toString());
		}
	}
781957
def end_of_history(event):
    
    event.current_buffer.history_forward(count=10**100)
    buff = event.current_buffer
    buff.go_to_history(len(buff._working_lines) - 1)
1205388
private void truncateFile(List<FileEntry> entries) {
      long startTime = 0;
      if (trace) startTime = timeService.wallClockTime();

      int reclaimedSpace = 0;
      int removedEntries = 0;
      long truncateOffset = -1;
      for (Iterator<FileEntry> it = entries.iterator() ; it.hasNext(); ) {
         FileEntry fe = it.next();
         // Till we have free entries at the end of the file,
         // we can remove them and contract the file to release disk
         // space.
         if (!fe.isLocked() && ((fe.offset + fe.size) == filePos)) {
            truncateOffset = fe.offset;
            filePos = fe.offset;
            freeList.remove(fe);
            it.remove();
            reclaimedSpace += fe.size;
            removedEntries++;
         } else {
            break;
         }
      }

      if (truncateOffset > 0) {
         try {
            channel.truncate(truncateOffset);
         } catch (IOException e) {
            throw new PersistenceException("Error while truncating file", e);
         }
      }

      if (trace) {
         log.tracef("Removed entries: %d, Reclaimed Space: %d, Free Entries %d", removedEntries, reclaimedSpace, freeList.size());
         log.tracef("Time taken for truncateFile: %d (ms)", timeService.wallClockTime() - startTime);
      }
   }
859209
def poll(self, force_rescan = False):
      """"""
      # Check for new, deleted, and rotated files.
      if force_rescan or time.time() > self._last_scan + self._interval:
         self._rescan(skip_to_end = False)
         self._last_scan = time.time()

      filereaders = {}
      for path, tailedfile in self._tailedfiles.iteritems():
         filereaders[path] = tailedfile.readlines()

      # One line is read from each file in turn, in an attempt to read
      # from all files evenly. They'll be in an undefined order because
      # of using a dict for filereaders, but that's not a problem
      # because some entropy here is desirable for evenness.
      while len(filereaders) > 0:
         for path in filereaders.keys():
            lines = filereaders[path]
            try:
               line, offset = lines.next()
            except StopIteration:
               # Reached end the of this file.
               del filereaders[path]
               break
            
            yield (path, offset), line
1053909
private void processFiles(File[] files) {
        phaseOutput(format("=== %s ===", getApplicationName()));
        phaseOutput(format("Compiling %d BEL Document(s)", files.length));

        boolean pedantic = withPedantic();
        boolean verbose = withVerbose();

        int validated = 0;

        for (int i = 1; i <= files.length; i++) {
            File file = files[i - 1];

            if (verbose) {
                phaseOutput("Compiling " + i + " of " + files.length
                        + " BEL Document(s)");
            }

            // validate document
            Document document = stage1(file);
            if (document == null) {
                if (pedantic) {
                    bail(VALIDATION_FAILURE);
                }
                continue;
            }
            validated++;

            // run stages 2 - 7
            runCommonStages(pedantic, document);
        }

        if (validated == 0) {
            bail(NO_VALID_DOCUMENTS);
        }
    }
1051373
private Event getNextEvent(Iterator<File> files) {
        while (files.hasNext()) {
            File file = files.next();

            // only consider files that end with FILE_SUFFIX
            if (!file.getAbsolutePath().endsWith(FILE_SUFFIX)) {
                continue;
            }

            Event event = fileToEvent(file);
            if (event != null) {
                return event;
            }
        }

        return null;
    }
931513
def close(self):
        
        if self.closed:
            return

        if self.mode in "aw":
            self.fileobj.write(NUL * (BLOCKSIZE * 2))
            self.offset += (BLOCKSIZE * 2)
            # fill up the end with zero-blocks
            # (like option -b20 for tar does)
            blocks, remainder = divmod(self.offset, RECORDSIZE)
            if remainder > 0:
                self.fileobj.write(NUL * (RECORDSIZE - remainder))

        if not self._extfileobj:
            self.fileobj.close()
        self.closed = True
1195862
public function closeDictionaryFiles()
    {
        $this->_tisFile->seek(4);
        $this->_tisFile->writeLong($this->_termCount);

        $this->_tiiFile->seek(4);
        // + 1 is used to count an additional special index entry (empty term at the start of the list)
        $this->_tiiFile->writeLong(($this->_termCount - $this->_termCount % self::$indexInterval)/self::$indexInterval + 1);
    }
988677
def finalize_file(self):
        # type: (Descriptor) -> None
        
        # delete bad file if integrity failed
        if self._integrity_failed:
            self.final_path.unlink()
        else:
            self._restore_file_attributes()
            self._restore_file_lmt()
        # update resume file
        self._update_resume_for_completed()
        with self._meta_lock:
            self._finalized = True
1170996
function proceedWithBackup() {
    if (options.resume) {
      // pick up from existing log file from previous run
      downloadRemainingBatches(options.log, db, ee, start, batchesPerDownloadSession, options.parallelism);
    } else {
      // create new log file and process
      spoolchanges(db, options.log, options.bufferSize, ee, function(err) {
        if (err) {
          ee.emit('error', err);
        } else {
          downloadRemainingBatches(options.log, db, ee, start, batchesPerDownloadSession, options.parallelism);
        }
      });
    }
  }
850205
def seek_file_end(file):
    ''''''
    try:
        file.seek(0, 2)
    except ValueError:
        # gzip files don't support seek from end
        while True:
            data = file.read(4096)
            if not data:
                break
103669
def add_last_closed_file(self, fname):
        """"""
        if fname in self.last_closed_files:
            self.last_closed_files.remove(fname)
        self.last_closed_files.insert(0, fname)
        if len(self.last_closed_files) > 10:
            self.last_closed_files.pop(-1)
911627
def close(self):
        
        if callable(getattr(self._file, 'close', None)):
            self._iterator.close()
        self._iterator = None
        self._unconsumed = None
        self.closed = True
159604
def end_byte(self):
        """"""
        return min(
            (self.part_number + 1) * self.multipart.chunk_size,
            self.multipart.size
        )
368202
def process_data(self, file_info):
        """"""
        if self._has_reached_stop_limit():
            self.log.info("Remaining bytes in quota (%d) has reached minimum to request stop (%d)",
                          self._quota.remaining, self._stop_on_remaining)
            self.fire(events.TransmissionQuotaReached())
        elif not self._fits_in_quota(file_info):
            self.log.debug("File would exceed quota. Won't process '%s'", str(file_info))
        else:
            return file_info
        self.fire(events.FilteredFile(file_info))