Look for options in setup.cfg
504540
def get_cfg_args():
    

    if not os.path.exists('setup.cfg'):
        return {}
    cfg = ConfigParser()
    cfg.read('setup.cfg')
    cfg = cfg2dict(cfg)

    g = cfg.setdefault('global', {})
    # boolean keys:
    for key in ['libzmq_extension',
                'bundle_libzmq_dylib',
                'no_libzmq_extension',
                'have_sys_un_h',
                'skip_check_zmq',
                ]:
        if key in g:
            g[key] = eval(g[key])

    # globals go to top level
    cfg.update(cfg.pop('global'))
    return cfg
1259631
def precheck():
    
    cfg_path = local_config['PROJECT']['CONFIG_PATH']
    # enable or disable logging based on config/ defaults
    logging = set_logging(local_config)

    if os.path.exists(cfg_path):
        logger.info('%s: config_path parameter: %s' % (inspect.stack()[0][3], cfg_path))
        logger.info(
            '%s: Existing configuration file found. precheck pass.' %
            (inspect.stack()[0][3]))
        return True
    elif not os.path.exists(cfg_path) and logging is False:
        logger.info(
            '%s: No pre-existing configuration file found at %s. Using defaults. Logging disabled.' %
            (inspect.stack()[0][3], cfg_path)
            )
        return True
    if logging:
        logger.info(
            '%s: Logging enabled per config file (%s).' %
            (inspect.stack()[0][3], cfg_path)
            )
        return True
    return False
281004
def config_conf(obj):
    ""
    # If we ever want to add some default options this is where to do that
    cfg = {}
    for name in dir(obj):
        if name in CONFIG_PARSER_CFG: # argument of ConfigParser
            cfg[name] = getattr(obj, name)
    return cfg
961250
function setOptions(cfg = {}) {
    console.log('setting handler options...', cfg);
    // override the default options
    _.defaultsDeep(handlers, cfg.handlers);
}
1369889
def check_config(config):
    


    cfg = vodka.config.Config(read=config)

    vodka.log.set_loggers(cfg.get("logging"))
    vodka.app.load_all(cfg)

    click.echo("Checking config at %s for errors ..." % config)

    num_crit, num_warn = vodka.config.InstanceHandler.validate(cfg)

    click.echo("%d config ERRORS, %d config WARNINGS" % (num_crit, num_warn))
914398
def configure(options, cfg)
      cfg = super(options, cfg)
      cfg[:offline_queueing] = options[:offline_queueing]
      cfg[:filter_params] = options[:filter_params]
      cfg
    end
156991
def list_presets(cfg, out=sys.stdout):
    
    for section in cfg.sections():
        if section.startswith("preset:"):
            out.write((section.replace("preset:", "")) + os.linesep)
            for k, v in cfg.items(section):
                out.write("\t%s = %s" % (k, v) + os.linesep)
1191350
def setup(self):
        
        r = self.call_ext_prog(self.get_option("script"))
        if r['status'] == 0:
            tarfile = ""
            for line in r['output']:
                line = line.strip()
                tarfile = self.do_regex_find_all(r"ftp (.*tar.gz)", line)
            if len(tarfile) == 1:
                self.add_copy_spec(tarfile[0])
1301727
def _dump_cfg(cfg_file):
    ''''''
    if __salt__['file.file_exists'](cfg_file):
        with salt.utils.files.fopen(cfg_file, 'r') as fp_:
            log.debug(
                "zonecfg - configuration file:\n%s",
                    "".join(salt.utils.data.decode(fp_.readlines()))
            )
200044
def parse_setup(options: Union[List, str]) -> str:
    
    if isinstance(options, str):
        return options
    return "\n".join(options)
939149
function configurePaths(cfg) {
	var sourcesBasePath = path.resolve(appPath, cfg.get('sourcesBasePath'))
	   ,sources = cfg.get('sources')
	   ,build = cfg.get('build')
	   ,buildBaseUri
	   ,buildDir = nodeEnv == 'development' ? build.baseDirNameDev : build.baseDirNameDist
	   ,buildPath = path.join( path.resolve(appPath, cfg.get('buildBasePath')), buildDir)
	   ,keys, key
	   ,i
	;

	buildBaseUri = cfg.get('staticBaseUri') + '/' + buildDir +'/';
	cfg.set('buildBaseUri', buildBaseUri);
	cfg.set('cssUri', buildBaseUri + build.css.dirName + build.css.external[nodeEnv]);
	cfg.set('jsUri', buildBaseUri + build.js.dirName + build.js.external[nodeEnv]);
	cfg.set('testUri', buildBaseUri + build.js.dirName + 'test.js');

	// Resolve absolute paths from relative paths in config files

	cfg.set('staticPath',            path.resolve(appPath, cfg.get('staticPath')));
	cfg.set('routesPath',            path.resolve(appPath, cfg.get('routesPath')));
	cfg.set('buildBasePath',         path.resolve(appPath, cfg.get('buildBasePath')));
	cfg.set('helpersPath',           path.resolve(appPath, cfg.get('helpersPath')));
	cfg.set('handlebarsHelpersPath', path.resolve(appPath, cfg.get('handlebarsHelpersPath')));

	cfg.set('repoWebViewBaseUri', cfg.get('repository').replace('.git', '/') );

	keys = Object.keys(sources);
	for (i = 0; i < keys.length; i++) {
		key = keys[i];
		cfg.set( 'sources.'+key, path.resolve( sourcesBasePath, sources[key]) );
	}

	build.css.inline[nodeEnv] &&
		cfg.set('build.css.inline',   path.resolve( buildPath, build.css.inline[nodeEnv] ));

	build.css.external[nodeEnv] &&
		cfg.set('build.css.external', path.resolve( buildPath, build.css.external[nodeEnv] ));

	build.js.inline[nodeEnv] &&
		cfg.set('build.js.inline',    path.resolve( buildPath, build.js.inline[nodeEnv] ));

	build.js.external[nodeEnv] &&
		cfg.set('build.js.external',  path.resolve( buildPath, build.js.external[nodeEnv] ));

	cfg.set('build.spritesheets', path.resolve( buildPath, build.spriteSheets.dirName ));

	return cfg;
}
246064
def copy_globals(self, cfg):
        
        for name, setting in cfg.settings.items():
            csetting = self.settings.get(name)
            if (setting.is_global and csetting is not None and
                    not csetting.modified):
                csetting.set(setting.get())
