Writes the leftover members to `f`.

    Args:
      f: File to write to.
      catch_all: If true, document all missing symbols from any module.
        Otherwise, document missing symbols from just this module.
347776
def write_other_members(self, f, catch_all=False):
    
    if catch_all:
      names = self._members.items()
    else:
      names = inspect.getmembers(self._module)
    leftovers = []
    for name, _ in names:
      if name in self._members and name not in self._documented:
        leftovers.append(name)
    if leftovers:
      print("%s: undocumented members: %d" % (self._title, len(leftovers)))
      print("\n## Other Functions and Classes", file=f)
      for name in sorted(leftovers):
        print("  %s" % name)
        self._documented.add(name)
        self._mentioned.add(name)
        self._write_member_markdown_to_file(f, "###", *self._members[name])
569884
def codes_write(handle, outfile):
    # type: (cffi.FFI.CData, T.BinaryIO) -> None
    
    mess = ffi.new('const void **')
    mess_len = ffi.new('size_t*')
    codes_get_message = check_return(lib.codes_get_message)
    codes_get_message(handle, mess, mess_len)
    message = ffi.buffer(mess[0], size=mess_len[0])
    outfile.write(message)
360584
def save_to_file(destination_filename, append=False):
    

    def decorator_fn(f):
        @wraps(f)
        def wrapper_fn(*args, **kwargs):
            res = f(*args, **kwargs)

            makedirs(os.path.dirname(destination_filename))
            mode = "a" if append else "w"
            with open(destination_filename, mode) as text_file:
                text_file.write(res)

            return res

        return wrapper_fn

    return decorator_fn
554472
void write(File f) throws FileNotFoundException, IOException {
		try (ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(f))) {
			os.writeObject(this);
		}
	}
602112
def dump(self, f):
        """"""
        # header
        print("PSF", file=f)
        print(file=f)

        # title
        print("      1 !NTITLE", file=f)
        print(self.title, file=f)
        print(file=f)

        # atoms
        print("% 7i !NATOM" % len(self.numbers), file=f)
        if len(self.numbers) > 0:
            for index, (number, atom_type, charge, name, molecule) in enumerate(zip(self.numbers, self.atom_types, self.charges, self.names, self.molecules)):
                atom = periodic[number]
                print("% 7i % 4s % 4i NAME % 6s % 6s % 8.4f % 12.6f 0" % (
                    index + 1,
                    name,
                    molecule + 1,
                    atom.symbol,
                    atom_type,
                    charge,
                    atom.mass/unified,
                ), file=f)
        print(file=f)

        # bonds
        print("% 7i !NBOND" % len(self.bonds), file=f)
        if len(self.bonds) > 0:
            tmp = []
            for bond in self.bonds:
                tmp.extend(bond+1)
                if len(tmp) >= 8:
                    print(" ".join("% 7i" % v for v in tmp[:8]), file=f)
                    tmp = tmp[8:]
            if len(tmp) > 0:
                print(" ".join("% 7i" % v for v in tmp), file=f)
        print(file=f)

        # bends
        print("% 7i !NTHETA" % len(self.bends), file=f)
        if len(self.bends) > 0:
            tmp = []
            for bend in self.bends:
                tmp.extend(bend+1)
                if len(tmp) >= 9:
                    print(" " + (" ".join("% 6i" % v for v in tmp[:9])), file=f)
                    tmp = tmp[9:]
            if len(tmp) > 0:
                print(" " + (" ".join("% 6i" % v for v in tmp)), file=f)
        print(file=f)

        # dihedrals
        print("% 7i !NPHI" % len(self.dihedrals), file=f)
        if len(self.dihedrals) > 0:
            tmp = []
            for dihedral in self.dihedrals:
                tmp.extend(dihedral+1)
                if len(tmp) >= 8:
                    print(" " + (" ".join("% 6i" % v for v in tmp[:8])), file=f)
                    tmp = tmp[8:]
            if len(tmp) > 0:
                print(" " + (" ".join("% 6i" % v for v in tmp)), file=f)
        print(file=f)

        # impropers
        print("% 7i !NIMPHI" % len(self.impropers), file=f)
        if len(self.impropers) > 0:
            tmp = []
            for improper in self.impropers:
                tmp.extend(improper+1)
                if len(tmp) >= 8:
                    print(" " + (" ".join("% 6i" % v for v in tmp[:8])), file=f)
                    tmp = tmp[8:]
            if len(tmp) > 0:
                print(" " + (" ".join("% 6i" % v for v in tmp)), file=f)
        print(file=f)

        # not implemented fields
        print("      0 !NDON", file=f)
        print(file=f)
        print("      0 !NNB", file=f)
        print(file=f)
        print("      0 !NGRP", file=f)
        print(file=f)
