Save a PLY element to a binary PLY file.  The element may
        contain list properties.
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)
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)
1334541
def save_to(self, file):
        """"""
        dest = file

        if hasattr(dest, 'write'):
            # writing to a file-like
            # only works when no unicode conversion is done
            if self.file is not None and\
                    getattr(self.file, 'encoding', None) is None:
                copyfileobj(self.file, dest)
            elif self.filename is not None:
                with open(self.filename, 'rb') as inp:
                    copyfileobj(inp, dest)
            else:
                dest.write(self.__bytes__())
        else:
            # we do not use filesystem io to make sure we have the same
            # permissions all around
            # copyfileobj() should be efficient enough

            # destination is a filename
            with open(dest, 'wb') as out:
                return self.save_to(out)
1031231
def saveFileTo(self, cur, encoding):
        
        if cur is None: cur__o = None
        else: cur__o = cur._o
        ret = libxml2mod.xmlSaveFileTo(self._o, cur__o, encoding)
        return ret
99822
def save(self, data, xparent=None):
        
        if xparent is not None:
            elem = ElementTree.SubElement(xparent, 'dict')
        else:
            elem = ElementTree.Element('dict')

        for key, value in sorted(data.items()):
            xitem = ElementTree.SubElement(elem, 'item')
            xitem.set('key', nstr(key))
            XmlDataIO.toXml(value, xitem)

        return elem
734606
def save(self, filename, encoding ='ISO-8859-1', standalone='no'):
        
        f = codecs.open(filename, 'w', encoding)
        s = self.wrap_xml(self.getXML(), encoding, standalone)
        #s = s.replace("&", "&amp;")
        f.write(s)
        f.close()
1111426
def save(file=nil,format=nil,opts={})
      format = @format if format.nil?
      file = @filename if file.nil?

      if format != FORMAT_BINARY && format != FORMAT_XML && format != FORMAT_PLAIN
        raise CFFormatError.new("Format #{format} not supported, use List::FORMAT_BINARY or List::FORMAT_XML")
      end

      if(!File.exists?(file)) then
        raise IOError.new("File #{file} not writable!") unless File.writable?(File.dirname(file))
      elsif(!File.writable?(file)) then
        raise IOError.new("File #{file} not writable!")
      end

      opts[:root] = @value
      opts[:formatted] = @formatted unless opts.has_key?(:formatted)

      prsr = @@parsers[format-1].new

      content = prsr.to_str(opts)

      File.open(file, 'wb') {
        |fd|
        fd.write content
      }
    end
938553
def _save_payload(self, files, directories, links):
        '''
        
        '''

        idx = 0
        for p_type, p_list in (('f', files), ('d', directories), ('l', links,),):
            for p_obj in p_list:
                stats = os.stat(p_obj)

                payload = PayloadFile()
                payload.id = idx
                payload.path = p_obj
                payload.p_type = p_type
                payload.mode = stats.st_mode
                payload.uid = stats.st_uid
                payload.gid = stats.st_gid
                payload.p_size = stats.st_size
                payload.atime = stats.st_atime
                payload.mtime = stats.st_mtime
                payload.ctime = stats.st_ctime

                idx += 1
                self.db.store(payload)
1362840
def serializeEc(P, compress=True):
    
    return _serialize(P, compress, librelic.ec_size_bin_abi,
        librelic.ec_write_bin_abi)
866716
def save(self, segids, filepath=None, file_format='ply'):
    
    if type(segids) != list:
      segids = [segids]

    meshdata = self.get(segids)

    if not filepath:
      filepath = str(segids[0]) + "." + file_format
      if len(segids) > 1:
        filepath = "{}_{}.{}".format(segids[0], segids[-1], file_format)

    if file_format == 'obj':
      objdata = mesh_to_obj(meshdata, progress=self.vol.progress)
      objdata = '\n'.join(objdata) + '\n'
      data = objdata.encode('utf8')
    elif file_format == 'ply':
      data = mesh_to_ply(meshdata)
    else:
      raise NotImplementedError('Only .obj and .ply is currently supported.')

    with open(filepath, 'wb') as f:
      f.write(data)
