Updates the default stores within the MUC config file.
978424
public static function update_default_config_stores() {
        $factory = cache_factory::instance();
        $factory->updating_started();
        $config = $factory->create_config_instance(true);
        $config->configstores = array_merge($config->configstores, self::get_default_stores());
        $config->config_save();
        $factory->updating_finished();
    }
241427
private static function setDefaultConfig() {
            if (!self::$defaults) {
                self::$defaults = [self::CFG_EXCEPTION_DEPTH        => 10,
                                   self::CFG_LOG_EXCEPTION_LOCATION => true];
            }
        }
482024
def upgrade_defaults(self):
        
        self.defaults.upgrade()
        self.reset_defaults(self.defaults.filename)
107148
function update( container, src, dest ) {
  for ( var key in src ) {
    // @TODO Better handle safe defaults.
    dest[ key ] = _deTokenize( container, src[key] );
  }
}
587582
def configure(default=None, dev=None):
    
    cache_loc = openaccess_epub.utils.cache_location()
    config_loc = openaccess_epub.utils.config_location()

    #Make the cache directory
    openaccess_epub.utils.mkdir_p(cache_loc)

    defaults = {'now': time.asctime(),
                'oae-version': openaccess_epub.__version__,
                'cache-location': unix_path_coercion(cache_loc),
                'input-relative-images': 'images-*',
                'use-input-relative-images': 'y',
                'image-cache': os.path.join(cache_loc, 'img_cache'),
                'use-image-cache': 'n',
                'use-image-fetching': 'y',
                'default-output': '.',
                'input-relative-css': '.',
                'epubcheck-jarfile': os.path.join(cache_loc,
                                                 'epubcheck-3.0',
                                                 'epubcheck-3.0.jar')}

    if default or dev:  # Skip interactive and apply defaults
        #Pass through the validation/modification steps
        if dev:  # The only current difference between dev and default
            defaults['use-image-cache'] = 'y'
        defaults['input-relative-images'] = list_opts(defaults['input-relative-images'])
        defaults['use-input-relative-images'] = boolean(defaults['use-input-relative-images'])
        defaults['image-cache'] = absolute_path(defaults['image-cache'])
        defaults['use-image-cache'] = boolean(defaults['use-image-cache'])
        defaults['use-image-fetching'] = boolean(defaults['use-image-fetching'])
        defaults['default-output'] = nonempty(defaults['default-output'])
        defaults['input-relative-css'] = nonempty(defaults['input-relative-css'])
        defaults['epubcheck-jarfile'] = absolute_path(defaults['epubcheck-jarfile'])
        config = config_formatter(CONFIG_TEXT, defaults)

        with open(config_loc, 'wb') as conf_out:
            conf_out.write(bytes(config, 'UTF-8'))
        print('The config file has been written to {0}'.format(config_loc))
        return

    config_dict = {'now': time.asctime(),
                   'oae-version': openaccess_epub.__version__,
                   'cache-location': unix_path_coercion(cache_loc)}

    print('''\nWelcome to the interactive configuration for OpenAccess_EPUB''')
    print('''
Please enter values for the following settings. To accept the default value
for the settings, shown in brackets, just push Enter.

-------------------------------------------------------------------------------\
''')
    print('''
OpenAccess_EPUB defines a default cache location for the storage of various
data (and the global config.py file), this location is:\n\n{0}
'''.format(cache_loc))

    input('Press Enter to start...')

    #Image Configuration
    print('''
 -- Configure Image Behavior --

When OpenAccess_EPUB is executed using the oaepub script, it can find the
images for the input articles using the following strategies (in order of
preference):

 Input-Relative: a path relative to the input file
 Cached Images: locate the images in a cache
 Fetched Online: attempts to download from the Internet (may fail)

We'll configure some values for each of these, and you\'ll also have the option
to turn them off.''')
    #Input-relative image details
    print('''
Where should OpenAccess_EPUB look for images relative to the input file?
A star "*" may be used as a wildcard to match the name of the input file.
Multiple path values may be specified if separated by commas.''')
    user_prompt(config_dict, 'input-relative-images', 'Input-relative images?:',
                default=defaults['input-relative-images'], validator=list_opts)
    print('''
Should OpenAccess_EPUB look for images relative to the input file by default?\
''')
    user_prompt(config_dict, 'use-input-relative-images',
                'Use input-relative images?: (Y/n)',
                default=defaults['use-input-relative-images'],
                validator=boolean)
    #Image cache details
    print('''
Where should OpenAccess_EPUB place the image cache?''')
    user_prompt(config_dict, 'image-cache', 'Image cache?:',
                default=defaults['image-cache'],
                validator=absolute_path)
    print('''
Should OpenAccess_EPUB use the image cache by default? This feature is intended
for developers and testers without local access to the image files and will
consume extra disk space for storage.''')
    user_prompt(config_dict, 'use-image-cache', 'Use image cache?: (y/N)',
                default=defaults['use-image-cache'],
                validator=boolean)
    #Image fetching online details
    print('''
Should OpenAccess_EPUB attempt to download the images from the Internet? This
is not supported for all publishers and not 100% guaranteed to succeed, you may
need to download them manually if this does not work.''')
    user_prompt(config_dict, 'use-image-fetching', 'Attempt image download?: (Y/n)',
                default=defaults['use-image-fetching'],
                validator=boolean)
    #Output configuration
    print('''
 -- Configure Output Behavior --

OpenAccess_EPUB produces ePub and log files as output. The following options
will determine what is done with these.

Where should OpenAccess_EPUB place the output ePub and log files? If you supply
a relative path, the output path will be relative to the input; if you supply
an absolute path, the output will always be placed there. The default behavior
is to place them in the same directory as the input.''')
    user_prompt(config_dict, 'default-output', 'Output path?:',
                default=defaults['default-output'],
                validator=nonempty)
    print('''
 -- Configure CSS Behavior --

ePub files use CSS for improved styling, and ePub-readers must support a basic
subset of CSS functions. OpenAccess_EPUB provides a default CSS file, but a
manual one may be supplied, relative to the input. Please define an
appropriate input-relative path.''')
    user_prompt(config_dict, 'input-relative-css', 'Input-relative CSS path?:',
                default=defaults['input-relative-css'],
                validator=nonempty)
    print('''
 -- Configure EpubCheck --

EpubCheck is a program written and maintained by the IDPF as a tool to validate
ePub. In order to use it, your system must have Java installed and it is
recommended to use the latest version. Downloads of this program are found here:

https://github.com/IDPF/epubcheck/releases

Once you have downloaded the zip file for the program, unzip the archive and
write a path to the .jar file here.''')
    user_prompt(config_dict, 'epubcheck-jarfile', 'Absolute path to epubcheck?:',
                default=defaults['epubcheck-jarfile'], validator=absolute_path)
    #Write the config.py file
    config = config_formatter(CONFIG_TEXT, config_dict)
    with open(config_loc, 'wb') as conf_out:
        conf_out.write(bytes(config, 'UTF-8'))
    print('''
Done configuring OpenAccess_EPUB!''')
894909
public function setDefault(): void
	{
		$repo = $this->getRepository();
		$locales = $repo->findAll();
		foreach ($locales as $locale) {
			/* @var $locale self */
			$locale->default = false;
			$repo->persist($locale);
		}
		$this->default = true;
		$repo->persist($this);
		$repo->flush();
	}
