Write a file of any type to the destination path. Useful for files like
		robots.txt, manifest.json, and so on.

		Args:
		  path (str): The name of the file to write to.
		  contents (str or bytes): The contents to write.
962796
def write_file(self, path, contents):
		
		path = self._get_dist_path(path)
		if not os.path.isdir(os.path.dirname(path)):
			os.makedirs(os.path.dirname(path))
		if isinstance(contents, bytes):
			mode = 'wb+'
		else:
			mode = 'w'
		with open(path, mode) as file:
			file.write(contents)
1227136
def write_content_to_file(file_path, content)
      File.open(file_path, 'w') do |f|
        f.write content
      end
    end
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))
444053
def persist(self, path_to_file):
        
        with open(path_to_file, 'wb') as f:
            f.write(self.data)
1139931
def write_file(file_path, txt, **kws):
    
    if not os.path.exists(file_path):
        upDir = os.path.dirname(file_path)
        if not os.path.isdir(upDir):
            os.makedirs(upDir)

    kw = {"mode":"w", "encoding":"utf-8"}
    if kws:
        for k,v in kws.items():
            kw[k] = v
    with open(file_path, **kw) as afile:
        afile.write(txt)
724376
def file_put_contents(path, data):
    
    with open(path, 'w') as f:
        f.write(data); f.flush()
410190
def copy_file(self, path):
        
        if "*" in path:
            paths = _expand_paths(path)
            if paths:
                for path in paths:
                    self._copy_file(path)
        else:
            if os.path.isfile(path):
                return self._copy_file(path)
            else:
                logger.debug("File %s does not exist", path)
                return False
1056408
def contents(self, path=None):
        
        if isinstance(path, object) and hasattr(path, 'name'):
            log.debug("passed an object, use .'name' as path value")
            # passed an object, use .'name' as path value
            path = '/%s' % path.name
        c = self._jfs.get('%s%s' % (self.path, path or '/'))
        return c
406225
def _write_object(self, path, value):
    ''''''
    ensure_directory_exists(os.path.dirname(path))

    with open(path, 'w') as f:
      f.write(value)
33186
def write(path, content, encoding="UTF-8", append=False, raw=False):
    """"""
    mode = 'wb' if not append else 'ab'
    with OPEN_FUNC(path, mode) as _file:
        if raw:
            import shutil
            shutil.copyfileobj(content, _file)
        else:
            _file.write(content.encode(encoding))
832273
def save(self, path):
        
        with open(path, 'w') as out_file:
            json.dump(self.to_dict(), out_file, indent=4)
663946
def write_config(path, config):
    
    config_as_string = to_nice_yaml(config)

    config_as_string = "---\n" + config_as_string

    string_to_file(path, config_as_string)
1136918
private static void writeFile(final HttpQuery query,
                                final String path,
                                final byte[] contents) {
    try {
      final FileOutputStream out = new FileOutputStream(path);
      try {
        out.write(contents);
      } finally {
        out.close();
      }
    } catch (FileNotFoundException e) {
      logError(query, "Failed to create file " + path, e);
    } catch (IOException e) {
      logError(query, "Failed to write file " + path, e);
    }
  }
1362993
def write(self, path):
        """"""
        with open(path, 'wb') as f:
            f.write(self.getXML())
175223
def write_json_or_yaml(file_path, content):
    
    with codecs.open(file_path, "w", "utf-8") as f:
        f.write(get_json_or_yaml(file_path, content))
262990
def save(self, path):
        
        with open(path, 'w') as f:
            f.write(self.contents())
993681
def write_file(file_path, content):
    
    handler = open(file_path, 'w+')
    handler.write(content)
    handler.close()