1124395
def dump(self, f):
        
        ret = libxml2mod.xmlDocDump(f, self._o)
        return ret
602108
def write_to_file(self, f):
        """"""
        for section, values in self._values.iteritems():
            try:
                section_name, subsection_name = section
            except ValueError:
                (section_name, ) = section
                subsection_name = None
            if subsection_name is None:
                f.write("[%s]\n" % section_name)
            else:
                f.write("[%s \"%s\"]\n" % (section_name, subsection_name))
            for key, value in values.iteritems():
                f.write("%s = %s\n" % (key, _escape_value(value)))
503795
def write(self, fptr):
        
        fptr.write(struct.pack('>I4s',
                               len(self.associations) * 4 + 8, b'nlst'))

        fmt = '>' + 'I' * len(self.associations)
        write_buffer = struct.pack(fmt, *self.associations)
        fptr.write(write_buffer)
1317259
def write(self, module):
        

        modname = module.__name__

        # Based on code in generate_autosummary_docs in https://git.io/fxpJS
        ns = {}
        ns['members'] = dir(module)
        ns['functions'] = list(map(lambda x: x.__name__,
                                   get_module_functions(module)))
        ns['classes'] = list(map(lambda x: x.__name__,
                                 get_module_classes(module)))
        ns['exceptions'] = list(map(lambda x: x.__name__,
                                    get_module_exceptions(module)))
        ns['fullname'] = modname
        ns['module'] = modname
        ns['objname'] = modname
        ns['name'] = modname.split('.')[-1]
        ns['objtype'] = 'module'
        ns['underline'] = len(modname) * '='
        rndr = self.template.render(**ns)

        rstfile = os.path.join(self.outpath, modname + '.rst')
        with open(rstfile, 'w') as f:
            f.write(rndr)
1230057
def save(self, fname=''):
        
        if fname != '':
            with open(fname, 'w') as f:
                for i in self.lstPrograms:
                    f.write(self.get_file_info_line(i, ','))

        
        # save to standard AIKIF structure
        
        filemap = mod_filemap.FileMap([], [])
        #location_fileList = filemap.get_full_filename(filemap.find_type('LOCATION'), filemap.find_ontology('FILE-PROGRAM')[0])     
        object_fileList = filemap.get_full_filename(filemap.find_type('OBJECT'), filemap.find_ontology('FILE-PROGRAM')[0])      
        print('object_fileList = ' + object_fileList + '\n')
        if os.path.exists(object_fileList):
            os.remove(object_fileList)
        self.lstPrograms.sort()

        try:
            with open(object_fileList, 'a') as f:
                f.write('\n'.join([i[0] for i in self.lstPrograms]))
        except Exception as ex:
            print('ERROR = cant write to object_filelist ' , object_fileList, str(ex))
915718
def write_data_file(self, data, fn, sort_cols=False, data_format=None):
        
        report.saved_raw_data[fn] = data
        util_functions.write_data_file(data, fn, sort_cols, data_format)
1150947
def write_libraries(dir, libraries):
  
  files = [open(os.path.join(dir, k), "w") for k, _ in libraries]
  # Document mentioned symbols for all libraries
  for f, (_, v) in zip(files, libraries):
    v.write_markdown_to_file(f)
  # Document symbols that no library mentioned.  We do this after writing
  # out all libraries so that earlier libraries know what later libraries
  # documented.
  for f, (_, v) in zip(files, libraries):
    v.write_other_members(f)
    f.close()
