Save/update docs under destination directory.
176240
def save(ctx, dest="docs.html", format="html"):
    """"""
    print("STEP: Generate docs in HTML format")
    build(ctx, builder=format)

    print("STEP: Save docs under %s/" % dest)
    source_dir = Path(ctx.config.sphinx.destdir)/format
    Path(dest).rmtree_p()
    source_dir.copytree(dest)

    # -- POST-PROCESSING: Polish up.
    for part in [ ".buildinfo", ".doctrees" ]:
        partpath = Path(dest)/part
        if partpath.isdir():
            partpath.rmtree_p()
        elif partpath.exists():
            partpath.remove_p()
497009
def set_save_directory(base, source):
    
    root = os.path.join(base, source)
    if not os.path.isdir(root):
        os.makedirs(root)

    world.screenshot_root = root
33388
def save_doc(self, doc, doc_id=None, following_attachments=None):
        ''''''

        self.log("save_document called for doc: %r", doc)

        d = defer.Deferred()

        try:
            if not isinstance(doc, (str, unicode, )):
                raise ValueError('Doc should be either str or unicode')
            doc = json.loads(doc)
            doc = self._set_id_and_revision(doc, doc_id)

            self.increase_stat('save_doc')

            self._documents[doc['_id']] = doc
            if doc['_id'] not in self._attachments:
                self._attachments[doc['_id']] = dict()
            attachments = doc.get('_attachments', dict())
            for name in attachments:
                if attachments[name].get('follows'):
                    if name not in following_attachments:
                        raise ValueError("Document id %s had attachment name"
                                         " %s marked with follows=True, but"
                                         " it was not passed to save_doc() "
                                         % (doc['_id'], name))

                    del attachments[name]['follows']
                    attachments[name]['stub'] = True
                    b = following_attachments[name].get_body()
                    self._attachments[doc['_id']][name] = b

                elif name not in self._attachments[doc['_id']]:
                    raise ValueError("Document id %s body has attachment "
                                     "named %s "
                                     "but it is not in our cache " %
                                     (doc['_id'], name))
            for name in self._attachments[doc['_id']].keys():
                if name not in attachments:
                    del self._attachments[doc['_id']][name]
                    self.log('Deleted attachment %s of the doc: %s because '
                             'its not in the _attachments key' %
                             (name, doc['_id']))

            self._expire_cache(doc['_id'])

            r = Response(ok=True, id=doc['_id'], rev=doc['_rev'])
            self._analize_changes(doc)
            d.callback(r)
        except (ConflictError, ValueError, ) as e:
            d.errback(e)

        return d
1371998
def save(self):
        # type: () -> None
        
        self._ensure_have_load_only()

        for fname, parser in self._modified_parsers:
            logger.info("Writing to %s", fname)

            # Ensure directory exists.
            ensure_dir(os.path.dirname(fname))

            with open(fname, "w") as f:
                parser.write(f)
1331246
def _write_docs(module_list, output_dir):
    ''''''
    for module_meta in module_list:
        directory = module_meta['directory']
        # Ensure target directory
        if directory and not path.isdir(directory):
            makedirs(directory)

        # Write the file
        file = open(module_meta['output'], 'w')
        file.write(module_meta['content'])
        file.close()
254993
def save_dir(key, dir_path, *refs):
    
    if not os.path.isdir(dir_path):
        return error(
            "Output '{}' set to a missing directory: '{}'.".format(key, dir_path)
        )

    result = {key: {"dir": dir_path}}

    if refs:
        missing_refs = [
            ref for ref in refs if not (os.path.isfile(ref) or os.path.isdir(ref))
        ]
        if len(missing_refs) > 0:
            return error(
                "Output '{}' set to missing references: '{}'.".format(
                    key, ', '.join(missing_refs)
                )
            )
        result[key]["refs"] = refs

    return json.dumps(result)
1033317
def save(dir = Dir.pwd, options = {})
      prefix = options[:prefix] if options.key?(:prefix)
      write_file(File.join(dir, "#{prefix}#{lang}.yml"), options)
    end
990635
def save(self, to_dir, compressionlevel=9):
        
        """
        if os.path.exists(to_dir) and not os.path.isdir(to_dir):
            raise Exception('Not a directory : %s' % to_dir)
        elif not os.path.exists(to_dir):
            os.makedirs(to_dir, mode=int('0755', 8))
        _save(os.path.join(to_dir, FILE_USER_FST_DATA), self.compiledFST[0], compressionlevel)
        _save(os.path.join(to_dir, FILE_USER_ENTRIES_DATA), pickle.dumps(self.entries), compressionlevel)
932424
def save(self):
        """"""
        data = str.encode( json.dumps(self.simpleAttrs, indent=4, sort_keys=True) )
        with open(self.filename, "wb") as f:
            f.write(data)
749430
def save_file(path, text):
    
    dir = os.path.dirname(path)
    if not os.path.exists(dir):
        os.makedirs(dir)

    fd = open(path, 'w')
    try:
        fd.write(text)
    finally:
        fd.close()
1300181
function moveFilesToRoot(subdir) {
  return exec(`mv ${docPath}/${subdir}/* ${docPath}`)
    .then(() => {
      exec(`rmdir ${docPath}/${subdir}`);
    })
    .catch(e => console.error(e));
}
545515
def save_files(self, selections) -> None:
        """"""
        try:
            currentpath = self.currentpath
            selections = selectiontools.Selections(selections)
            for selection in selections:
                if selection.name == 'complete':
                    continue
                path = os.path.join(currentpath, selection.name+'.py')
                selection.save_networkfile(filepath=path)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to save selections `%s` into network files'
                % selections)
492453
def export(self, output_folder):
        """"""
        if not os.path.exists(output_folder):
            os.makedirs(output_folder)
        self._interact_with_folder(output_folder, 'w')
1026686
def copyFunc(dest, source, env):
    """"""

    if os.path.isdir(source):
        if os.path.exists(dest):
            if not os.path.isdir(dest):
                raise SCons.Errors.UserError("cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source)))
        else:
            parent = os.path.split(dest)[0]
            if not os.path.exists(parent):
                os.makedirs(parent)
        scons_copytree(source, dest)
    else:
        shutil.copy2(source, dest)
        st = os.stat(source)
        os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)

    return 0
721433
def setdirs(outfiles):
    """"""
    for k in outfiles:
        fname=outfiles[k]
        dname= os.path.dirname(fname)
        if not os.path.isdir(dname):
            os.mkdir(dname)
598458
def saveto(self, path, sortkey = True):
        
        with open(path, 'w') as f:
            self.savetofile(f, sortkey)
831119
function copyDoc (docSrc, docDest, opts0, callback0) {
      const { opts, callback } = getCallback(opts0, callback0)

      const qs = {
        db: dbName,
        doc: docSrc,
        method: 'COPY',
        headers: { 'Destination': docDest }
      }

      if (opts.overwrite) {
        const p = headDoc(docDest).then(
          function (h) {
            if (h.etag) {
              qs.headers.Destination += '?rev=' +
                h.etag.substring(1, h.etag.length - 1)
            }
            relax(qs, callback)
          },
          function (e) {
            if (e && e.statusCode !== 404) {
              if (callback) {
                callback(e)
              } else {
                return Promise.reject(e)
              }
            } else {
              relax(qs, callback)
            }
          }
        )
        if (!callback) {
          return p
        }
      } else {
        return relax(qs, callback)
      }
    }