Write SuperLinks to File Method
19224
def _writeSuperLinks(self, superLinks, fileObject):
        
        for slink in superLinks:
            fileObject.write('SLINK   %s      %s\n' % (
                slink.slinkNumber,
                slink.numPipes))

            for node in slink.superNodes:
                fileObject.write('NODE  %s  %.2f  %.2f  %.6f  %s  %s  %s  %.6f  %.6f\n' % (
                    node.nodeNumber,
                    node.groundSurfaceElev,
                    node.invertElev,
                    node.manholeSA,
                    node.nodeInletCode,
                    node.cellI,
                    node.cellJ,
                    node.weirSideLength,
                    node.orificeDiameter))
            for pipe in slink.pipes:
                fileObject.write('PIPE  %s  %s  %.6f  %.6f  %.6f  %.6f  %.2f  %.6f  %.6f\n' % (
                    pipe.pipeNumber,
                    pipe.xSecType,
                    pipe.diameterOrHeight,
                    pipe.width,
                    pipe.slope,
                    pipe.roughness,
                    pipe.length,
                    pipe.conductance,
                    pipe.drainSpacing))
1236567
protected void writeFile(String basename, T content,
			Function2<? super File, ? super String, ? extends File> outputDirectoryFilter) {
		// Create the file.
		// Encode
		final byte[] bytes = content.toString().getBytes(Charset.forName(getCodeConfig().getEncoding()));
		writeFile(basename, bytes, outputDirectoryFilter);
	}
185852
def _writeConnections(self, connections, fileObject):
        
        for connection in connections:
            fileObject.write('CONNECT  %s  %s  %s\n' % (
                connection.slinkNumber,
                connection.upSjuncNumber,
                connection.downSjuncNumber))