1185097
def binary(self):
        
        if isinstance(self.value, list):
            length = len(self.value)
            if length == 0:
                return b_chr(_TAG_NIL_EXT)
            elif length > 4294967295:
                raise OutputException('uint32 overflow')
            elif self.improper:
                return (
                    b_chr(_TAG_LIST_EXT) +
                    struct.pack(b'>I', length - 1) +
                    b''.join([_term_to_binary(element)
                              for element in self.value])
                )
            else:
                return (
                    b_chr(_TAG_LIST_EXT) +
                    struct.pack(b'>I', length) +
                    b''.join([_term_to_binary(element)
                              for element in self.value]) +
                    b_chr(_TAG_NIL_EXT)
                )
        else:
            raise OutputException('unknown list type')
311552
def save_xml(self, doc, element):
        ''''''
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'componentId',
                               self.component_id)
        element.setAttributeNS(RTS_NS, RTS_NS_S + 'instanceName',
                               self.instance_name)
        for p in self.properties:
            new_prop_element = doc.createElementNS(RTS_EXT_NS,
                                                   RTS_EXT_NS_S + 'Properties')
            properties_to_xml(new_prop_element, p, self.properties[p])
            element.appendChild(new_prop_element)
343211
def save(self, filename):
        
        projex.text.xmlindent(self.xmlElement())
        
        try:
            f = open(filename, 'w')
        except IOError:
            logger.exception('Could not save file: %s' % filename)
            return False
            
        f.write(self.toString())
        f.close()
        return True
33522
def put(self, item):
        
        check_not_none(item, "Value can't be None")
        element_data = self._to_data(item)
        return self._encode_invoke(queue_put_codec, value=element_data)
988075
def save(self, name):
        
        self.finalize()
        with open(name, 'wb+') as f:
            if six.PY3:
                f.write(self.fileobj.getbuffer())
            else:
                f.write(self.fileobj.getvalue().encode('utf-8'))
681253
def save(self):
        
        l = []
        h = {}
        s = {}
        h_r = {}

        idx = 0
        for i in self.map_list.get_obj():
            length = 0

            if isinstance(i, list):
                for j in i:
                    if isinstance(j, AnnotationsDirectoryItem):
                        if idx % 4 != 0:
                            idx = idx + (4 - (idx % 4))

                    l.append(j)

                    c_length = j.get_length()
                    if isinstance(j, StringDataItem):
                        c_length += 1
                    h[j] = idx + length
                    h_r[idx + length] = j
                    s[idx + length] = c_length

                    length += c_length
                    #debug("SAVE" + str(j) + " @ 0x%x" % (idx+length))

                debug("SAVE " + str(i[0]) + " @0x%x (%x)" % (idx, length))

            else:
                if isinstance(i, MapList):
                    if idx % 4 != 0:
                        idx = idx + (4 - (idx % 4))

                l.append(i)
                h[i] = idx
                h_r[idx] = i

                length = i.get_length()

                s[idx] = length

                debug("SAVE " + str(i) + " @0x%x (%x)" % (idx, length))

            idx += length

        self.header.file_size = idx

        for i in l:
            idx = h[i]
            i.set_off(idx)
            if isinstance(i, CodeItem):
                last_idx = idx
                for j in i.get_obj():
                    j.set_off(last_idx)
                    #j.set_debug_info_off(0)
                    last_idx += j.get_size()

        last_idx = 0
        buff = ""
        for i in l:
            idx = h[i]

            if idx != last_idx:
                debug("Adjust alignment @%x with 00 %x" % (idx, idx - last_idx))
                buff += "\x00" * (idx - last_idx)

            buff += i.get_raw()
            if isinstance(i, StringDataItem):
                buff += "\x00"
            last_idx = idx + s[idx]

        debug("GLOBAL SIZE %d" % len(buff))

        return self.fix_checksums(buff)
693299
def save(self, target, ensure_ascii=True):
        
        mode = 'w'
        encoding = 'utf-8'
        if six.PY2:
            mode = 'wb'
            encoding = None
        helpers.ensure_dir(target)
        with io.open(target, mode=mode, encoding=encoding) as file:
            json.dump(self.__current_descriptor, file, indent=4, ensure_ascii=ensure_ascii)