save a directory to a certain alias/nickname
963888
def saveDirectory(alias):
	""""""
	if not settings.platformCompatible():
		return False
	dataFile = open(settings.getDataFile(), "wb")
	currentDirectory = os.path.abspath(".")
	directory = {alias : currentDirectory}
	pickle.dump(directory, dataFile)
	speech.success(alias + " will now link to " + currentDirectory + ".")
	speech.success("Tip: use 'hallie go to " + alias + "' to change to this directory.")
640476
def setDirname(self, dirname):
        
        # Make sure the dirname always ends in
        # a path separator character
        sep = utils._getPathSep(dirname)
        if not dirname.endswith(sep):
            dirname += sep

        self._dir = utils.asString(dirname)
1218637
def include_dir(self, root):
        """"""
        parts = [root]
        parts.extend(self.pathname.split(os.path.sep))
        return "/".join(parts)
153323
function Alias () {

  var home = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'],
      aliasFile = path.resolve(home + '/.pa/aliases.json');

  var writeAliases = function (aliases) {
    fs.writeFileSync(aliasFile, JSON.stringify(aliases, null, 2));
  };

  this.init = function () {
    if (!fs.existsSync(aliasFile)) {
      this.install();
    }
    this.aliases = require(aliasFile);
    return this;
  };

  this.install = function () {
    if (!fs.existsSync(path.resolve(home + '/.pa/'))) {
      fs.mkdirSync(path.resolve(home + '/.pa/'));
    }
    writeAliases(defaultAliases);
  };

  this.list = function () {
    var tmp, list = '';
    for (tmp in this.aliases) {
      list += '\n' + tmp + '=' + this.aliases[tmp];
    }
    return list.substr(1).green;
  };

  this.get = function (key) {
    var tmp;
    for (tmp in this.aliases) {
      if (this.aliases[tmp] === key) {
        return tmp.green;
      }
    }
    return ("no alias for '" + key + "'").red;
  };

  this.set = function (key, value) {
    this.aliases[key] = value;
    writeAliases(this.aliases);
    return ("set alias '" + key + "' for '" + value + "'").green;
  };

  this.trigger = function (argv) {
    if (typeof argv.alias !== 'string') {
      return this.list();
    }
    return argv._[0] ? this.set(argv._[0], argv.alias) : this.get(argv.alias);
  };

}
1131414
def _options_dir(name):
    '''
    
    '''
    _check_portname(name)
    _root = '/var/db/ports'

    # New path: /var/db/ports/category_portname
    new_dir = os.path.join(_root, name.replace('/', '_'))
    # Old path: /var/db/ports/portname
    old_dir = os.path.join(_root, name.split('/')[-1])

    if os.path.isdir(old_dir):
        return old_dir
    return new_dir
1157254
def save_files(self):
        """"""
        while True:
            try:
                os.mkdir(self.output_name)
            except Exception as e:
                self.output_name = raw_input("This directory already exists - please enter a new name:")
            else:
                break
        self.workdir = os.getcwd()
        os.chdir(self.workdir+"/"+self.output_name)
1061256
def MakeDestinationKey(directory, filename):
  """"""
  return utils.SmartStr(utils.JoinPath(directory, filename)).lstrip("/")
1112866
def save(self, foldername: str, path_to_folder: str=None) -> None:
        '''  '''
        self.create_pickle((self.g.namespaces, ))
        self.df.to_pickle(output)
1296120
def put_alias(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.put_alias(index=self._name, **kwargs)
714198
def select_directory(self):
        """"""
        basedir = to_text_string(self.wd_edit.text())
        if not osp.isdir(basedir):
            basedir = getcwd_or_home()
        directory = getexistingdirectory(self, _(""), basedir)
        if directory:
            self.wd_edit.setText(directory)
            self.dir = directory
235710
function mkdirIfNotExists(relativePath) {
    const dir = path.join(__dirname, relativePath);
    let stat;
    try {
        stat = fs.statSync(dir);
    } catch (e) {
        fs.mkdirSync(dir);
    }
}
1267419
def write_to_directory(self, dataset_info_dir):
    """"""
    # Save the metadata from the features (vocabulary, labels,...)
    if self.features:
      self.features.save_metadata(dataset_info_dir)

    if self.redistribution_info.license:
      with tf.io.gfile.GFile(self._license_filename(dataset_info_dir),
                             "w") as f:
        f.write(self.redistribution_info.license)

    with tf.io.gfile.GFile(self._dataset_info_filename(dataset_info_dir),
                           "w") as f:
      f.write(self.as_json)
981276
def save_to(self, nameprefix, switch=False):
        
        if not nameprefix or not isinstance(nameprefix, basestring):
            raise _Error('filename prefix must be a nonempty string')

        if nameprefix == self.default_prefix:
            raise _Error('cannot save to default name "' + nameprefix + '...", chose another name')

        if nameprefix == self.name_prefix:
            return

        for name in self.file_names:
            open(nameprefix + name + '.dat', 'w').write(open(self.name_prefix + name + '.dat').read())

        if switch:
            self.name_prefix = nameprefix
801654
def cli(ctx):
    """"""
    dir_path = os.path.join(os.path.expanduser('~'), '.keep', '.credentials')
    if os.path.exists(dir_path):
        if click.confirm('[CRITICAL] Reset credentials saved in ~/.keep/.credentials ?', abort=True):
            os.remove(dir_path)
    utils.register()
177671
def ensure_directory(path):
    """"""
    dirname = os.path.dirname(path)
    py31compat.makedirs(dirname, exist_ok=True)
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
1194802
def save_to_eitdir(self, directory):
        
        if os.path.isdir(directory):
            raise Exception('output directory already exists')

        os.makedirs(directory)
        np.savetxt(directory + os.sep + 'frequencies.dat', self.frequencies)

        invmod_dir = directory + os.sep + 'invmod'
        os.makedirs(invmod_dir)
        for nr, key in enumerate(sorted(self.tds.keys())):
            outdir = invmod_dir + os.sep + '{0:02}_{1:.6f}'.format(nr, key)
            self.tds[key].save_to_tomodir(outdir)