Replace Val File Write to File Method
514181
def _write(self, session, openFile, replaceParamFile):
        
        # Write lines
        for line in self.lines:
            openFile.write(line.contents)
1245068
def _writeXput(self, session, directory, fileCards,
                   name=None, replaceParamFile=None):
        
        for card in self.projectCards:
            if (card.name in fileCards) and self._noneOrNumValue(card.value) \
                    and fileCards[card.name]:
                fileIO = fileCards[card.name]
                filename = card.value.strip('"')

                # Check for replacement variables
                if '[' in filename or ']' in filename:
                    log.info('The file for project card {0} cannot be '
                             'written, because the path has been replaced '
                             'with replacement variable {1}.'.format(card.name, filename))
                    return

                # Determine new filename
                filename = self._replaceNewFilename(filename=filename,
                                                    name=name)

                # Invoke write method on each file
                self._invokeWrite(fileIO=fileIO,
                                  session=session,
                                  directory=directory,
                                  filename=filename,
                                  replaceParamFile=replaceParamFile)
1135635
function formatObject(val) {
  if (val.options && val.options.format === false) {
    return val;
  }

  var res = { options: val.options };
  res.files = val.files;
  for (var key in val) {
    if (key === 'files' || key === 'options') {
      continue;
    }
    res[key] = val[key];
  }

  var len = res.files.length;
  var idx = -1;

  while (++idx < len) {
    var ele = res.files[idx];
    var obj = {};

    obj.options = {};
    obj.src = ele.src || [];
    obj.dest = ele.dest || '';

    copyNonfiles(obj, ele);
    if (!ele.options) {
      obj.options = res.options;
    }

    res.files[idx] = obj;
  }
  return res;
}
649716
def file_writeOnce(astr_fileName, astr_val, **kwargs):
    '''
    
    '''

    _str_mode = 'w'
    for key, val in kwargs.items():
        if key == 'mode':   _str_mode   = val

    FILE = open(astr_fileName, _str_mode)
    FILE.write(astr_val)
    FILE.close()
324849
private boolean replaceFilePathsWithBytes(ModelNode request) throws CommandFormatException, IOException {
        boolean didReplacement = false;
        ModelNode opDesc = new ModelNode();
        opDesc.get("address").set(request.get("address"));
        opDesc.get("operation").set("read-operation-description");
        final String opName = request.get("operation").asString();
        opDesc.get("name").set(opName);
        ModelNode response = execute(opDesc, false).getResponseNode();
        if (response.hasDefined("result", "request-properties")) {
            final ModelNode requestProps = response.get("result", "request-properties");
            for (Property prop : requestProps.asPropertyList()) {
                ModelNode typeDesc = prop.getValue().get("type");
                if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES
                        && request.hasDefined(prop.getName())) {
                    String filePath = request.get(prop.getName()).asString();
                    File localFile = new File(filePath);
                    if (!localFile.exists())
                        continue;
                    try {
                        request.get(prop.getName()).set(Util.readBytes(localFile));
                        didReplacement = true;
                    } catch (OperationFormatException e) {
                        throw new CommandFormatException(e);
                    }
                }
            }
        }
        return didReplacement;
    }
390645
function updateFileData(filePath, newRelPath, oldRelPath, data) {
    return new Promise(async(res, rej) => {
        let file = editLinks(data, newRelPath, oldRelPath);
        try {
            await writeFile(filePath, file);
            res();
        } catch (err) {
            rej();
        }
    })
}
326788
function writeFile(pathToFile, content, verbose) {
  const directory = path.dirname(pathToFile);

  // Create directory if it doesn't exist
  if (!fs.existsSync(directory)) {
    fs.mkdirSync(directory);
  }

  // Try to write file to disk to the given location
  fs.writeFile(pathToFile, content, { flag: 'w' }, (error) => {
    if (error) {
      throw new Error(error);
    }

    // Log success message to the console if in verbose mode only
    if (verbose) {
      const successMessage = `\nVersion file written to ${chalk.green(pathToFile)}`;

      console.log(successMessage);
    }
  });
}
7453
def _replace_file(path, content):
  """"""
  if os.path.exists(path):
    with open(path, 'r') as f:
      if content == f.read():
        print("Not overwriting {} because it is unchanged".format(path), file=sys.stderr)
        return

  with open(path, 'w') as f:
    f.write(content)
