Set up default records based on the yaml config
429079
public function requireDefaultRecords()
    {
        parent::requireDefaultRecords();
        $default_menu_sets = $this->config()->get('sets') ?: array();
        foreach ($default_menu_sets as $slug => $options) {
            if (is_array($options)) {
                $title = $options['title'];
                $allowChildren = isset($options['allow_children']) ? $options['allow_children'] : false;
            } else {
                $title = $options;
                $allowChildren = false;
            }
            $slug = Convert::raw2htmlid($slug);
            $record = MenuSet::get()->find('Slug', $slug);
            if (!$record) {
                $record = MenuSet::create();
                DB::alteration_message("Menu '$title' created", 'created');
            } else {
                DB::alteration_message("Menu '$title' updated", 'updated');
            }
            $record->Slug = $slug;
            $record->Title = $title;
            $record->AllowChildren = $allowChildren;
            $record->write();
        }
    }
1330222
def _opts_defaults(self, **kwargs):
        '''
        
        '''
        # Let's start with the default salt cloud configuration
        opts = salt.config.DEFAULT_CLOUD_OPTS.copy()
        # Update it with the loaded configuration
        opts.update(self.opts.copy())
        # Reset some of the settings to sane values
        opts['parallel'] = False
        opts['keep_tmp'] = False
        opts['deploy'] = True
        opts['update_bootstrap'] = False
        opts['show_deploy_args'] = False
        opts['script_args'] = ''
        # Update it with the passed kwargs
        if 'kwargs' in kwargs:
            opts.update(kwargs['kwargs'])
        opts.update(kwargs)
        profile = opts.get('profile', None)
        # filter other profiles if one is specified
        if profile:
            tmp_profiles = opts.get('profiles', {}).copy()
            for _profile in [a for a in tmp_profiles]:
                if not _profile == profile:
                    tmp_profiles.pop(_profile)
            # if profile is specified and we have enough info about providers
            # also filter them to speedup methods like
            # __filter_non_working_providers
            providers = [a.get('provider', '').split(':')[0]
                         for a in six.itervalues(tmp_profiles)
                         if a.get('provider', '')]
            if providers:
                _providers = opts.get('providers', {})
                for provider in _providers.copy():
                    if provider not in providers:
                        _providers.pop(provider)
        return opts
935596
def _init_defaults(self):
        """"""
        defaults = {
            'build_dir': None,
            'build_datetime': datetime.datetime.now(dateutil.tz.tzutc()),
            'pdf_path': None,
            'extra_downloads': list(),
            'environment': None,
            'lsstdoc_tex_path': None,
            'title': None,
            'title_plain': "",
            'authors': None,
            'authors_json': list(),
            'doc_handle': None,
            'series': None,
            'series_name': None,
            'abstract': None,
            'abstract_plain': "",
            'ltd_product': None,
            'docushare_url': None,
            'github_slug': None,
            'git_branch': 'master',  # so we default to the main LTD edition
            'git_commit': None,
            'git_tag': None,
            'travis_job_number': None,
            'is_travis_pull_request': False,  # If not on Travis, not a PR
            'is_draft_branch': True,
            'aws_id': None,
            'aws_secret': None,
            'keeper_url': 'https://keeper.lsst.codes',
            'keeper_user': None,
            'keeper_password': None,
            'upload': False
        }
        return defaults
74774
def configure(conf)
      if conf['output_type'] && !conf['format']
        conf['format'] = conf['output_type']
      end
      compat_parameters_convert(conf, :inject, :formatter)

      super
      @host = conf['host']
      @port = conf['port']
      @token = conf['token']
      @hostname = conf['hostname'] || Socket.gethostname.split('.').first

      # Determine mapping of record keys to syslog keys
      @mappings = {}
      SYSLOG_HEADERS.each do |key_name|
        conf_key = "#{key_name}_key"
        @mappings[key_name] = conf[conf_key] if conf.key?(conf_key)
      end

      @formatter = formatter_create(conf: conf.elements('format').first, default_type: DEFAULT_FORMAT_TYPE)
    end
738249
def load_config_yaml(self, flags, config_dict):
        
        if config_dict is None:
            print('Config File not specified. Using only input flags.')
            return flags
        try:
            config_yaml_dict = self.cfg_from_file(flags['YAML_FILE'], config_dict)
        except KeyError:
            print('Yaml File not specified. Using only input flags and config file.')
            return config_dict
        print('Using input flags, config file, and yaml file.')
        config_yaml_flags_dict = self._merge_a_into_b_simple(flags, config_yaml_dict)
        return config_yaml_flags_dict
