Call this function to write contents.

        Keyword arguments:
            * value - dict, content to be dumped
            * _file - FileIO, output file
            * _name - str, name of current content dict
183932
def _append_value(self, value, _file, _name):
        
        _tabs = '\t' * self._tctr
        _cmma = ',\n' if self._vctr[self._tctr] else ''
        _keys = '{cmma}{tabs}"{name}" :'.format(cmma=_cmma, tabs=_tabs, name=_name)

        _file.seek(self._sptr, os.SEEK_SET)
        _file.write(_keys)

        self._vctr[self._tctr] += 1
        self._append_object(value, _file)
91094
def _write(self, value):
        
        if ' ' in value:
            s = inspect.stack()
            fn = s[1].function
            super().write('%%DEBUG {} %%'.format(fn))
        super().write(value)
1218153
def write_config_value_to_file(key, value, config_path=None):
    
    if config_path is None:
        config_path = DEFAULT_CONFIG_PATH

    # Get existing config.
    config = _get_config_dict_from_file(config_path)

    # Add/update the key/value pair.
    config[key] = value

    # Create parent directories if they are missing.
    mkdir_parents(os.path.dirname(config_path))

    # Write the content
    with open(config_path, "w") as fh:
        json.dump(config, fh, sort_keys=True, indent=2)

    # Set 600 permissions on the config file.
    os.chmod(config_path, 33216)

    return get_config_value_from_file(key, config_path)
812821
def write_file(filename, content):
    """"""
    print 'Generating {0}'.format(filename)
    with open(filename, 'wb') as out_f:
        out_f.write(content)
891039
def dump_report_content(self, request, result):
        

        output = StringIO()
        writer = csv.writer(output, **self.csv_kwargs)
        writer.writerows([result.headers] + result.values)
        return output.getvalue()
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
65315
def write(self, value):
        
        if hasattr(value, '__iter__'):
            bytearray(value)
            self.extend(value)
        else:
            bytearray([value])
            self.append(value)
722140
def write(self, i, value):
        
        # Current byte position - (n * data_size)
        offset = i * self.__strct.size

        # Set file pointer to -(#data)
        self.__file.seek(offset)

        # Pack value
        data = self.pack(value)

        # Write packed value
        self.__file.write(data)
232367
def write_file_lines(self, filename, contents):
        
        with open(filename, 'wb') as f:
            self.log.debug(contents)
            f.writelines(contents)
146333
def write_output(self, data, args=None, filename=None, label=None):
        """"""
        if args:
            if not args.outlog:
                return 0
        if not filename: filename=args.outlog
        lastpath = ''
        with open(str(filename), 'w') as output_file:
            for entry in data['entries']:
                if args.label:
                    if entry['source_path'] == lastpath:
                        output_file.write(entry['raw_text'] + '\n')
                    elif args.label == 'fname':
                        output_file.write('======== ' + \
                                entry['source_path'].split('/')[-1] + \
                                ' >>>>\n' + entry['raw_text'] + '\n')
                    elif args.label == 'fpath':
                        output_file.write('======== ' + \
                                entry['source_path']  + \
                                ' >>>>\n' + entry['raw_text'] + '\n')
                else: output_file.write(entry['raw_text'] + '\n')
                lastpath = entry['source_path']
595974
def _append_value(self, value, _file, _name):
        
        if self._flag:
            _keys = _name + '\n'
        else:
            _keys = '\n' + _name + '\n'
        _file.seek(self._sptr, os.SEEK_SET)
        _file.write(_keys)

        self._bctr = collections.defaultdict(int)    # blank branch counter dict
        self._append_branch(value, _file)
472678
def write_json(self, **kwargs):
        
        self.stdout.write(json.dumps(kwargs) + "\n")
        self.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))
257467
def append(self, value):
        
        # Pack value
        data = self.pack(value)

        # End of file
        self.__file.seek(0, 2)

        # Write packed value
        self.__file.write(data)
433595
def write_file(self, filename, contents):
        
        logger.info("Writing file: %s", format_path(filename))
        contents = contents.rstrip() + b"\n"
        self.context.write_file(filename, contents)
        logger.debug("Wrote %s to %s.",
                     pluralize(len(contents.splitlines()), "line"),
                     format_path(filename))
571892
def text_dict_write(fpath, dict_):
    
    #dict_ = text_dict_read(fpath)
    #dict_[key] = val
    dict_text2 = util_str.repr4(dict_, strvals=False)
    if VERBOSE:
        print('[cache] ' + str(dict_text2))
    util_io.write_to(fpath, dict_text2)
563759
def _write_to_filepath(content, output):
    
    outdir = os.path.dirname(output)
    if outdir and not os.path.exists(outdir):
        os.makedirs(outdir)

    with anytemplate.compat.copen(output, 'w') as out:
        out.write(content)