Pick correct settings instance and set it to a global variable.
968891
def set_settings(instance=None):
    """"""

    global settings

    settings = None

    if instance:
        settings = import_settings(instance)

    elif "INSTANCE_FOR_DYNACONF" in os.environ:
        settings = import_settings(os.environ["INSTANCE_FOR_DYNACONF"])

    elif "FLASK_APP" in os.environ:  # pragma: no cover
        with suppress(ImportError, click.UsageError):
            from flask.cli import ScriptInfo

            flask_app = ScriptInfo().load_app()
            settings = flask_app.config
            click.echo(
                click.style(
                    "Flask app detected", fg="white", bg="bright_black"
                )
            )

    elif "DJANGO_SETTINGS_MODULE" in os.environ:  # pragma: no cover
        sys.path.insert(0, os.path.abspath(os.getcwd()))
        try:
            # Django extension v2
            from django.conf import settings

            settings.DYNACONF.configure()
        except (ImportError, AttributeError):
            # Backwards compatible with old django extension (pre 2.0.0)
            import dynaconf.contrib.django_dynaconf  # noqa
            from django.conf import settings as django_settings

            django_settings.configure()
            settings = django_settings

        if settings is not None:
            click.echo(
                click.style(
                    "Django app detected", fg="white", bg="bright_black"
                )
            )

    if settings is None:
        settings = LazySettings()
629825
def all_settings
      settings = {}
      instance_variables.each do |var|
        key = var[1..-1]
        settings[key] = self.instance_variable_get(var)
      end
      settings
    end
1290790
def _settings_from_env(self):
        """"""
        return {attr: self._val_from_env(env, attr)
                for env, attr in const.ENV_TO_ATTR.items()
                if env in os.environ}
865264
public static function set()
    {
        self::getInstance();

        $args = func_get_args();

        if (is_array($args[0]))
        {
            foreach ($args[0] as $key => $value)
            {
                self::$settings[$key] = $value;
            }
        }
        else
        {
            self::$settings[$args[0]] = $args[1];
        }
    }
321372
def _set_global_defaults(xmlglobals):
    """"""
    for key, val in xmlglobals.items():
        if key != "defaults":
            for name, tag in val.items():
                _update_from_globals(tag, xmlglobals, None)
310417
def _set_setting(self, settings):
        """"""
        for key, value in settings.items():
            _validate_setting(key, value)

        try:
            self._settings_request(method="patch", json_data=settings)

            self.update(settings_json=settings)
        except SkybellException as exc:
            _LOGGER.warning("Exception changing settings: %s", settings)
            _LOGGER.warning(exc)
819301
def set_mode(how):
    
    global __mode
    if how == "local":
        __mode = how
    elif how == "remote":
        __mode = how
    else:
        raise ValueError("how must be 'local' or 'remote'")
954557
def setSystemVariable(self, remote, name, value):
        """"""
        if self._server is not None:
            return self._server.setSystemVariable(remote, name, value)
1075185
def SetEnvironmentVariable(self, name, value):
    
    if isinstance(value, py2to3.STRING_TYPES):
      value = self._PathStripPrefix(value)

    if value is not None:
      self._environment_variables[name.upper()] = value
635101
def process_settings(self, settings):
        """"""
        logging.debug("Using configuration from: %s", settings.name)
        exec(compile(settings.read(), settings.name, 'exec'), globals(), locals())
1273436
def set_variable(self, name, value):
        
        if value is None:
            # Unset the variable.
            if name in self._var:
                del self._var[name]
        self._var[name] = value
617631
def _setup(self, name=None):
        
        envvar = self.__dict__['env_var']
        if envvar:
            settings_file = os.environ.get(envvar)
        else:
            settings_file = self.__dict__['file_path']

        if not settings_file:
            msg = ("Requested settings, but none can be obtained for the envvar."
                   "Since no config filepath can be obtained, a default config "
                   "will be used.")
            logger.error(msg)
            raise OSError(msg)

        self._wrapped = Settings(settings_file)
91415
def use_settings(self, settings_module):
        '''
        
        '''
        self._previous_settings = self.settings_module
        self.settings_module = settings_module
        self.reconfigure()
814968
public void setGlobalVariable(String name, Element value) {

		assert (name != null);

		GlobalVariable gvar = globalVariables.get(name);
		gvar.setValue(value);
	}
69607
function setGlobalVariable(key, value) {
        return _execute('PUT', '/variables', {
            key: key,
            value: value
        }, 'Could not add or update variable key [' + key + ' with value [' + value + ']');
    }
1143566
def set_local(self, value, variable_name):
        '''
        
        '''
        self.log('assigning %s = %r', variable_name, value)
        self._locals[variable_name] = value
        return value
714349
def clear_global(self):
        
        vname = self.varname
        logger.debug(f'global clearning {vname}')
        if vname in globals():
            logger.debug('removing global instance var: {}'.format(vname))
            del globals()[vname]