929781
def get_traceback(f):
  
  @functools.wraps(f)
  def wrapper(*args, **kwargs):
    try:
      return f(*args, **kwargs)
    except Exception, ex:
      ret = '#' * 60
      ret += "\nException caught:"
      ret += "\n" + '-' * 60
      ret += "\n" + traceback.format_exc()
      ret += "\n" + '-' * 60
      ret += "\n" + "#" * 60
      print sys.stderr, ret
      sys.stderr.flush()
      raise ex

  return wrapper
1119150
def write_to(self, f):
        
        f.write(self.version + "\r\n")
        for name, value in self.items():
            name = name.title()
            # Use standard forms for commonly used patterns
            name = name.replace("Warc-", "WARC-").replace("-Ip-", "-IP-").replace("-Id", "-ID").replace("-Uri", "-URI")
            f.write(name)
            f.write(": ")
            f.write(value)
            f.write("\r\n")
        
        # Header ends with an extra CRLF
        f.write("\r\n")
42997
def write_to(self, f):
        
        f = CodeWriter(f)

        # Write all header files
        headers = set()
        for plugin in self.plugins:
            headers = headers.union(plugin.header_files())
        for header in headers:
            f.writeln("#include <{}>".format(header))
        f.writeln("")

        # Write all declarations
        for plugin in self.plugins:
            plugin.write_declarations(f)
        f.writeln("")

        # Write the setup function
        with f._function("void", "setup"):
            # Setup all plugins
            f.writeln("// Setup all plugins")
            for plugin in self.plugins:
                plugin.setup_plugin(f)
            # Setup all modules
            f.writeln("// Setup all modules")
            for mod_name in self.modules.keys():
                for plugin in self.plugins:
                    plugin.setup_module(mod_name, f)
        f.writeln("")

        # Write the loop function
        with f._function("void", "loop"):
            # Update all plugins
            f.writeln("// Update all plugins")
            for plugin in self.plugins:
                plugin.update_plugin(f)
            # Update all modules
            f.writeln("// Update all modules")
            for mod_name, mod_info in self.modules.items():
                for plugin in self.plugins:
                    plugin.update_module(mod_name, f)

                # Read all module outputs
                for output_name in mod_info["outputs"]:
                    cond = "{mod_name}.get_{output_name}({msg_name})".format(
                        mod_name=mod_name, output_name=output_name,
                        msg_name=self.msg_name(mod_name, output_name)
                    )
                    with f._if(cond):
                        for plugin in self.plugins:
                            plugin.on_output(mod_name, output_name, f)

            # Read statuses of all modules
            f.writeln("// Read statuses of all modules")
            with f._if("should_read_statuses()"):
                for plugin in self.plugins:
                    plugin.start_read_module_status(f)
                for mod_name in self.modules:
                    for plugin in self.plugins:
                        plugin.read_module_status(mod_name, f)
                for plugin in self.plugins:
                    plugin.end_read_module_status(f)
337291
def _clean_file(self, f):
        ''''''
        if os.path.exists(f) and not os.path.islink(f):
            tmp_file = tempfile.TemporaryFile(mode='w+b')
            try:
                fh = open(f, 'r')
                data = fh.readlines()
                fh.close()
                if len(data) > 0: #if the file isn't empty:
                    for l in data:
                        new_l = self._clean_line(l)
                        tmp_file.write(new_l.encode('utf-8'))

                    tmp_file.seek(0)

            except Exception as e: # pragma: no cover
                self.logger.exception(e)
                raise Exception("CleanFile Error: Cannot Open File For Reading - %s" % f)

            try:
                if len(data) > 0:
                    new_fh = open(f, 'wb')
                    for line in tmp_file:
                        new_fh.write(line)
                    new_fh.close()
            except Exception as e: # pragma: no cover
                self.logger.exception(e)
                raise Exception("CleanFile Error: Cannot Write to New File - %s" % f)

            finally:
                tmp_file.close()
227060
def write_fmt(fp, fmt, *args):
    
    fmt = str(">" + fmt)
    fmt_size = struct.calcsize(fmt)
    written = write_bytes(fp, struct.pack(fmt, *args))
    assert written == fmt_size, 'written=%d, expected=%d' % (
        written, fmt_size
    )
    return written