Create default config file
5900
def create(ctx):
    
    import shutil

    this_dir, this_filename = os.path.split(__file__)
    default_config_file = os.path.join(this_dir, "apis/example-config.yaml")
    config_file = ctx.obj["configfile"]
    shutil.copyfile(default_config_file, config_file)
    print_message("Config file created: {}".format(config_file))
1255776
def config(ctx):
    """"""
    home_directory = os.path.expanduser('~')
    default_config_file = os.path.join(home_directory, '.tweetqueue')
    default_database_file = os.path.join(home_directory, '.tweetqueue.db')

    config = {}

    config['API_KEY'] = click.prompt('API Key')
    config['API_SECRET'] = click.prompt('API Secret')
    config['ACCESS_TOKEN'] = click.prompt('Access Token')
    config['ACCESS_TOKEN_SECRET'] = click.prompt('Access Token Secret')
    config['DATABASE_LOCATION'] = click.prompt('Database', default=default_database_file)

    config_file = click.prompt('\nSave to', default=default_config_file)

    if click.confirm('Do you want to save this configuration?', abort=True):
        f = open(config_file, 'wb')
        json.dump(config, f, indent=4, separators=(',',': '))
        f.close()
1220875
def default_config_file(self):
        
        import os.path as p
        import pyemma
        return p.join(pyemma.__path__[0], Config.DEFAULT_CONFIG_FILE_NAME)
46053
def configure(conf, default_config=None):
    
    if conf.logconfig and os.path.isfile(conf.logconfig):
        logging.config.fileConfig(conf.logconfig,
                                  disable_existing_loggers=False)
    elif default_config and os.path.isfile(default_config):
        logging.config.fileConfig(default_config,
                                  disable_existing_loggers=False)
    else:
        init_console_logging(conf)
39718
def setup_config(command, filename, section, vars):
    """"""
    confuri = "config:" + filename
    if ":" in section:
        confuri += "#" + section.rsplit(":", 1)[-1]
    conf = appconfig(confuri)

    load_environment(conf.global_conf, conf.local_conf)
74449
def setup_config(command, filename, section, vars):
    """"""
    conf = appconfig('config:' + filename)
    load_environment(conf.global_conf, conf.local_conf)
625076
def config(conf, confdefs):
    '''
    
    '''
    conf = conf.copy()

    # for now just populate defval
    for name, info in confdefs:
        conf.setdefault(name, info.get('defval'))

    return conf
381654
def save_config(self, config_path=None):
        """"""
        if config_path is None:
            config_path = self.config_path
        else:
            self.config_path = config_path

        with open(config_path, 'w') as f:
            self.config.write(f)
863150
def write_default_config(self, filename):
        
        try:
            with open(filename, 'wt') as file:
                file.write(DEFAULT_CONFIG)
            return True
        except (IOError, OSError) as e:
            print('Error writing %s: %s' % (filename, e.strerror or e), file=sys.stderr)
            return False
847386
def _download_initial_config(self):
        """"""
        _initial_config = self._download_running_config()  # this is a bit slow!
        self._last_working_config = _initial_config
        self._config_history.append(_initial_config)
        self._config_history.append(_initial_config)
518103
def generate_config(directory):
    
    default_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.yml")
    target_config_path = os.path.abspath(os.path.join(directory, 'config.yml'))
    shutil.copy(default_config, target_config_path)
    six.print_("Config file has been generated in", target_config_path)
897743
private function createNewConfig() : Config
    {
        $globalPath = $this->globalPath ?: getenv('HOME');
        $tokenFile  = sprintf('%s/.keep-a-changelog/token', $globalPath);
        $token = is_readable($tokenFile)
            ? trim(file_get_contents($tokenFile))
            : '';
        return new Config($token);
    }
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'))
230464
protected function createConfigFiles() {
    $this->logger->info("Creating configuration files for Drupal VM...");

    $this->taskFilesystemStack()
      ->mkdir($this->vmDir)
      ->copy($this->defaultDrupalVmConfigFile, $this->projectDrupalVmConfigFile,
        TRUE)
      ->copy($this->defaultDrupalVmVagrantfile,
        $this->projectDrupalVmVagrantfile, TRUE)
      ->stopOnFail()
      ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE)
      ->run();
  }
395112
private static function setDefaultConfig() {
            if (!self::$defaults) {
                self::$defaults = [self::CFG_ERROR_LEVEL        => error_reporting(),
                                   self::CFG_LOG_ERROR_LOCATION => true];
            }
        }
1276625
def save(filename=ConfigPath):
    """"""
    default_values = defaults()
    parser = configparser.RawConfigParser()
    parser.optionxform = str # Force case-sensitivity on names
    try:
        save_types = basestring, int, float, tuple, list, dict, type(None)
        for k, v in sorted(globals().items()):
            if not isinstance(v, save_types) or k.startswith("_") \
            or default_values.get(k, parser) == v: continue # for k, v
            try: parser.set("DEFAULT", k, json.dumps(v))
            except Exception: pass
        if parser.defaults():
            with open(filename, "wb") as f:
                f.write("# %s %s configuration written on %s.\n" % (Title, Version,
                        datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
                parser.write(f)
        else: # Nothing to write: delete configuration file
            try: os.unlink(filename)
            except Exception: pass
    except Exception:
        logging.warn("Error writing config to %s.", filename, exc_info=True)
791208
def create_project_configuration(filename):
    """"""
    home = os.path.expanduser("~")
    project_root_folder = os.path.join(home, "hwr-experiments")
    config = {'root': project_root_folder,
              'nntoolkit': None,
              'dropbox_app_key': None,
              'dropbox_app_secret': None,
              'dbconfig': os.path.join(home, "hwrt-config/db.config.yml"),
              'data_analyzation_queue': [{'Creator': None}],
              'worker_api_key': '1234567890abc',
              'environment': 'development'}
    with open(filename, 'w') as f:
        yaml.dump(config, f, default_flow_style=False)