561069
def load_cfg(self, src_dir):
        

        # last files override previous ones
        cfg_files = [os.path.expanduser(USER_CFG_FILE),
                     os.path.abspath(os.path.join(src_dir, '.dirsync'))]

        cfg = ConfigParser()
        cfg.read(cfg_files)

        if not cfg.has_section('defaults'):
            return

        defaults = {}
        for name, val in cfg.items('defaults'):
            try:
                opt = OPTIONS[name][1]
            except KeyError:
                if name == 'action':
                    if val in OPTIONS:
                        defaults['action'] = val
                    else:
                        raise ValueError('Invalid value for "action" option '
                                         'in configuration file: %s' % val)
                continue

            curdef = opt.get('default', '')
            if isinstance(curdef, bool):
                newdef = val not in ('0', 'False', 'false')
            elif isinstance(curdef, string_types):
                newdef = val
            else:
                newdef = val.strip('\n').split('\n')

            defaults[name] = newdef

        self.set_defaults(**defaults)
632845
def parse_cfg(self):
        
        self.cfgparser = ConfigParser()
        if not self.cfgparser.read(self.options.config):
            raise SystemExit('config file %s not found.'%self.options.config) 

        # Change the current working directory to be relative to 'experiments.cfg'
        projectDir = os.path.dirname(self.options.config)
        projectDir = os.path.abspath(projectDir)
        os.chdir(projectDir)
1209476
def setup(self):
        """"""

        self.allow = self.config['allow']
        self.halt = self.config['halt']
        self.skip = self.config['skip']
1150912
def config(self):
        

        return dict((optname, getattr(self, optname))
                    for optname, _ in CFG_OPTIONS if hasattr(self, optname))
567741
def configure(options, cfg)
      cfg[:root_dir]           = AgentConfig.root_dir
      cfg[:pid_dir]            = AgentConfig.pid_dir
      cfg[:identity]           = options[:identity] if options[:identity]
      cfg[:token]              = options[:token] if options[:token]
      cfg[:api_url]            = options[:api_url] if options[:api_url]
      cfg[:account_id]         = options[:account_id] if options[:account_id]
      cfg[:shard_id]           = options[:shard_id] if options[:shard_id]
      cfg[:mode]               = options[:mode] if options[:mode]
      cfg[:user]               = options[:user] if options[:user]
      cfg[:pass]               = options[:pass] if options[:pass]
      cfg[:vhost]              = options[:vhost] if options[:vhost]
      cfg[:port]               = options[:port] if options[:port]
      cfg[:host]               = options[:host] if options[:host]
      cfg[:prefetch]           = options[:prefetch] || 1
      cfg[:heartbeat]          = options[:heartbeat] if options[:heartbeat]
      cfg[:time_to_live]       = options[:time_to_live] || 60
      cfg[:retry_timeout]      = options[:retry_timeout] || 60
      cfg[:retry_interval]     = options[:retry_interval] || 5
      cfg[:ping_interval]      = options[:ping_interval] ||= 4 * 60 * 60
      cfg[:check_interval]     = options[:check_interval] if options[:check_interval]
      cfg[:reconnect_interval] = options[:reconnect_interval] if options[:reconnect_interval]
      cfg[:grace_timeout]      = options[:grace_timeout] if options[:grace_timeout]
      cfg[:dup_check]          = options[:dup_check].nil? ? true : options[:dup_check]
      cfg[:http_proxy]         = options[:http_proxy] if options[:http_proxy]
      cfg[:http_no_proxy]      = options[:http_no_proxy] if options[:http_no_proxy]
      cfg[:fiber_pool_size]    = options[:fiber_pool_size] if options[:fiber_pool_size]
      cfg[:airbrake_endpoint]  = options[:airbrake_endpoint] if options[:airbrake_endpoint]
      cfg[:airbrake_api_key]   = options[:airbrake_api_key] if options[:airbrake_api_key]
      cfg
    end