Write Renku configuration.
353191
def write_config(config, path, final=False):
    """"""
    with open(config_path(path, final=final), 'w+') as configfile:
        yaml.dump(config, configfile, default_flow_style=False)
897902
function writeBaseConfiguration()
    {
        if (! $this->files->exists($this->path())) {
            $this->write(['tld' => 'test', 'paths' => []]);
        }

        /**
         * Migrate old configurations from 'domain' to 'tld'
         */
        $config = $this->read();

        if (isset($config['tld'])) {
            return;
        }

        $this->updateKey('tld', !empty($config['domain']) ? $config['domain'] : 'test');
    }
1317128
def save_config(name, data, base='conf'):
    """"""
    if not os.path.exists(base):
        os.mkdir(base)
    fname = pjoin(base, name+'.json')
    with open(fname, 'w') as f:
        json.dump(data, f, indent=2)
386889
def write_config(data, conf_dir=DEFAULT_CONFIG_DIR, codec="yaml",
                 backup_existing=False):
    
    if not codec:
        codec = 'yaml'
    codec = munge.get_codec(codec)()
    conf_dir = os.path.expanduser(conf_dir)
    if not os.path.exists(conf_dir):
        os.mkdir(conf_dir)

    # Check for existing file, back up if necessary
    outpath = os.path.join(conf_dir, 'config.' + codec.extensions[0])
    if backup_existing and os.path.exists(outpath):
        os.rename(outpath, outpath + '.bak')
    codec.dump(data, open(outpath, 'w'))
1039293
function writeJSONConfigFile(config, filePath) {
    debug(`Writing JSON config file: ${filePath}`);

    const content = stringify(config, { cmp: sortByKey, space: 4 });

    fs.writeFileSync(filePath, content, "utf8");
}
1371298
def write_config(config, config_path=CONFIG_PATH):
    
    if not os.path.exists(config_path):
        os.makedirs(os.path.dirname(config_path))
    with open(config_path, 'w', encoding='utf-8') as f:
        config.write(f)
1286900
def write(obj, data=None, **kwargs):
    
    if obj.REDIS_ENABLED_FOR_DYNACONF is False:
        raise RuntimeError(
            "Redis is not configured \n"
            "export REDIS_ENABLED_FOR_DYNACONF=true\n"
            "and configure the REDIS_FOR_DYNACONF_* variables"
        )
    client = StrictRedis(**obj.REDIS_FOR_DYNACONF)
    holder = obj.get("ENVVAR_PREFIX_FOR_DYNACONF")
    data = data or {}
    data.update(kwargs)
    if not data:
        raise AttributeError("Data must be provided")
    redis_data = {
        key.upper(): unparse_conf_data(value) for key, value in data.items()
    }
    client.hmset(holder.upper(), redis_data)
    load(obj)
48118
def Write(self):
    """"""
    if self.writeback:
      self.writeback.SaveData(self.writeback_data)
    else:
      raise RuntimeError("Attempting to write a configuration without a "
                         "writeback location.")
1160867
def write(self, path):
        
        with open(path, "w") as fh_:
            fh_.write(self.config())
1218153
def write_config_value_to_file(key, value, config_path=None):
    
    if config_path is None:
        config_path = DEFAULT_CONFIG_PATH

    # Get existing config.
    config = _get_config_dict_from_file(config_path)

    # Add/update the key/value pair.
    config[key] = value

    # Create parent directories if they are missing.
    mkdir_parents(os.path.dirname(config_path))

    # Write the content
    with open(config_path, "w") as fh:
        json.dump(config, fh, sort_keys=True, indent=2)

    # Set 600 permissions on the config file.
    os.chmod(config_path, 33216)

    return get_config_value_from_file(key, config_path)
1374855
def print_app_config_path(ctx, param, value):
    """"""
    if not value or ctx.resilient_parsing:
        return
    click.echo(config_path(os.environ.get('RENKU_CONFIG')))
    ctx.exit()
1121897
def write(self):
        """"""
        if self.dirty:
            with open(self._cache_path, "w") as output_file:
                self._config.write(output_file)
654536
def write_config_file(path, config):
    """"""
    contents = json.dumps(config, indent=4, separators=(',', ': ')) + '\n'
    try:
        with open(path, 'w') as f:
            f.write(contents)
        return True
    except IOError as ex:
        if ex != errno.ENOENT:
            raise
    return False
109404
def write_out_config(self, config_file):
        
        with open(config_file, 'w') as f:
            json.dump(self.params, f, indent=2,
                      separators=(',', ': '))
450473
def cli(ctx, path, renku_home, use_external_storage):
    """"""
    ctx.obj = LocalClient(
        path=path,
        renku_home=renku_home,
        use_external_storage=use_external_storage,
    )
422442
def main(self) -> None:
        """"""
        path = ask_path("where should the config be stored?", ".snekrc")

        conf = configobj.ConfigObj()

        tools = self.get_tools()
        for tool in tools:
            conf[tool] = getattr(self, tool)()  # pylint: disable=assignment-from-no-return
        conf.filename = path
        conf.write()

        print("Written config file!")

        if "pylint" in tools:
            print(
                "Please also run `pylint --generate-rcfile` to complete setup")
93250
def write(self):
        
        if not os.path.isdir(self._dirs['source_dir']):
            os.mkdir(self._dirs['source_dir'])

        fout = codecs.open(self._dirs['source_filename'], 'w', encoding="utf-8", errors="xmlcharrefreplace")
        fout.write(self._config_to_text())
        if self._content:
            fout.write('\n')
            fout.write(self._content)
            fout.write('\n')
        fout.close()