490266
function _writeFile(i_sFilename, i_oFile, i_oCallback) {
    var l_sFilename = i_sFilename,
        l_oBuffer = new Buffer(i_oFile.fileData); // filedata is Uint8Array
    fs.writeFile(l_sFilename, l_oBuffer, function(err) {
        if (err) {
            console.log("Error writting file ", err);
            l_sFilename = null;
        }
        i_oCallback(l_sFilename);
    });
}
697537
function writeFile(p, data, encoding) {
    var def = Q.defer();
    fs.writeFile(p, data, encoding, def.makeNodeResolver());
    return def.promise
}
954127
def write_to(output, txt):
    """"""
    if (isinstance(txt, six.binary_type) or six.PY3 and isinstance(output, StringIO)) or isinstance(output, TextIOWrapper):
        output.write(txt)
    else:
        output.write(txt.encode("utf-8", "replace"))
276347
def _write(self, session, openFile, replaceParamFile):
        
        # Write lines
        openFile.write('GSSHA_CHAN\n')

        alpha = vwp(self.alpha, replaceParamFile)
        try:
            openFile.write('ALPHA%s%.6f\n' % (' ' * 7, alpha))
        except:
            openFile.write('ALPHA%s%s\n' % (' ' * 7, alpha))

        beta = vwp(self.beta, replaceParamFile)
        try:
            openFile.write('BETA%s%.6f\n' % (' ' * 8, beta))
        except:
            openFile.write('BETA%s%s\n' % (' ' * 8, beta))

        theta = vwp(self.theta, replaceParamFile)
        try:
            openFile.write('THETA%s%.6f\n' % (' ' * 7, theta))
        except:
            openFile.write('THETA%s%s\n' % (' ' * 7, theta))

        openFile.write('LINKS%s%s\n' % (' ' * 7, self.links))
        openFile.write('MAXNODES%s%s\n' % (' ' * 4, self.maxNodes))

        # Retrieve StreamLinks
        links = self.getOrderedLinks(session)

        self._writeConnectivity(links=links,
                                fileObject=openFile)
        self._writeLinks(links=links,
                         fileObject=openFile,
                         replaceParamFile=replaceParamFile)
1171182
function writeFile (outDir, vars, file) {
  return function (done) {
    const fileName = file.path
    const inFile = file.fullPath
    const parentDir = file.parentDir
    const outFile = path.join(outDir, maxstache(removeUnderscore(fileName), vars))

    mkdirp(path.join(outDir, maxstache(parentDir, vars)), function (err) {
      if (err) return done(err)

      const rs = fs.createReadStream(inFile)
      const ts = maxstacheStream(vars)
      const ws = fs.createWriteStream(outFile)

      pump(rs, ts, ws, done)
    })
  }
}
875945
def instance_write(attr, value)
      setter = :"#{name}_#{attr}="
      responds = instance.respond_to?(setter)
      self.instance_variable_set("@_#{setter.to_s.chop}", value)
      instance.send(setter, value) if responds || attr.to_s == "file_name"
    end
533941
def save_file(self, data, dfile):
        
        self.enforce_type(self.jobject, "weka.core.converters.FileSourcedConverter")
        if not javabridge.is_instance_of(dfile, "Ljava/io/File;"):
            dfile = javabridge.make_instance(
                "Ljava/io/File;", "(Ljava/lang/String;)V", javabridge.get_env().new_string_utf(str(dfile)))
        javabridge.call(self.jobject, "setFile", "(Ljava/io/File;)V", dfile)
        javabridge.call(self.jobject, "setInstances", "(Lweka/core/Instances;)V", data.jobject)
        javabridge.call(self.jobject, "writeBatch", "()V")
1158755
function replaceFilePlaceholders(oFile, aReplacementRules) {
  // parse file
  const sRaw = oFile.contents.toString('utf8')
  const sUpdatedFile = aReplacementRules.reduce((oResult, oRule) => {
    return oResult.replace(oRule.identifier, oRule.content)
  }, sRaw)

  // update new raw content
  oFile.contents = new Buffer(sUpdatedFile)

  // return updated file
  return oFile
}
770829
function makeWriteFile(anonDefRegExp, namespaceWithDot, layer) {
        function writeFile(name, contents) {
            logger.trace('Saving plugin-optimized file: ' + name);
            file.saveUtf8File(name, contents);
        }

        writeFile.asModule = function (moduleName, fileName, contents) {
            writeFile(fileName,
                build.toTransport(anonDefRegExp, namespaceWithDot, moduleName, fileName, contents, layer));
        };

        return writeFile;
    }