Pre-processes a file contents.

        This is the main internal entry point.
508947
def process_contents(self, contents, fname=None):
        
        self.stack = []
        self.dispatch_table = self.default_table.copy()
        self.current_file = fname
        self.tuples = self.tupleize(contents)

        self.initialize_result(fname)
        while self.tuples:
            t = self.tuples.pop(0)
            # Uncomment to see the list of tuples being processed (e.g.,
            # to validate the CPP lines are being translated correctly).
            #print(t)
            self.dispatch_table[t[0]](t)
        return self.finalize_result(fname)
610956
def main(args=None):
	""""""
	import sys, pprint
	from argparse import ArgumentParser, FileType
	parser = ArgumentParser(description=main.__doc__)
	parser.add_argument('infile',  nargs='?', type=FileType('rb'), default=sys.stdin.buffer,
		help='bencoded file (e.g. torrent) [Default: stdin]')
	parser.add_argument('outfile', nargs='?', type=FileType('w'), default=sys.stdout,
		help='python-syntax serialization [Default: stdout]')
	args = parser.parse_args(args)
	
	data = bdecode(args.infile)
	pprint.pprint(data, stream=args.outfile)
1013943
protected function onInit()
    {
        $this->filePath = Utility::get($this->params, "filePath");
        $this->fieldSeparator = Utility::get($this->params, "fieldSeparator", ",");
        $this->charset = Utility::get($this->params, "charset");
        $this->precision = Utility::get($this->params, "precision", 100);
        $this->firstRowData = Utility::get($this->params, "firstRowData", false);
    }
1285505
function processFile(autogenContext, commentInfo, callback) {
    fs.readFile(path.resolve(__dirname, "..", autogenContext.filePath), function (readError, sourceFileContentsBuffer) {
        if (readError) {
            callback(autogenContext.filePath, readError);
            return;
        }

        processNextAutogenBlock(autogenContext, sourceFileContentsBuffer.toString(), commentInfo, 0, function (result, autogenError) {
            //Write results if the content was changed (don't need to re-write the same content)
            if (sourceFileContentsBuffer.toString() != result)
                fs.writeFile(path.resolve(__dirname, "..", autogenContext.filePath), result, {}, function (writeError) {
                    callback(autogenContext.filePath, writeError);
                });
            else
                callback(autogenContext.filePath, autogenError);
        });
    });
}
801867
def __prepare(self, filestem, b, examples=None, pos=None, neg=None):
        
        if examples:
            examplesFile = open('%s/%s.pl' % (self.tmpdir, filestem), 'w')
            examplesFile.write(examples)
            examplesFile.close()
        elif pos and neg:
            posFile = open('%s/%s.f' % (self.tmpdir, filestem), 'w')
            negFile = open('%s/%s.n' % (self.tmpdir, filestem), 'w')
            posFile.write(pos)
            negFile.write(neg)
            posFile.close()
            negFile.close()
        else:
            raise Exception('You need to provide either a single file of classified examples or \
                two files, positive and negative examples.')
        bFile = open('%s/%s.b' % (self.tmpdir, filestem), 'w')
        # Write settings.
        for setting, val in self.settings.items():
            bFile.write(':- set(%s,%s).\n' % (setting, val))
        bFile.write(b)
        bFile.close()
542980
function preprocessorcery(infile, info, callback) {
  applicable(infile, info, (err, preprocessors) => {
    if (err) return callback(err);

    const q = queue(1);
    preprocessors.forEach((preprocessor) => {
      const outfile = newfile(infile);
      q.defer((next) => {
        preprocessor(infile, outfile, (err) => {
          if (err) return next(err);
          infile = outfile;
          next();
        });
      });
    });

    q.await((err) => {
      if (err) return callback(err);

      // infile has been changed to the output file by this point
      callback(null, infile);
    });
  });
}
1184375
void process(byte ttfAfm[], boolean preload) throws DocumentException, IOException {
        tables = new HashMap();
        
        try {
            if (ttfAfm == null)
                rf = new RandomAccessFileOrArray(fileName, preload, Document.plainRandomAccess);
            else
                rf = new RandomAccessFileOrArray(ttfAfm);
            if (ttcIndex.length() > 0) {
                int dirIdx = Integer.parseInt(ttcIndex);
                if (dirIdx < 0)
                    throw new DocumentException("The font index for " + fileName + " must be positive.");
                String mainTag = readStandardString(4);
                if (!mainTag.equals("ttcf"))
                    throw new DocumentException(fileName + " is not a valid TTC file.");
                rf.skipBytes(4);
                int dirCount = rf.readInt();
                if (dirIdx >= dirCount)
                    throw new DocumentException("The font index for " + fileName + " must be between 0 and " + (dirCount - 1) + ". It was " + dirIdx + ".");
                rf.skipBytes(dirIdx * 4);
                directoryOffset = rf.readInt();
            }
            rf.seek(directoryOffset);
            int ttId = rf.readInt();
            if (ttId != 0x00010000 && ttId != 0x4F54544F)
                throw new DocumentException(fileName + " is not a valid TTF or OTF file.");
            int num_tables = rf.readUnsignedShort();
            rf.skipBytes(6);
            for (int k = 0; k < num_tables; ++k) {
                String tag = readStandardString(4);
                rf.skipBytes(4);
                int table_location[] = new int[2];
                table_location[0] = rf.readInt();
                table_location[1] = rf.readInt();
                tables.put(tag, table_location);
            }
            checkCff();
            fontName = getBaseFont();
            fullName = getNames(4); //full name
            familyName = getNames(1); //family name
            allNameEntries = getAllNames();
            if (!justNames) {
                fillTables();
                readGlyphWidths();
                readCMaps();
                readKerning();
                readBbox();
//                GlyphWidths = null;
            }
        }
        finally {
            if (rf != null) {
                rf.close();
                if (!embedded)
                    rf = null;
            }
        }
    }
