setup config on flying
483728
protected function setup() {
        if (!$this->_isSetup) {
            $defaultConfig = array(
                'srcBasePath' => Yii::getAlias('@webroot'),
                'dstBasePath' => Yii::$app->czaHelper->folderOrganizer->getEntityUploadPath(true),
                'dstUrlBase' => Yii::$app->czaHelper->folderOrganizer->getEntityUploadPath(),
                'underOwnerEntityPath' => true,
                'createMode' => 0775,
                'cachingPath' => '',
            );
            $this->config = \yii\helpers\ArrayHelper::merge($defaultConfig, $this->config);


            $defaultOptions = array(
                'isTranslation' => false,
                'handleFiles' => true,
                'handleImages' => true,
            );
            $this->options = \yii\helpers\ArrayHelper::merge($defaultOptions, $this->options);
            $this->_isSetup = true;
        }
    }
93366
function() {
    var cmd = `networksetup -setairportnetwork ${net_interface} "${ssid}"`;
    run_as_user(cmd, [], function(err, out) {
      return cb(err, out);
    });
  }
1206409
def setup (self):
        ''' 
        '''
        mainaccount = self.add_quotes(self.enter_config_value("mainaccount", 'ned'))
        keys = self.enter_config_value("keys", '[]')
        nodes = self.enter_config_value("nodes", 
                '["https://steemd.minnowsupportproject.org",'
                + '"https://rpc.buildteam.io",'
                + '"https://rpc.curiesteem.com",'
                + '"https://gtg.steem.house:8090",'
                + '"https://rpc.steemliberator.com",'
                + '"https://rpc.steemviz.com",'
                + '"https://steemd.privex.io"]')
        client_id = self.add_quotes(self.enter_config_value("client_id"))
        client_secret = self.add_quotes(self.enter_config_value("client_secret"))
        callback_url = self.add_quotes(self.enter_config_value("callback_url"))
        permissions = self.add_quotes(self.enter_config_value("permissions", "login,offline,vote"))
        logpath = self.add_quotes(self.enter_config_value("logpath", ""))
        screenmode = self.add_quotes(self.enter_config_value("screenmode", "quiet"))
        self.make(mainaccount=mainaccount, keys=keys, nodes=nodes, client_id=client_id, 
            client_secret=client_secret, callback_url=callback_url, permissions=permissions,
            logpath=logpath, screenmode=screenmode)
1222449
def _configure(changes):

    '''
    
    '''

    cfgred = True
    reasons = []
    fun = 'update_config'

    for key in ['added', 'updated', 'removed']:
        _updated_changes = changes.get(key, {})
        if not _updated_changes:
            continue
        _location = _updated_changes.get('location', '')
        _contact = _updated_changes.get('contact', '')
        _community = _updated_changes.get('community', {})
        _chassis_id = _updated_changes.get('chassis_id', '')
        if key == 'removed':
            fun = 'remove_config'
        _ret = __salt__['snmp.{fun}'.format(fun=fun)](location=_location,
                                                      contact=_contact,
                                                      community=_community,
                                                      chassis_id=_chassis_id,
                                                      commit=False)
        cfgred = cfgred and _ret.get('result')
        if not _ret.get('result') and _ret.get('comment'):
            reasons.append(_ret.get('comment'))

    return {
        'result': cfgred,
        'comment': '\n'.join(reasons) if reasons else ''
    }
913059
def init_config(self, app):
        """"""
        for k in dir(config):
            if k.startswith('JSONSCHEMAS_'):
                app.config.setdefault(k, getattr(config, k))

        host_setting = app.config['JSONSCHEMAS_HOST']
        if not host_setting or host_setting == 'localhost':
            app.logger.warning('JSONSCHEMAS_HOST is set to {0}'.format(
                host_setting))
320253
def _setup(self):
        
        context_module = os.environ.get(ENVIRONMENT_CONTEXT_VARIABLE, 'context')
        if not context_module:
            raise ImproperlyConfigured(
                'Requested context points to an empty variable. '
                'You must either define the environment variable {0} '
                'or call context.configure() before accessing the context.'
                .format(ENVIRONMENT_CONTEXT_VARIABLE))

        self._wrapped = Settings(context_module, default_settings=global_context)
325818
def configure(name, host, port, auth, current):
    '''
    
    '''
    Config = ConfigParser.ConfigParser()
    if not os.path.exists(os.path.dirname(filename)):
        try:
            os.makedirs(os.path.dirname(filename))
        except Exception as e:
            click.echo(e)
            return
    section_name = None
    if(current.lower() == 'y'):
        section_name = 'Current'
        change_current()
    else:
        section_name = name.capitalize()
    cfgfile = open(filename,'a')
    Config.add_section(section_name)
    Config.set(section_name,'host',host)
    Config.set(section_name,'port',port)
    Config.set(section_name,'auth',auth)
    Config.set(section_name,'name',name.capitalize())
    Config.write(cfgfile)
    cfgfile.close()
776200
def set_configs(self, key, d):
        """"""
        if '_config' in self.proxy:
            self.proxy['_config'][key] = d
        else:
            self.proxy['_config'] = {key: d}
