Write to stdout or a file
972128
def file_ops(staticfied, args):
    """"""
    destination = args.o or args.output

    if destination:
        with open(destination, 'w') as file:
            file.write(staticfied)
    else:
        print(staticfied)
81109
def write(self, data, end="\n", flush=True):
        
        if not self.nostdout:
            self.stdout.write(data+end)
        if self.file is not None:
            self.file.write(data+end)
        if flush:
            self.flush()
794539
def fout(self, output, newline=True):
        """"""
        if output is not None:
            self.out(self.fmt(output), newline=newline)
130532
function writeFile(input, output, type) {
    var json    = readFile(input),
        content = getContent(json, type);

    fs.writeFile(output, content, function (err) {
        if (err) {
            throw err;
        }

        console.log('The file "' + output + '" was written successfully!');
    });
}
101944
def print_file(self, file_format='ctfile', f=sys.stdout):
        
        print(self.writestr(file_format=file_format), file=f)
949367
def Write(self, string):
    
    if sys.version_info[0] < 3:
      super(StdoutOutputWriter, self).Write(string)
    else:
      # sys.stdout.write() on Python 3 by default will error if string is
      # of type bytes.
      sys.stdout.write(string)
465209
def writeline(self, data, crlf="\r\n"):
        
        if self.read_thread:
            if self.read_thread.has_error():
                raise RuntimeError("Error writing PIPE")
        # Check if process still alive
        if self.proc.poll() is not None:
            raise RuntimeError("Process stopped")
        if self.__print_io:
            self.logger.info(data, extra={'type': '-->'})
        self.proc.stdin.write(bytearray(data + crlf, 'ascii'))
        self.proc.stdin.flush()
755245
def write_to_output(content, output=None,
                    encoding=anytemplate.compat.ENCODING):
    
    if anytemplate.compat.IS_PYTHON_3 and isinstance(content, bytes):
        content = str(content, encoding)

    if output and not output == '-':
        _write_to_filepath(content, output)
    elif anytemplate.compat.IS_PYTHON_3:
        print(content)
    else:
        print(content.encode(encoding.lower()), file=get_output_stream())
58316
def write_txt(self, as_string=False):
        """"""
        if not as_string:
            with open('{}/{}.txt'.format(self.outpath, self.outputprefix), 'w') as f:
                [f.write(textline + '\n') for textline in self.txtreport]
        else:
            output = '\n'.join(self.txtreport)
            if config.RAWSTRING:
                output = repr(output)
            print(output)
1243732
def redirect_output(fileobj):
    """"""
    old = sys.stdout
    sys.stdout = fileobj
    try:
        yield fileobj
    finally:
        sys.stdout = old
152525
def write_output(command, output)
      File.open(output_path, 'w') do |file|
        printable_command = apply_replacements("#{environment_var_assignments} #{command} 2>&1")
        file.write printable_command.sub(executable, name)
        file.write "\n"
        file.write output
      end
    end
905039
def write(self, chars, output):
        
        data = self.generate(chars)
        with open(output, 'wb') as f:
            return f.write(data)
1200584
def output_to_bar(self, message, comma=True):
        
        if comma:
            message += ','
        sys.stdout.write(message + '\n')
        sys.stdout.flush()
316250
def write_output(self, data, filename=None, args=None):
        """"""
        if args:
            if not args.linejson:
                return 0
        if not filename: filename = args.linejson
        entrylist = []
        for entry in data['entries']:
            entrystring = json.dumps(entry, sort_keys=True)
            entrylist.append(entrystring)
        
        with open(str(filename), 'w') as output_file:
            output_file.write('\n'.join(entrylist))
458943
async def stdout_writer():
    
    if sys.stdout.seekable():
        # it’s a file
        return sys.stdout.buffer.raw

    if os.isatty(sys.stdin.fileno()):
        # it’s a tty, use fd 0
        fd_to_use = 0
    else:
        fd_to_use = 1

    twrite, pwrite = await loop.connect_write_pipe(
        asyncio.streams.FlowControlMixin,
        os.fdopen(fd_to_use, "wb"),
    )

    swrite = asyncio.StreamWriter(
        twrite,
        pwrite,
        None,
        loop,
    )

    return swrite
1244698
def write_output(self):
        """"""
        for data in self.output_data.values():
            self.create_output(data.get('key'), data.get('value'), data.get('type'))
476997
def write_stdout function #, string
      # TODO save and restore r0
      function.mov( :r0 ,  1 ) # 1 == stdout
      function.mov( :r1 , receiver_register )
      function.mov( receiver_register , :r3 )
      syscall( function.insertion_point , 4 ) # 4 == write
    end