Write a single XSO `x` to a binary file-like object `dest`.
433619
def write_single_xso(x, dest):
    
    gen = XMPPXMLGenerator(dest,
                           short_empty_elements=True,
                           sorted_attributes=True)
    x.unparse_to_sax(gen)
89247
def _write_bin(self, data, stream, byte_order):
        '''
        

        '''
        (len_t, val_t) = self.list_dtype(byte_order)

        data = _np.asarray(data, dtype=val_t).ravel()

        _write_array(stream, _np.array(data.size, dtype=len_t))
        _write_array(stream, data)
374577
function depsStream(deps) {
    var s = new stream.PassThrough({ objectMode: true });
    Rx.Node.writeToStream(deps, s);

    return function () {
        return s;
    };
}
1106533
def _write_bin(self, data, stream, byte_order):
        '''
        

        '''
        _write_array(stream, _np.dtype(self.dtype(byte_order)).type(data))
1287047
def write_libxc_docs_json(xcfuncs, jpath):
    """"""
    from copy import deepcopy
    xcfuncs = deepcopy(xcfuncs)

    # Remove XC_FAMILY from Family and XC_ from Kind to make strings more human-readable.
    for d in xcfuncs.values():
        d["Family"] = d["Family"].replace("XC_FAMILY_", "", 1)
        d["Kind"] = d["Kind"].replace("XC_", "", 1)

    # Build lightweight version with a subset of keys.
    for num, d in xcfuncs.items():
        xcfuncs[num] = {k: d[k] for k in ("Family", "Kind", "References")}
        # Descriptions are optional
        for opt in ("Description 1", "Description 2"):
            desc = d.get(opt)
            if desc is not None: xcfuncs[num][opt] = desc

    with open(jpath, "wt") as fh:
        json.dump(xcfuncs, fh)

    return xcfuncs
100208
function copyFile(source, dest) {

  fs.stat(dest, function (err, stats) {

    // If there was an error that is NOT that the file doesn't exist, then throw it.
    if (err && err.code !== 'ENOENT') {
      throw new Error(err);
    }

    // If the file exists then skip it.
    if (typeof stats === 'object') {
      process.stdout.write(`File exists: skipping (${dest})\n`);
    }

    return fs.createReadStream(source)
      .pipe(fs.createWriteStream(dest));

  });

}
429308
function copyFile(src, dest) {
      var content = fs.readFileSync(src, 'binary');
      fs.writeFileSync(dest, content, 'binary');
    }
177843
def _write_bin(self, stream, byte_order):
        '''
        

        '''
        for rec in self.data:
            for prop in self.properties:
                prop._write_bin(rec[prop.name], stream, byte_order)
674108
def mergecopy(src, dest):
    
    if os.path.exists(dest) and os.stat(dest).st_mtime >= os.stat(src).st_mtime:
        return
    copy2(src, dest)
789624
def read_single_xso(src, type_):
    

    result = None

    def cb(instance):
        nonlocal result
        result = instance

    read_xso(src, {type_: cb})

    return result
1107240
def binary_stream(stream):
    
    try:
        import os
        if os.name == 'nt':
            fileno = getattr(stream, 'fileno', None)
            if fileno:
                no = fileno()
                if no >= 0:     # -1 means we're working as subprocess
                    import msvcrt
                    msvcrt.setmode(no, os.O_BINARY)
    except ImportError:
        pass
    return stream
643477
def copy_func(dest, src, symlinks=True):
    

    dest = str(dest)
    src = str(src)

    SCons.Node.FS.invalidate_node_memos(dest)
    if SCons.Util.is_List(src) and os.path.isdir(dest):
        for file in src:
            shutil.copy2(file, dest)
        return 0
    elif os.path.islink(src):
        if symlinks:
            return os.symlink(os.readlink(src), dest)
        else:
            return copy_func(dest, os.path.realpath(src))
    elif os.path.isfile(src):
        shutil.copy2(src, dest)
        return 0
    else:
        shutil.copytree(src, dest, symlinks)
        # copytree returns None in python2 and destination string in python3
        # A error is raised in both cases, so we can just return 0 for success
        return 0
51667
def _store_binary(self, local_path, remote):
        """"""
        # Destination directory
        dst_dir = os.path.dirname(remote)

        # Destination file name
        dst_file = os.path.basename(remote)

        # File upload command
        dst_cmd = 'STOR {0}'.format(dst_file)

        with open(local_path, 'rb') as local_file:
            # Change directory if needed
            if dst_dir != dst_file:
                self.chdir(dst_dir, make=True)

            # Upload file & return response
            return self.session.storbinary(dst_cmd, local_file)
311359
def save_binary(self, fname, silent=True):
        
        _check_call(_LIB.XGDMatrixSaveBinary(self.handle,
                                             c_str(fname),
                                             int(silent)))
158649
def asxc(cls, obj):
        """"""
        if isinstance(obj, cls): return obj
        if is_string(obj): return cls.from_name(obj)
        raise TypeError("Don't know how to convert <%s:%s> to Xcfunc" % (type(obj), str(obj)))
895023
def copyfileobj(fsrc, fdst, length=16*1024):
    """"""
    while 1:
        buf = fsrc.read(length)
        if not buf:
            break
        fdst.write(buf)
439060
def to_sax(self, instance, dest):
        

        value = self.__get__(instance, type(instance))
        if value == self.default:
            return

        if self.declare_prefix is not False and self.tag[0]:
            dest.startPrefixMapping(self.declare_prefix, self.tag[0])
        dest.startElementNS(self.tag, None, {})
        try:
            dest.characters(self.type_.format(value))
        finally:
            dest.endElementNS(self.tag, None)
            if self.declare_prefix is not False and self.tag[0]:
                dest.endPrefixMapping(self.declare_prefix)