260760
protected function configure()
    {
        $bits = explode('\\', get_class($this));

        $this->setName($this->getCommandNamePrefix() . Inflector::tableize(array_pop($bits)))
            ->addOption('debug', '', InputOption::VALUE_NONE, 'Output debug details')
            ->addOption('json', '', InputOption::VALUE_NONE, 'Output JSON')
            ->addOption('environment', 'e', InputOption::VALUE_REQUIRED, 'Environment in which we are are running (development, staging or production)', 'development');
    }
1233193
def configure(self, config=None, **kwargs):
        
        self.config = config or {}
        for key in ['messaging_token', 'number']:
            if key not in self.config:
                msg = "Tropo backend config must set '%s'; config is %r" %\
                      (key, config)
                raise ImproperlyConfigured(msg)
        if kwargs:
            msg = "All tropo backend config should be within the `config`"\
                "entry of the backend dictionary"
            raise ImproperlyConfigured(msg)
932825
def setup():
    """"""
    # Create the Wallace config file if it does not already exist.
    config_name = ".wallaceconfig"
    config_path = os.path.join(os.path.expanduser("~"), config_name)

    if os.path.isfile(config_path):
        log("Wallace config file already exists.", chevrons=False)

    else:
        log("Creating Wallace config file at ~/.wallaceconfig...",
            chevrons=False)
        wallace_module_path = os.path.dirname(os.path.realpath(__file__))
        src = os.path.join(wallace_module_path, "config", config_name)
        shutil.copyfile(src, config_path)
1032229
def configure(self):
        """"""
        if self.debug is not None and not self.debug:
            self._remove_debug_handlers()
        self._remove_debug_only()
        logging.config.dictConfig(self.config)
        try:
            logging.captureWarnings(True)
        except AttributeError:
            pass
277298
async def set_config(self, on=None, tholddark=None, tholdoffset=None):
        """"""
        data = {
            key: value for key, value in {
                'on': on,
                'tholddark': tholddark,
                'tholdoffset': tholdoffset,
            }.items() if value is not None
        }

        await self._request('put', 'sensors/{}/config'.format(self.id),
                            json=data)
72760
def setup(path_config="~/.config/scalar/config.yaml", configuration_name=None):
    
    global config
    global client
    global token
    global room
    # config file
    path_config = Path(path_config).expanduser()
    log.debug("load config {path}".format(path = path_config))
    if not path_config.exists():
        log.error("no config {path} found".format(path = path_config))
        sys.exit()
    else:
        with open(str(path_config), "r") as _file:
            config = yaml.load(_file)
    if not configuration_name:
        for configuration in list(config["configurations"].items()):
            if configuration[1]["default"]:
                config = configuration[1]
    else:
        config["configurations"][configuration_name]
    # connect to homeserver and room
    log.debug("Matrix username: " + config["username"])
    log.debug("connect to homeserver " + config["homeserver"])
    client = MatrixClient(config["homeserver"])
    token = client.login_with_password(username = config["username"], password = config["passcode"])
    log.debug("connect to room " + config["room_alias"])
    room = client.join_room(config["room_alias"])
1244135
def setup(self, settings):
        '''
        
        '''
        # set up the default sc logger
        my_level = settings.get('SC_LOG_LEVEL', 'INFO')
        my_name = settings.get('SClogger_NAME', 'sc-logger')
        my_output = settings.get('SC_LOG_STDOUT', True)
        my_json = settings.get('SC_LOG_JSON', False)
        my_dir = settings.get('SC_LOG_DIR', 'logs')
        my_bytes = settings.get('SC_LOG_MAX_BYTES', '10MB')
        my_file = settings.get('SC_LOG_FILE', 'main.log')
        my_backups = settings.get('SC_LOG_BACKUPS', 5)

        self.logger = LogFactory.get_instance(json=my_json,
                                         name=my_name,
                                         stdout=my_output,
                                         level=my_level,
                                         dir=my_dir,
                                         file=my_file,
                                         bytes=my_bytes,
                                         backups=my_backups)

        self.settings = settings
        self.stats_dict = {}

        # set up redis
        self.redis_conn = redis.Redis(host=settings.get('REDIS_HOST'),
            port=settings.get('REDIS_PORT'),
            db=settings.get('REDIS_DB'))

        try:
            self.redis_conn.info()
            self.logger.debug("Connected to Redis in ScraperHandler")
        except ConnectionError:
            self.logger.error("Failed to connect to Redis in Stats Middleware")
            # plugin is essential to functionality
            sys.exit(1)
124864
private function setup()
    {
        $config = $this->config();
        date_default_timezone_set($config['timezone']);

        // Setup routes
        $this->routeManager()->setupRoutes();

        // Setup modules
        $this->setupModules();

        // Setup routable (if not running CLI mode)
        if (PHP_SAPI !== 'cli') {
            $this->setupRoutables();
        }

        // Setup middlewares
        $this->setupMiddlewares();
    }
392455
def configure(self, options, conf):
        
        self.conf = conf
        self.enabled = options.epdb_debugErrors or options.epdb_debugFailures
        self.enabled_for_errors = options.epdb_debugErrors
        self.enabled_for_failures = options.epdb_debugFailures