1161201
def db_config
      @db_config ||= begin
        opts = OptionsHash.new(YamlConfig.user_config.options)
        opts.merge!(YamlConfig.local_config.options)
        opts.merge!(EnvConfig.new.options)
        opts
      end
    end
980892
def _load_yaml_config(cls, config_data, filename="(unknown)"):
        """"""

        try:
            config = yaml.safe_load(config_data)
        except yaml.YAMLError as err:
            if hasattr(err, 'problem_mark'):
                mark = err.problem_mark
                errmsg = ("Invalid YAML syntax in Configuration file "
                          "%(file)s at line: %(line)s, column: %(column)s."
                          % dict(file=filename,
                                 line=mark.line + 1,
                                 column=mark.column + 1))
            else:
                errmsg = ("YAML error reading Configuration file "
                          "%(file)s"
                          % dict(file=filename))
            logger.error(errmsg)
            raise

        logger.info("Configuration: %s", config)
        return config
1092344
def set_defaults(config, cluster_name):
    
    config['postgresql'].setdefault('name', cluster_name)
    config['postgresql'].setdefault('scope', cluster_name)
    config['postgresql'].setdefault('listen', '127.0.0.1')
    config['postgresql']['authentication'] = {'replication': None}
    config['restapi']['listen'] = ':' in config['restapi']['listen'] and config['restapi']['listen'] or '127.0.0.1:8008'
768541
def dump(self):
        """"""
        try:
            import yaml
            cfg_file = self._cfg_file()
            cfg_dir, __ = os.path.split(cfg_file)
            os.makedirs(cfg_dir, exist_ok=True)
            with open(cfg_file, 'w') as f:
                yaml.dump(self, f)
        except ImportError as err:
            raise RuntimeError(
                'Cannot dump the configuration settings to file. You need to '
                'install the necessary dependencies (pyyaml, appdirs).'
            ) from err
908547
protected function initDefaultFiles()
    {
        $logDir = $this->getParam(DirectoryKeys::VAR_LOG) . DIRECTORY_SEPARATOR;
        $this->setParam(FileKeys::APPSERVER_ERRORS_LOG, ParamNode::TYPE_STRING, $logDir . 'appserver-errors.log');
        $this->setParam(FileKeys::APPSERVER_ACCESS_LOG, ParamNode::TYPE_STRING, $logDir . 'appserver-access.log');
    }
1268572
def load_yaml_config(self, conf):
        """"""
        with open(conf) as fd:
            self.config = recursive_dict_update(self.config, yaml.load(fd, Loader=UnsafeLoader))
1049799
def configure_defaults
      # Enable all warnings except some.
      set_warning(:all, true)
      set_warning(:link_auto, false)
      set_warning(:param_count, false)
      set_warning(:fires, false)
      set_warning(:nodoc, false)
    end
1125832
def configure():
    
    yaml.add_multi_representer(Step, step_multi_representer)
    yaml.add_multi_constructor('!step', step_multi_constructor)
    yaml.Dumper.ignore_aliases = lambda *args: True
111099
def _prepare_defaults(self):
		""""""
		
		for name, field in self.__fields__.items():
			if field.assign:
				getattr(self, name)
881111
def parse_yaml(self, y):
        '''

        '''
        self.id = y['id']
        self._config_data = []
        if 'configurationData' in y:
            for d in y.get('configurationData'):
                self._config_data.append(ConfigurationData().parse_yaml(d))
        return self
465686
def load_yaml(fname):
    """"""
    yaml = YAML(typ="safe")
    # Compat with HASS
    yaml.allow_duplicate_keys = True
    # Stub HASS constructors
    HassSafeConstructor.name = fname
    yaml.Constructor = HassSafeConstructor

    with open(fname, encoding="utf-8") as conf_file:
        # If configuration file is empty YAML returns None
        # We convert that to an empty dict
        return yaml.load(conf_file) or {}
651265
def set_defaults
      set_if_empty :karafka_role, :karafka
      set_if_empty :karafka_processes, 1
      set_if_empty :karafka_consumer_groups, []
      set_if_empty :karafka_default_hooks, -> { true }
      set_if_empty :karafka_env, -> { fetch(:karafka_env, fetch(:environment)) }
      set_if_empty :karafka_pid, -> { File.join(shared_path, 'tmp', 'pids', 'karafka.pid') }
    end