716952
def prep_file(url, dir)
        parts = url.split('/')
        File.join(dir, parts[-1])
      end
761619
function process(file, context) {
  fis.emit('process:start', file);
  pipe(file, 'parser');
  pipe(file, 'preprocessor');
  pipe(file, 'standard');
  postStandard(file, context);
  pipe(file, 'postprocessor');
  pipe(file, 'optimizer');
  fis.emit('process:end', file);
}
717246
@Override
    public void startOfProcess() {
        String previousBaseIndent = baseIndent.substring(INDENT_LENGTH);
        builder.append(previousBaseIndent).append("HierarchyWrapper{\n");
        processFirstOtherContent = true;
    }
774929
function processFile() {
  const options = {};
  return (file, callback) => {
    const data = csso.minify(file.data, options).css;
    async.nextTick(callback, null, Object.assign({}, file, { data }));
  };
}
858636
public void init() throws IOException {
    if (!Files.exists(path)) {
      throw new FileNotFoundException(
          "Could not find a file under path: " + path.toAbsolutePath().toString());
    }
    if (Files.size(path) == 0) {
      throw new IllegalStateException("File size can't be zero for chunked files");
    }
    chunks = chunkFile();
    chunksInUse = new ConcurrentSkipListMap<>();
    chunksPreRead = new ConcurrentSkipListMap<>();
    chunksScheduled = new ConcurrentSkipListMap<>();
    nextChunkNum = new AtomicInteger(-1);
    if (raf != null) {
      raf.close();
    }
    execIo = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
    execFinalize = Executors.newSingleThreadExecutor();
  }
1361069
function() {
          return through.obj(function(file, encode, done){
            addBefore(file.path);
            this.push(file);
            done();
          });
        }
539882
private void prepareReader(BufferedReader fileReader, String fileId)
	{

		switch (fileType)
		{
		case EMBL:
			EmblEntryReader emblReader = new EmblEntryReader(	fileReader,	EmblEntryReader.Format.EMBL_FORMAT,fileId);
			emblReader.setCheckBlockCounts(lineCount);
			reader = emblReader;
			break;
		case GENBANK:
			reader = new GenbankEntryReader(fileReader,fileId);
			break;
		case GFF3:
			reader = new GFF3FlatFileEntryReader(fileReader);
			break;
		case FASTA:
			reader = new FastaFileReader(new FastaLineReader(fileReader));
			break;
		case AGP:
			reader= new AGPFileReader(new AGPLineReader(fileReader));
			break;
		default:
			System.exit(0);
			break;
		}
	}
707160
function processRetrievedContent(content, filePrismicMetadata, queryKey, ctx) {
            if (content.results != null && content.results.length > 0) {
                var queryMetadata = filePrismicMetadata[queryKey];
                for (var i = 0; i < content.results.length; i++) {
                    var result = processRetrievedDocument(content.results[i], filePrismicMetadata, queryKey, ctx);
                    filePrismicMetadata[queryKey].results.push(result);
                }
            }
        }
1126175
def before_blobput(self, field: str, fileobj: BinaryIO,
                       filename: str,
                       mimetype: Optional[str] = None,
                       size: Optional[int] = None,
                       encoding: Optional[str] = None) -> None:
        """"""
953919
def main():
    
    filename = pmag.get_named_arg('-f')
    if not filename:
        return
    with open(filename, 'rb+') as f:
        content = f.read()
        f.seek(0)
        f.write(content.replace(b'\r', b''))
        f.truncate()