parse `defaults` sections, and return a config.Defaults

        Args:
            defaults_node (TreeNode): Description

        Returns:
            config.Defaults: an object
172884
def build_defaults(self, defaults_node):
        
        proxy_name = defaults_node.defaults_header.proxy_name.text
        config_block_lines = self.__build_config_block(
            defaults_node.config_block)
        return config.Defaults(
            name=proxy_name,
            config_block=config_block_lines)
246736
function defaultsDeep(config, defaults) {
              if (_.isPlainObject(config)) {
                return _.mapValues(_.defaults(config, defaults), function(val, index) {
                  return defaultsDeep(_.get(config, index), _.get(defaults, index));
                });
              }

              return config || defaults;
            }
715513
def _generate_configs_from_default(self, overrides=None):
        # type: (Dict[str, int]) -> Dict[str, int]
        
        config = DEFAULT_CONFIG.copy()
        if not overrides:
            overrides = {}
        for k, v in overrides.items():
            config[k] = v
        return config
302991
def set_defaults(self, **defaults):
        
        try:
            defaults_items = defaults.iteritems()
        except AttributeError:
            defaults_items = defaults.items()
        for key, val in defaults_items:
            if key not in self.args.keys():
                self.args[key] = val
128625
def defaults(self):
        
        return {
            key: get_defaults(value)
            for key, value in self.all.items()
        }
1080308
def _apply_default(self, config, default):
        
        # No default, nothing to be done here
        if not default:
            return config

        # If the entire config is just a string, return default TaggedValue
        if isinstance(config, str):
            return TaggedValue(config, default, default, *self._global_tags)

        if isinstance(config, dict):
            # Recursively apply defaults for  each item in the config
            for key, val in config.items():
                config[key] = self._apply_default(val, default)

        elif isinstance(config, list):
            # Recursively apply defaults for each item in the config
            for i, val in enumerate(config):
                config[i] = self._apply_default(val, default)

        elif isinstance(config, TaggedValue):
            # Make sure each TaggedValue knows about the default tag
            config.tags.add(default)

        return config
81889
def _configure_nodes(self, nodes):
        
        if isinstance(nodes, str):
            nodes = [nodes]
        elif not isinstance(nodes, (dict, list)):
            raise ValueError(
                'nodes configuration should be a list or a dict,'
                ' got {}'.format(type(nodes)))

        conf_changed = False
        for node in nodes:
            conf = {
                'hostname': node,
                'instance': None,
                'nodename': node,
                'port': None,
                'vnodes': self._default_vnodes,
                'weight': 1
            }
            current_conf = self.runtime._nodes.get(node, {})
            nodename = node
            # new node, trigger a ring update
            if not current_conf:
                conf_changed = True
            # complex config
            if isinstance(nodes, dict):
                node_conf = nodes[node]
                if isinstance(node_conf, int):
                    conf['weight'] = node_conf
                elif isinstance(node_conf, dict):
                    for k, v in node_conf.items():
                        if k in conf:
                            conf[k] = v
                            # changing those config trigger a ring update
                            if k in ['nodename', 'vnodes', 'weight']:
                                if current_conf.get(k) != v:
                                    conf_changed = True
                else:
                    raise ValueError(
                        'node configuration should be a dict or an int,'
                        ' got {}'.format(type(node_conf)))
            if self._weight_fn:
                conf['weight'] = self._weight_fn(**conf)
            # changing the weight of a node trigger a ring update
            if current_conf.get('weight') != conf['weight']:
                conf_changed = True
            self.runtime._nodes[nodename] = conf
        return conf_changed
366048
def simple_defaults(self, defaults_dic):
        

        defaults=[]
        for d in defaults_dic.keys():
            dic={}
            dic["visualProperty"]=d
            dic["value"]=defaults_dic[d]
            defaults.append(dic)
        return defaults
619586
def default_loader(obj, defaults=None):
    """"""
    defaults = defaults or {}
    default_settings_values = {
        key: value
        for key, value in default_settings.__dict__.items()  # noqa
        if key.isupper()
    }

    all_keys = deduplicate(
        list(defaults.keys()) + list(default_settings_values.keys())
    )

    for key in all_keys:
        if not obj.exists(key):
            value = defaults.get(key, default_settings_values.get(key))
            obj.logger.debug("loading: %s:%s", key, value)
            obj.set(key, value)

    # start dotenv to get default env vars from there
    # check overrides in env vars
    default_settings.start_dotenv(obj)

    # Deal with cases where a custom ENV_SWITCHER_IS_PROVIDED
    # Example: Flask and Django Extensions
    env_switcher = defaults.get(
        "ENV_SWITCHER_FOR_DYNACONF", "ENV_FOR_DYNACONF"
    )

    for key in all_keys:
        if key not in default_settings_values.keys():
            continue

        env_value = obj.get_environ(
            env_switcher if key == "ENV_FOR_DYNACONF" else key,
            default="_not_found",
        )

        if env_value != "_not_found":
            obj.logger.debug("overriding from envvar: %s:%s", key, env_value)
            obj.set(key, env_value, tomlfy=True)
1103519
def get_section_config(self, section):
        

        if section not in self._config:
            return self._config["DEFAULT"]
        return self._config[section]
682836
def _fill_default_values(cls, cls_context, dict_):
        

        dict_with_default_values = dict(dict_)
        params = re.findall(cls._PATTERN_PARAM_NAME_TYPED_ANY,
                            cls_context.__doc__)

        for param in params:
            if param not in dict_with_default_values:
                dict_with_default_values[param] = None

        return dict_with_default_values
448251
def parse(self, requires_cfg=True):
        
        self._parse_default()
        self._parse_config(requires_cfg)
        self._parse_env()
597104
def fill_with_defaults(process_input, input_schema):
    """"""
    for field_schema, fields, path in iterate_schema(process_input, input_schema):
        if 'default' in field_schema and field_schema['name'] not in fields:
            dict_dot(process_input, path, field_schema['default'])
1223531
def set_defaults(self, config, fields_spec):
        
        defaults = dict([(f, d)
                         for f, d in fields_spec.items()
                         if not isinstance(d, type)])
        for field, default_value in defaults.items():
            if field not in config:
                config[field] = default_value
1309948
function applyDefaults(params, defaults) {
    var settings = params || {};

    for(var setting in defaults) {
      if(defaults.hasOwnProperty(setting) && !settings[setting]) {
        settings[setting] = defaults[setting];
      }
    }

    return settings;
  }
987326
def apply_config_defaults(parser, args, root):
    """"""
    if root is None:
        try:
            from pep8radius.vcs import VersionControl
            root = VersionControl.which().root_dir()
        except NotImplementedError:
            pass  # don't update local, could be using as module

    config = SafeConfigParser()
    config.read(args.global_config)
    if root and not args.ignore_local_config:
        config.read(local_config_files(root))

    try:
        defaults = dict((k.lstrip('-').replace('-', '_'), v)
                        for k, v in config.items("pep8"))
        parser.set_defaults(**defaults)
    except NoSectionError:
        pass  # just do nothing, potentially this could raise ?
    return parser
1082496
def propagate_defaults(config_doc):
    
    for group_name, group_doc in config_doc.items():
        if isinstance(group_doc, dict):
            defaults = group_doc.get('defaults', {})

            for item_name, item_doc in group_doc.items():
                if item_name == 'defaults':
                    continue
                if isinstance(item_doc, dict):

                    group_doc[item_name] = \
                        dict_merge_pair(copy.deepcopy(defaults), item_doc)

    return config_doc