code: def _create_defaults_list(
      self,
      config_path: str,
      defaults: ListConfig,
  ) -> List[InputDefault]:
      def issue_deprecated_name_warning() -> None:
          # DEPRECATED: remove in 1.2
          url = "https://hydra.cc/docs/1.2/upgrades/1.0_to_1.1/changes_to_package_header"
          deprecation_warning(
              message=dedent(
                  f"""\
                      In {config_path}: Defaults List contains deprecated keyword _name_, see {url}
                      """
              ),
          )
  
      res: List[InputDefault] = []
      for item in defaults._iter_ex(resolve=False):
          default: InputDefault
          if isinstance(item, DictConfig):
              if not version.base_at_least("1.2"):
                  old_optional = None
                  if len(item) > 1:
                      if "optional" in item:
                          old_optional = item.pop("optional")
              keys = list(item.keys())
  
              if len(keys) > 1:
                  raise ValueError(
                      f"In {config_path}: Too many keys in default item {item}"
                  )
              if len(keys) == 0:
                  raise ValueError(
                      f"In {config_path}: Missing group name in {item}"
                  )
  
              key = keys[0]
              assert isinstance(key, str)
              config_group, package, _package2 = self._split_group(key)
              keywords = ConfigRepository.Keywords()
              self._extract_keywords_from_config_group(
                  config_group, keywords
              )
  
              if not version.base_at_least("1.2"):
                  if not keywords.optional and old_optional is not None:
                      keywords.optional = old_optional
  
              node = item._get_node(key)
              assert node is not None and isinstance(node, Node)
              config_value = node._value()
  
              if not version.base_at_least("1.2"):
                  if old_optional is not None:
                      msg = dedent(
                          f"""
                              In {config_path}: 'optional: true' is deprecated.
                              Use 'optional {key}: {config_value}' instead.
                              Support for the old style is removed for Hydra version_base >= 1.2"""
                      )
  
                      deprecation_warning(msg)
  
              if config_value is not None and not isinstance(
                  config_value, (str, list)
              ):
                  raise ValueError(
                      f"Unsupported item value in defaults : {type(config_value).__name__}."
                      " Supported: string or list"
                  )
  
              if isinstance(config_value, list):
                  options = []
                  for v in config_value:
                      vv = v._value()
                      if not isinstance(vv, str):
                          raise ValueError(
                              f"Unsupported item value in defaults : {type(vv).__name__},"
                              " nested list items must be strings"
                          )
                      options.append(vv)
                  config_value = options
  
              if not version.base_at_least("1.2"):
                  if package is not None and "_name_" in package:
                      issue_deprecated_name_warning()
  
              default = GroupDefault(
                  group=keywords.group,
                  value=config_value,
                  package=package,
                  optional=keywords.optional,
                  override=keywords.override,
              )
  
          elif isinstance(item, str):
              path, package, _package2 = self._split_group(item)
              if not version.base_at_least("1.2"):
                  if package is not None and "_name_" in package:
                      issue_deprecated_name_warning()
  
              default = ConfigDefault(path=path, package=package)
          else:
              raise ValueError(
                  f"Unsupported type in defaults : {type(item).__name__}"
              )
          res.append(default)
      return res
  
imports: import copy
  from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from textwrap import dedent
  from typing import Dict, List, Optional, Tuple
  from omegaconf import Container, DictConfig, ListConfig, Node, OmegaConf, open_dict, read_write
  from hydra import version
  from hydra.core.config_search_path import ConfigSearchPath
  from hydra.core.object_type import ObjectType
  from hydra.plugins.config_source import ConfigResult, ConfigSource
  from ..core.default_element import ConfigDefault, GroupDefault, InputDefault
  from .deprecation_warning import deprecation_warning
  from .sources_registry import SourcesRegistry
label_desc: Use image node_id 12 for calling the ConfigRepository obj's underlying member method code with example usage: obj._create_defaults_list(config_path, defaults) and returns: res