Saves the VPK at the given path
193857
def save(self, vpk_output_path):
        
        with fopen(vpk_output_path, 'wb') as f:
            # write VPK1 header
            f.write(struct.pack("3I", self.signature,
                                      self.version,
                                      self.tree_length))

            self.header_length = f.tell()

            data_offset = self.header_length + self.tree_length

            # write file tree
            for ext in self.tree:
                f.write("{0}\x00".format(ext).encode('latin-1'))

                for relpath in self.tree[ext]:
                    f.write("{0}\x00".format(relpath).encode('latin-1'))

                    for filename in self.tree[ext][relpath]:
                        f.write("{0}\x00".format(filename).encode('latin-1'))

                        # append file data
                        metadata_offset = f.tell()
                        file_offset = data_offset
                        real_filename = filename if not ext else "{0}.{1}".format(filename, ext)
                        checksum = 0
                        f.seek(data_offset)

                        with fopen(os.path.join(self.path,
                                                '' if relpath == ' ' else relpath,
                                                real_filename
                                                ),
                                   'rb') as pakfile:
                            for chunk in iter(lambda: pakfile.read(1024), b''):
                                checksum = crc32(chunk, checksum)
                                f.write(chunk)

                        data_offset = f.tell()
                        file_length = f.tell() - file_offset
                        f.seek(metadata_offset)

                        # metadata

                        # crc32
                        # preload_length
                        # archive_index
                        # archive_offset
                        # file_length
                        # suffix
                        f.write(struct.pack("IHHIIH", checksum & 0xFFffFFff,
                                                      0,
                                                      0x7fff,
                                                      file_offset - self.tree_length - self.header_length,
                                                      file_length,
                                                      0xffff
                                                      ))


                    # next relpath
                    f.write(b"\x00")
                # next ext
                f.write(b"\x00")
            # end of file tree
            f.write(b"\x00")
918044
def save(self, path):
        
        (folder, filename) = os.path.split(path)
        if not filename:
            filename = _clean_filename(self.name)
            path = os.path.join(folder, filename)
        return self.waveform.save(path)
301314
def store_pickle(file_path, data):
    
    pkl_file = open(file_path, 'wb')
    pickle.dump(data, pkl_file)
    pkl_file.close()
953675
def saveAs(self, path):
        
        if not path:
            path = self._dialogs.getSaveFileName(filter='*.csv')
        if path:
            self._setPath(path)
            with open(str(self._path), 'wb') as stream:
                writer = csv.writer(stream)
                table = self.table()
                for row in table:
                    writer.writerow(row)
146033
def save(self, path, key, format, data):
        
        thumbpath = self.get_thumbpath(path, key, format)
        fullpath = os.path.join(self.out_path, thumbpath)
        self.save_thumb(fullpath, data)
        url = self.get_url(thumbpath)
        thumb = Thumb(url, key, fullpath)
        return thumb
561724
function(path) {
      var code = require('fs').readFileSync(path);
      var context = vm.createContext(initContext);
      context.flow = _conn.flow;
      vm.runInContext(code, context);
      for (var key in context) {
        if (!initContext[key]) {
          global[key] = context[key];
        }
      }
    }
1257310
def save(self, path):
        ''' 
        '''
        # IMPORTANT WARNING: saves entire source video
        self.clip.write_videofile(path, audio_fps=self.clip.audio.fps)
549670
def save(self, path):
        
        writer = csv.writer(open(path, 'w', newline=''), delimiter=' ')
        rows = list(self.items())
        rows.sort(key=lambda x: x[0])
        writer.writerows(rows)
859892
def _save(self, url, path, data):
        """"""
        worker = self._workers[url]
        path = self._paths[url]

        if len(data):
            try:
                with open(path, 'wb') as f:
                    f.write(data)
            except Exception:
                logger.error((url, path))

        # Clean up
        worker.finished = True
        worker.sig_download_finished.emit(url, path)
        worker.sig_finished.emit(worker, path, None)
        self._get_requests.pop(url)
        self._workers.pop(url)
        self._paths.pop(url)
1241858
def save_pdf(path):
  

  pp = PdfPages(path)
  pp.savefig(pyplot.gcf())
  pp.close()
1264401
def mkdir(name, path):
    '''
    '''
    with Session() as session:
        try:
            session.VFolder(name).mkdir(path)
            print_done('Done.')
        except Exception as e:
            print_error(e)
            sys.exit(1)
62600
def add_to_path(p):
    '''
        
    '''
    old_path = sys.path
    if p not in sys.path:
        sys.path = sys.path[:]
        sys.path.insert(0, p)
    try:
        yield
    finally:
        sys.path = old_path
1011958
def save(path,data)
     
      File.open(path,'w') do |file|
        file.puts data
      end

      if File.exists?(path)
        `pl -input #{path} -output #{path}`
      end

    end
1053609
def save(filepath=None, **kwargs):
    
    if filepath is None:
        filepath = os.path.join('.env')

    with open(filepath, 'wb') as file_handle:
        file_handle.writelines(
            '{0}={1}\n'.format(key.upper(), val)
            for key, val in kwargs.items()
        )
1345762
function saveDirs(path, obj, cb) {
  var currDir = ''
  var root    = ''

  walk.walk(path, walkFn, function(err) {
    if (err) return cb(err)
    cb(null, obj)
  })

  function walkFn(baseDir, filename, stat, next) {
    if (!root) root = baseDir
    baseDir = stripLeadingSlash(baseDir.split(root)[1])

    if (!baseDir) return next()
    if (obj[baseDir]) return next()

    if (baseDir != currDir) currDir = baseDir

    if (stat.isDirectory()) {
      setObject(baseDir, obj, {})
      return next()
    }

    setObject(baseDir, obj, [])
    next()
  }
}
832273
def save(self, path):
        
        with open(path, 'w') as out_file:
            json.dump(self.to_dict(), out_file, indent=4)
656932
function save(filePath, content) {
    mkpath(PATH.dirname(filePath));
    fs.writeFileSync(filePath, content);
}