467664
function fixLinks(file) {
  return fs.readFile(file, 'utf8').then(data => {
    const flattenedLinks = data
      .replace(/\.\.\//g, '')
      .replace(/(modules|interfaces|classes)\//g, '');
    let caseFixedLinks = flattenedLinks;
    for (const lower in lowerToUpperLookup) {
      const re = new RegExp(lower, 'g');
      caseFixedLinks = caseFixedLinks.replace(re, lowerToUpperLookup[lower]);
    }
    return fs.writeFile(file, caseFixedLinks);
  });
}
1118528
function writeReport(fileResult, formatter, formattedSourceLines, baseDir) {
    var fileName = fileResult.fileName,
        stats = StatUtils.decorateStatPercentages(fileResult.stats),
        parentDir = path.normalize(baseDir + '/..'),
        mutations = formatter.formatMutations(fileResult.mutationResults),
        breadcrumb = new IndexHtmlBuilder(baseDir).linkPathItems({
            currentDir: parentDir,
            fileName: baseDir + '/' + fileName + '.html',
            separator: ' >> ',
            relativePath: getRelativeDistance(baseDir + '/' + fileName, baseDir ),
            linkDirectoryOnly: true
        });

    var file = Templates.fileTemplate({
        sourceLines: formattedSourceLines,
        mutations: mutations
    });

    fs.writeFileSync(
        path.join(baseDir, fileName + ".html"),
        Templates.baseTemplate({
            style: Templates.baseStyleTemplate({ additionalStyle: Templates.fileStyleCode }),
            script: Templates.baseScriptTemplate({ additionalScript: Templates.fileScriptCode }),
            fileName: path.basename(fileName),
            stats: stats,
            status: stats.successRate > this._config.successThreshold ? 'killed' : stats.all > 0 ? 'survived' : 'neutral',
            breadcrumb: breadcrumb,
            generatedAt: new Date().toLocaleString(),
            content: file
        })
    );
}
735824
def _write_method(schema):
    
    def method(
        self,
        filename=None,
        schema=schema,
        taxon_col='uid',
        taxon_annotations=[],
        node_col='uid',
        node_annotations=[],
        branch_lengths=True,
        **kwargs):
        # Use generic write class to write data.
        return _write(
            self._data,
            filename=filename,
            schema=schema,
            taxon_col=taxon_col,
            taxon_annotations=taxon_annotations,
            node_col=node_col,
            node_annotations=node_annotations,
            branch_lengths=branch_lengths,
            **kwargs
        )
    # Update docs
    method.__doc__ = _write_doc_template(schema)
    return method
295801
async function writeDocs (basePath, nodes) {
  Promise.all(nodes.map((node) => {
    const location = path.join(basePath, node.location.replace(srcPath, '').replace(/\.js$/, '.adoc'))
    return fs.outputFile(location, node.comments)
  }))
}
1129911
def write_multiple_files(args, base_dir, crawler):
    """"""
    for i, query in enumerate(args['query']):
        if query in args['files']:
            # Write files
            if args['out'] and i < len(args['out']):
                outfilename = args['out'][i]
            else:
                outfilename = '.'.join(query.split('.')[:-1])
            write_files(args, [query], outfilename)
        elif query in args['urls']:
            # Scrape/crawl urls
            domain = utils.get_domain(query)
            if args['html']:
                # Create a directory to save PART.html files in
                if not args['quiet']:
                    print('Storing html files in {0}/'.format(domain))
                utils.mkdir_and_cd(domain)

            if args['crawl'] or args['crawl_all']:
                # Crawl and save HTML files/image files to disk
                infilenames = crawler.crawl_links(query)
            else:
                raw_resp = utils.get_raw_resp(query)
                if raw_resp is None:
                    return False

                # Saves page as PART.html file
                prev_part_num = utils.get_num_part_files()
                utils.write_part_file(args, query, raw_resp)
                curr_part_num = prev_part_num + 1
                infilenames = utils.get_part_filenames(curr_part_num, prev_part_num)

            # Convert output or leave as PART.html files
            if args['html']:
                # HTML files have been written already, so return to base dir
                os.chdir(base_dir)
            else:
                # Write files to text or pdf
                if infilenames:
                    if args['out'] and i < len(args['out']):
                        outfilename = args['out'][i]
                    else:
                        outfilename = utils.get_outfilename(query, domain)
                    write_files(args, infilenames, outfilename)
                else:
                    sys.stderr.write('Failed to retrieve content from {0}.\n'
                                     .format(query))
    return True
477426
def _writeSuperJunctions(self, superJunctions, fileObject):
        
        for sjunc in superJunctions:
            fileObject.write('SJUNC  %s  %.2f  %.2f  %.6f  %s  %s  %s  %.6f  %.6f\n' % (
                sjunc.sjuncNumber,
                sjunc.groundSurfaceElev,
                sjunc.invertElev,
                sjunc.manholeSA,
                sjunc.inletCode,
                sjunc.linkOrCellI,
                sjunc.nodeOrCellJ,
                sjunc.weirSideLength,
                sjunc.orificeDiameter))
1098921
def write(file_name, data):
    """"""
    with open(file_name, 'w') as f:
        f.write(encode(data))
788736
function writeLocalJson(source, rootFolder) {
    // Write to local.json
    const local = path.join(rootFolder, constants.META_DIR, constants.META_LOCAL);
    const file = {
        name: local,
        source: JSON.stringify(source),
    };
    createFile(file);
}
869346
def _createSlink(self, slinks):
        

        for slink in slinks:
            # Create GSSHAPY SuperLink object
            superLink = SuperLink(slinkNumber=slink['slinkNumber'],
                                  numPipes=slink['numPipes'])

            # Associate SuperLink with StormPipeNetworkFile
            superLink.stormPipeNetworkFile = self

            for node in slink['nodes']:
                # Create GSSHAPY SuperNode objects
                superNode = SuperNode(nodeNumber=node['nodeNumber'],
                                      groundSurfaceElev=node['groundSurfaceElev'],
                                      invertElev=node['invertElev'],
                                      manholeSA=node['manholeSA'],
                                      nodeInletCode=node['inletCode'],
                                      cellI=node['cellI'],
                                      cellJ=node['cellJ'],
                                      weirSideLength=node['weirSideLength'],
                                      orificeDiameter=node['orificeDiameter'])

                # Associate SuperNode with SuperLink
                superNode.superLink = superLink

            for p in slink['pipes']:
                # Create GSSHAPY Pipe objects
                pipe = Pipe(pipeNumber=p['pipeNumber'],
                            xSecType=p['xSecType'],
                            diameterOrHeight=p['diameterOrHeight'],
                            width=p['width'],
                            slope=p['slope'],
                            roughness=p['roughness'],
                            length=p['length'],
                            conductance=p['conductance'],
                            drainSpacing=p['drainSpacing'])

                # Associate Pipe with SuperLink
                pipe.superLink = superLink
1172458
def write_to_remote(self, filepath_from, filepath_to, mtime_dt=None):
        """"""

        self.__log.debug("Writing L[%s] -> R[%s]." % (filepath_from, 
                                                      filepath_to))

        with open(filepath_from, 'rb') as file_from:
            with SftpFile(self, filepath_to, 'w') as sf_to:
                while 1:
                    part = file_from.read(MAX_MIRROR_WRITE_CHUNK_SIZE)
                    sf_to.write(part)

                    if len(part) < MAX_MIRROR_WRITE_CHUNK_SIZE:
                        break

        if mtime_dt is None:
            mtime_dt = datetime.now()

        self.utimes_dt(filepath_to, mtime_dt, mtime_dt)
826039
function writeFile(ngindoxObj, encoding, callback) {
	fs.writeFile(filePath, fileString, encoding, function(err) {
		if (err) {
			return callback(err);
		}
		return write(ngindoxObj, callback);
	});
}
1205788
def _writeStructureLink(self, link, fileObject, replaceParamFile):
        
        fileObject.write('%s\n' % link.type)
        fileObject.write('NUMSTRUCTS     %s\n' % link.numElements)

        # Retrieve lists of structures
        weirs = link.weirs
        culverts = link.culverts

        # Write weirs to file
        for weir in weirs:
            fileObject.write('STRUCTTYPE     %s\n' % weir.type)

            # Check for replacement vars
            crestLength = vwp(weir.crestLength, replaceParamFile)
            crestLowElevation = vwp(weir.crestLowElevation, replaceParamFile)
            dischargeCoeffForward = vwp(weir.dischargeCoeffForward, replaceParamFile)
            dischargeCoeffReverse = vwp(weir.dischargeCoeffReverse, replaceParamFile)
            crestLowLocation = vwp(weir.crestLowLocation, replaceParamFile)
            steepSlope = vwp(weir.steepSlope, replaceParamFile)
            shallowSlope = vwp(weir.shallowSlope, replaceParamFile)

            if weir.crestLength != None:
                try:
                    fileObject.write('CREST_LENGTH             %.6f\n' % crestLength)
                except:
                    fileObject.write('CREST_LENGTH             %s\n' % crestLength)

            if weir.crestLowElevation != None:
                try:
                    fileObject.write('CREST_LOW_ELEV           %.6f\n' % crestLowElevation)
                except:
                    fileObject.write('CREST_LOW_ELEV           %s\n' % crestLowElevation)

            if weir.dischargeCoeffForward != None:
                try:
                    fileObject.write('DISCHARGE_COEFF_FORWARD  %.6f\n' % dischargeCoeffForward)
                except:
                    fileObject.write('DISCHARGE_COEFF_FORWARD  %s\n' % dischargeCoeffForward)

            if weir.dischargeCoeffReverse != None:
                try:
                    fileObject.write('DISCHARGE_COEFF_REVERSE  %.6f\n' % dischargeCoeffReverse)
                except:
                    fileObject.write('DISCHARGE_COEFF_REVERSE  %s\n' % dischargeCoeffReverse)

            if weir.crestLowLocation != None:
                    fileObject.write('CREST_LOW_LOC            %s\n' % crestLowLocation)

            if weir.steepSlope != None:
                try:
                    fileObject.write('STEEP_SLOPE              %.6f\n' % steepSlope)
                except:
                    fileObject.write('STEEP_SLOPE              %s\n' % steepSlope)

            if weir.shallowSlope != None:
                try:
                    fileObject.write('SHALLOW_SLOPE            %.6f\n' % shallowSlope)
                except:
                    fileObject.write('SHALLOW_SLOPE            %s\n' % shallowSlope)

        # Write culverts to file
        for culvert in culverts:
            fileObject.write('STRUCTTYPE     %s\n' % culvert.type)

            # Check for replacement vars
            upstreamInvert = vwp(culvert.upstreamInvert, replaceParamFile)
            downstreamInvert = vwp(culvert.downstreamInvert, replaceParamFile)
            inletDischargeCoeff = vwp(culvert.inletDischargeCoeff, replaceParamFile)
            reverseFlowDischargeCoeff = vwp(culvert.reverseFlowDischargeCoeff, replaceParamFile)
            slope = vwp(culvert.slope, replaceParamFile)
            length = vwp(culvert.length, replaceParamFile)
            roughness = vwp(culvert.roughness, replaceParamFile)
            diameter = vwp(culvert.diameter, replaceParamFile)
            width = vwp(culvert.width, replaceParamFile)
            height = vwp(culvert.height, replaceParamFile)

            if culvert.upstreamInvert != None:
                try:
                    fileObject.write('UPINVERT                 %.6f\n' % upstreamInvert)
                except:
                    fileObject.write('UPINVERT                 %s\n' % upstreamInvert)

            if culvert.downstreamInvert != None:
                try:
                    fileObject.write('DOWNINVERT               %.6f\n' % downstreamInvert)
                except:
                    fileObject.write('DOWNINVERT               %s\n' % downstreamInvert)

            if culvert.inletDischargeCoeff != None:
                try:
                    fileObject.write('INLET_DISCH_COEFF        %.6f\n' % inletDischargeCoeff)
                except:
                    fileObject.write('INLET_DISCH_COEFF        %s\n' % inletDischargeCoeff)

            if culvert.reverseFlowDischargeCoeff != None:
                try:
                    fileObject.write('REV_FLOW_DISCH_COEFF     %.6f\n' % reverseFlowDischargeCoeff)
                except:
                    fileObject.write('REV_FLOW_DISCH_COEFF     %s\n' % reverseFlowDischargeCoeff)

            if culvert.slope != None:
                try:
                    fileObject.write('SLOPE                    %.6f\n' % slope)
                except:
                    fileObject.write('SLOPE                    %s\n' % slope)

            if culvert.length != None:
                try:
                    fileObject.write('LENGTH                   %.6f\n' % length)
                except:
                    fileObject.write('LENGTH                   %s\n' % length)

            if culvert.roughness != None:
                try:
                    fileObject.write('ROUGH_COEFF              %.6f\n' % roughness)
                except:
                    fileObject.write('ROUGH_COEFF              %s\n' % roughness)

            if culvert.diameter != None:
                try:
                    fileObject.write('DIAMETER                 %.6f\n' % diameter)
                except:
                    fileObject.write('DIAMETER                 %s\n' % diameter)


            if culvert.width != None:
                try:
                    fileObject.write('WIDTH                    %.6f\n' % width)
                except:
                    fileObject.write('WIDTH                    %s\n' % width)

            if culvert.height != None:
                try:
                    fileObject.write('HEIGHT                   %.6f\n' % height)
                except:
                    fileObject.write('HEIGHT                   %s\n' % height)
202957
def write filename, options={}
      extension = file_extension(filename)
      send("write_to_#{extension}".to_sym, filename, options)
    end
95579
private void writePointerLink(CmsResource res) throws CmsException {

        String resPath = getCms().getSitePath(res);
        String currentPropertyValue = getParamPropertyValue();
        boolean locked = true;
        CmsLock lock = getCms().getLock(res);
        if (lock.isUnlocked()) {
            // lock resource before operation
            getCms().lockResource(resPath);
            locked = false;
        }
        CmsFile file = getCms().readFile(res);
        file.setContents(currentPropertyValue.getBytes());
        checkLock(getCms().getSitePath(res));
        getCms().writeFile(file);
        if (!locked) {
            // unlock the resource
            getCms().unlockResource(resPath);
        }
    }