882896
def reload(self):
        
        self._conf = configparser.ConfigParser()
        # Preserve the case of sections and keys.
        self._conf.optionxform = str
        self._conf.read(self.config_file_path)
        if 'general' not in self._conf.keys():
            raise IncompleteConfigurationFile('Missing the general section')
        general = self._replace_data_types(dict(self._conf.items('general')))
        self._conf.remove_section('general')
        plugin = []
        for section in self._conf.sections():
            plugin.append(dict(self._conf.items(section)))
            plugin[-1].update({'name': section})
            plugin[-1] = self._replace_data_types(plugin[-1])
        return (plugin, general)
34636
def normalize_defaults
      new_options = {}
      options.each do |key,value|
        unless value.nil?
          new_options[key.to_s] = value
          new_options[key.to_sym] = value
        end
      end
      options.merge!(new_options)
    end
468742
def set_missing_defaults(self):
        
        if 'pub_options' not in self.config:
            self.config['pub_options'] = {
                'acknowledge': True,
                'retain': True
            }

        if 'sub_options' not in self.config:
            self.config['sub_options'] = {
                'get_retained': False
            }

        if 'subscribed_topics' not in self.config:
            self.config['subscribed_topics'] = None

        if 'replay_events' not in self.config:
            self.config['replay_events'] = False

        if 'max_reconnect_retries' not in self.config:
            self.config['max_reconnect_retries'] = 10
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 ''
    }
302313
def _update_defaults(self, defaults, old_version, verbose=False):
        """"""
        old_defaults = self._load_old_defaults(old_version)
        for section, options in defaults:
            for option in options:
                new_value = options[ option ]
                try:
                    old_value = old_defaults.get(section, option)
                except (cp.NoSectionError, cp.NoOptionError):
                    old_value = None
                if old_value is None or \
                  to_text_string(new_value) != old_value:
                    self._set(section, option, new_value, verbose)
146148
def _update_defaults(self, defaults):
        """"""

        # Accumulate complex default state.
        self.values = optparse.Values(self.defaults)
        late_eval = set()
        # Then set the options with those values
        for key, val in self._get_ordered_configuration_items():
            # '--' because configuration supports only long names
            option = self.get_option('--' + key)

            # Ignore options not present in this parser. E.g. non-globals put
            # in [global] by users that want them to apply to all applicable
            # commands.
            if option is None:
                continue

            if option.action in ('store_true', 'store_false', 'count'):
                try:
                    val = strtobool(val)
                except ValueError:
                    error_msg = invalid_config_error_message(
                        option.action, key, val
                    )
                    self.error(error_msg)

            elif option.action == 'append':
                val = val.split()
                val = [self.check_default(option, key, v) for v in val]
            elif option.action == 'callback':
                late_eval.add(option.dest)
                opt_str = option.get_opt_string()
                val = option.convert_value(opt_str, val)
                # From take_action
                args = option.callback_args or ()
                kwargs = option.callback_kwargs or {}
                option.callback(option, opt_str, val, self, *args, **kwargs)
            else:
                val = self.check_default(option, key, val)

            defaults[option.dest] = val

        for key in late_eval:
            defaults[key] = getattr(self.values, key)
        self.values = None
        return defaults
