Process a single file.
179031
function processFile(md) {
  return (file, callback) => {
    let content;
    let footnotes;
    try {
      const tokens = md.parse(file.meta.content, {});
      const footnoteTokens = popFootnoteTokens(tokens);
      footnotes = footnoteTokensToMeta(footnoteTokens, md);
      content = md.renderer.render(tokens, md.options, {});
    } catch (error) {
      console.error(`${file.path}: Could not render the content`);
      async.nextTick(callback, error);
      return;
    }

    const meta = Object.assign({}, file.meta, { content, footnotes });
    async.nextTick(callback, null, Object.assign({}, file, { meta }));
  };
}
1022490
def process_file(self, path, dryrun):
        
        # if dryrun just return file path
        if dryrun:
            return path

        # remove and return file
        if self.__force or raw_input("Remove file '%s'? [y/N]" % path).lower() == "y":
            os.remove(path)
            return path
1050395
def render_file(self, context, result):
		""""""
		if __debug__:
			log.debug("Processing file-like object.", extra=dict(request=id(context), result=repr(result)))
		
		response = context.response
		response.conditional_response = True
		
		modified = mktime(gmtime(getmtime(result.name)))
		
		response.last_modified = datetime.fromtimestamp(modified)
		ct, ce = guess_type(result.name)
		if not ct: ct = 'application/octet-stream'
		response.content_type, response.content_encoding = ct, ce
		response.etag = unicode(modified)
		
		result.seek(0, 2)  # Seek to the end of the file.
		response.content_length = result.tell()
		
		result.seek(0)  # Seek back to the start of the file.
		response.body_file = result
		
		return True
462738
def _postprocess(self, filehandle, metadata):
        ""
        for process in self._postprocessors:
            filehandle = process(filehandle, metadata)
        return filehandle
899102
def file(data, response, **kwargs):
    """"""
    if not data:
        response.content_type = 'text/plain'
        return ''

    if hasattr(data, 'read'):
        name, data = getattr(data, 'name', ''), data
    elif os.path.isfile(data):
        name, data = data, open(data, 'rb')
    else:
        response.content_type = 'text/plain'
        response.status = HTTP_NOT_FOUND
        return 'File not found!'

    response.content_type = mimetypes.guess_type(name, None)[0] or 'application/octet-stream'
    return data
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))
903285
def process_file(path, processor, encoding='utf-8', mode='rt', *args, **kwargs):
    '''  '''
    if mode not in ('rU', 'rt', 'rb', 'r'):
        raise Exception("Invalid file reading mode")
    with open(path, encoding=encoding, mode=mode, *args, **kwargs) as infile:
        return processor(infile)
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);
}
905372
function processFile (file, version, versions, targetVersions) {
  processTags(file.content, version, versions, file)
  processVersioned(file.content, version, versions)
  processVersionLists(file.content, version, targetVersions)
  return file
}
47550
function processFile(rootPath, log) {
  return (file, callback) => {
    const filePath = path.join(rootPath, file.path);
    const writeMode = isStream(file.data) ? WriteMode.STREAM : WriteMode.UTF8;
    write(filePath, file.data, writeMode, (error) => {
      if (log === true && !error) {
        console.log(`Successfully wrote file '${file.path}'`);
      }

      async.nextTick(callback, error, file);
    });
  };
}
1113184
def process_file(self, filename):
        """"""
        if self.config.dry_run:
            if not self.config.internal:
                self.logger.info("Dry run mode for script %s", filename)
            with open(filename) as handle:
                for line in handle:
                    yield line[0:-1] if line[-1] == '\n' else line
        else:
            if not self.config.internal:
                self.logger.info("Running script %s", filename)
            for line in self.process_script(filename):
                yield line
1126590
def process_files
      if @options[:parallel].empty?
        files.map { |path| check_path(path) }
      else
        Parallel.map(files, @options[:parallel]) { |path| check_path(path) }
      end
    end
1286587
def process_file(self, language, key, token_list):
        
        self.language = language
        for tok in token_list:
            self.process_token(tok)
99678
function processFile() {
  const options = { collapseWhitespace: true };
  return (file, callback) => {
    if (file.meta.filePath.ext !== '.html') {
      async.nextTick(callback, null, file);
      return;
    }

    const data = htmlMinifier.minify(file.data, options);
    async.nextTick(callback, null, Object.assign({}, file, { data }));
  };
}
391130
def process_file(self, path, dryrun):
        
        # special case - skip output file so we won't include it in result
        if path == self._output_path:
            return None

        # if dryrun skip and return file
        if dryrun:
            return path

        # concat file with output file
        with open(path, "rb") as infile:
            data = infile.read()
            self._output_file.write(data)

        # return processed file path
        return path
276246
def process(input_dir, output_dir, function):
        
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)
        logger = log.get_global_console_logger()
        logger.info("Processing files in {}.".format(input_dir))
        input_file_names = os.listdir(input_dir)
        for input_file_name in input_file_names:
            logger.info("Processing {}.".format(input_file_name))
            input_file = os.path.join(input_dir, input_file_name)
            with codecs.open(input_file, "r", encoding="UTF-8") as f:
                input_string = f.read()
            output_string = function(input_string)
            output_file = os.path.join(output_dir, input_file_name)
            with codecs.open(output_file, "w", encoding="UTF-8") as f:
                f.write(output_string)
        logger.info("Saved processed files to {}.".format(output_dir))
1233585
function processFile(file, filename, callback) {
      // Check if it matches the convention.
      if (path.extname(filename) === '.metadata') {
        // Find the name of the metadata.
        const name = path.basename(filename, '.metadata')

        // Recursively merge the meta data.
        const newMetadata = {}
        newMetadata[name] = file
        extend(true, metadata, newMetadata)

        // Remove the file since we've now processed it.
        delete files[filename]
      }

      callback()
    }