448573
def update_configuration(app):
    """"""
    config = app.config
    project = config.project
    config_dir = app.env.srcdir
    sys.path.insert(0, os.path.join(config_dir, '..'))

    config.html_theme_path.append(os.path.relpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'themes'), config_dir))
    if not config.html_logo:
        config.html_logo = os.path.relpath(os.path.join(STATIC_PATH, 'safari_logo.png'), config_dir)
    if not config.html_favicon:
        config.html_favicon = os.path.relpath(os.path.join(STATIC_PATH, 'favicon.ico'), config_dir)
    config.html_static_path.append(os.path.relpath(STATIC_PATH, config_dir))
    if not config.htmlhelp_basename:
        config.htmlhelp_basename = '%sdoc' % project
    if not config.latex_logo:
        config.latex_logo = os.path.relpath(os.path.join(STATIC_PATH, 'safari_logo.png'), config_dir)
    if not config.epub_title:
        config.epub_title = u'%s Documentation' % project
    if not config.epub_publisher:
        config.epub_publisher = config.epub_author
    if not config.epub_copyright:
        config.epub_copyright = config.copyright

    config.latex_documents.append(
        (master_doc,
         '%s.tex' % project,
         u'%s Documentation' % project,
         u'Safari',
         'manual'))
    config.man_pages.append(
        (master_doc,
         project,
         u'%s Documentation' % project,
         [u'Safari'],
         1))
    config.texinfo_documents.append(
        (master_doc,
         project,
         u'%s Documentation' % project,
         u'Safari',
         project,
         'One line description of project.',
         'Miscellaneous'))

    # Parse the version number from setup.py without actually running setup()
    with open(os.path.join(config_dir, '..', 'setup.py'), 'r') as f:
        content = f.read()
        match = re.search(r"version\s*=\s*['\"]([\d\.]+)['\"]", content)
        if match:
            config.version = match.group(1)
            config.release = config.version
471696
private function setDefaultConfiguration(): void
    {
        $this->parameterBag->set('app.devmode', false);
        $this->parameterBag->set('container.dumper.inline_class_loader', true);

        $this->config->addPass($this->parameterBag);
    }
1224291
def _update_config_file(username, password, email, url, config_path):
        """"""
        try:
            # read the existing config
            config = json.load(open(config_path, "r"))
        except ValueError:
            config = dict()

        if not config.get('auths'):
            config['auths'] = dict()

        if not config['auths'].get(url):
            config['auths'][url] = dict()
        encoded_credentials = dict(
            auth=base64.b64encode(username + b':' + password),
            email=email
        )
        config['auths'][url] = encoded_credentials
        try:
            json.dump(config, open(config_path, "w"), indent=5, sort_keys=True)
        except Exception as exc:
            raise exceptions.AnsibleContainerConductorException(
                u"Failed to write registry config to {0} - {1}".format(config_path, exc)
            )
1281831
def _merge_default_values(self):
        """"""
        values = self._get_default_values()
        for key, value in values.items():
            if not self.data.get(key):
                self.data[key] = value
331914
def Update(self, env, args=None):
        

        values = {}

        # first set the defaults:
        for option in self.options:
            if not option.default is None:
                values[option.key] = option.default

        # next set the value specified in the options file
        for filename in self.files:
            if os.path.exists(filename):
                dir = os.path.split(os.path.abspath(filename))[0]
                if dir:
                    sys.path.insert(0, dir)
                try:
                    values['__name__'] = filename
                    with open(filename, 'r') as f:
                        contents = f.read()
                    exec(contents, {}, values)
                finally:
                    if dir:
                        del sys.path[0]
                    del values['__name__']

        # set the values specified on the command line
        if args is None:
            args = self.args

        for arg, value in args.items():
            added = False
            for option in self.options:
                if arg in list(option.aliases) + [ option.key ]:
                    values[option.key] = value
                    added = True
            if not added:
                self.unknown[arg] = value

        # put the variables in the environment:
        # (don't copy over variables that are not declared as options)
        for option in self.options:
            try:
                env[option.key] = values[option.key]
            except KeyError:
                pass

        # Call the convert functions:
        for option in self.options:
            if option.converter and option.key in values:
                value = env.subst('${%s}'%option.key)
                try:
                    try:
                        env[option.key] = option.converter(value)
                    except TypeError:
                        env[option.key] = option.converter(value, env)
                except ValueError as x:
                    raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x))


        # Finally validate the values:
        for option in self.options:
            if option.validator and option.key in values:
                option.validator(option.key, env.subst('${%s}'%option.key), env)