Converts the given extra data to relevant configuration values.
553567
protected function convert($extra)
    {
        if (isset($extra['custom-installer'])) {
            foreach ($extra['custom-installer'] as $pattern => $specs) {
                foreach ($specs as $spec) {
                    $match = array();
                    // Type matching
                    if (preg_match('/^type:(.*)$/', $spec, $match)) {
                        $this->types[$match[1]] = $pattern;
                    } // Else it must be the package name.
                    else {
                        $this->packages[$spec] = $pattern;
                    }
                }
            }
        }
    }
734235
def _merge_config(self, config_override):
        
        if not isinstance(config_override, dict):
            raise TypeError("config override must be a dict")

        def recursion(config_value, override_value):
            for key, value in override_value.items():
                if key in config_value:
                    if isinstance(value, dict) and isinstance(config_value[key], dict):
                        recursion(config_value[key], value)
                    else:
                        config_value[key] = value
                else:
                    config_value[key] = value

        for key, value in config_override.items():
            if key in self._data:
                recursion(self._data[key], value)
            else:
                self._data[key] = value
684391
def convert(data)
      data.each do |k, v|
        k = KEYS[k] if KEYS.include?(k)
        v = v.to_s if k.eql? 'zip'

        if NIDT.include?(k)
          instance_variable_set('@nidt', k)
          k = 'nidn'
          v = v.to_s
        end

        var_set(k, v)
      end
    end
521341
def extra_downloader_converter(value):
    
    if isinstance(value, six.string_types):
        value = value.split(" ")
    return value
162766
def _bin_to_extra(extra_bytes):
  
  #global _bam_value_type
  extra = StringIO(extra_bytes)
  tags = {}
  rem = ''
  while extra.tell() < len(extra_bytes):
    tag = extra.read(2)
    val_type = extra.read(1)
    if val_type == 'Z':
      rem += tag+':'
      rem += val_type+':'
      p = re.compile('([!-~])')
      m = p.match(extra.read(1))
      vre = ''
      while m:
        vre += m.group(1)
        c = extra.read(1)
        #print c
        m = p.match(c)
      rem += vre+"\t"
      tags[tag] = TagDatum(val_type, vre)
      #tags[tag] = {'type':val_type,'value':vre}
    elif val_type == 'A':
      rem += tag+':'
      rem += val_type+':'
      vre = extra.read(1)
      rem += vre+"\t"      
      tags[tag] = TagDatum(val_type, vre)
      #tags[tag] = {'type':val_type,'value':vre}      
    elif val_type in _bam_value_type:
      rem += tag+':'
      rem += 'i'+':'
      val = struct.unpack(_bam_value_type[val_type][1],extra.read(_bam_value_type[val_type][0]))[0]
      rem += str(val)+"\t"
      tags[tag] = TagDatum(val_type, val)
      #tags[tag] = {'type':val_type,'value':val}
    elif val_type == 'B':
      sys.sterr.write("WARNING array not implmented\n")
      continue
      rem += tag+':'
      rem += val_type+':'
      array_type = _bam_value_type[extra.read(1)]
      element_count = struct.unpack('<I',extra.read(4))[0]
      array_bytes = extra.read(element_count*_bam_value_type[array_type][0])
      for by in [array_bytes[i:i+_bam_value_type[array_type][0]] for i in range(0,len(array_bytes),_bam_value_type[array_type][0])]:
        aval = struct.unpack(_bam_value_type[array_type][1],by)
  return [tags,rem.rstrip("\t")]
560637
def expand_system_vars(data):
    """"""
    def _expanded(value):
        if isinstance(value, basestring):
            value = expandvars(value)
            value = expanduser(value)
            return scoped_format(value, system=system)
        elif isinstance(value, (list, tuple, set)):
            return [_expanded(x) for x in value]
        elif isinstance(value, dict):
            return dict((k, _expanded(v)) for k, v in value.iteritems())
        else:
            return value
    return _expanded(data)
55951
def extra(self, value, extra_name, default=None):
        
        try:
            return self.get(value).get(extra_name, default)
        except InvalidEnumItem:
            return default
512506
def apply_time_to_configurations(self, configurations, data):
        """"""

        time_value = None
        if data.get('time'):
            time_value = data['time']

            # Only single time values are supported. For extents, just grab the first value
            if isinstance(data['time'], (tuple, list)):
                time_value = time_value[0]

        if time_value:
            for config in configurations:
                config.set_time_index_from_datetime(time_value, best_fit=ALLOW_BEST_FIT_TIME_INDEX)

        return configurations
229223
def extra_configuration_collection(self, configuration):
        """"""
        configuration["__imported__"] = {}
        configuration["__registered__"] = {}
        configuration["__active_modules__"] = {}

        def make_converter(name, spec):
            def converter(p, v):
                log.info("Converting %s", p)
                meta = Meta(p.configuration, [(name, "")])
                configuration.converters.started(p)
                return spec.normalise(meta, v)
            return converter
        configuration.install_converters(DashMatConverters(), make_converter)

        if "modules" in configuration:
            for module_name, module_options in list(configuration["modules"].items()):
                if "import_path" in module_options:
                    module = module_import_spec(Module).normalise(Meta(configuration, []).at("modules").at(module_name), module_options["import_path"])
                    import_path = "{0}:{1}".format(module.module_path, module.__name__)
                    self.activate_module(module_name, import_path, module, configuration)
                    configuration[["modules", module_name, "import_path"]] = module
386968
def extra_hosts(self, value):
        
        if value is None:
            self._extra_hosts = value
        elif isinstance(value, list):
            # TODO: better validation
            self._extra_hosts = value
        elif isinstance(value, dict):
            converted_extra_hosts = []
            for k, v in sorted(six.iteritems(value)):
                if not is_valid_hostname(k):
                    raise ValueError("each key in extra hosts is required to be a valid hostname. {0} was passed".format(k))

                if not is_valid_ip(v):
                    raise ValueError("each value in extra hosts is required to be a valid ip address. {0} was passed".format(v))

                converted_extra_hosts.append('{0}:{1}'.format(k, v))

            self._extra_hosts = converted_extra_hosts
        else:
            raise TypeError("extra hosts must be a dict, list, or None. {0} was passed".format(value))
1081331
def _extrapolation(self, extrapolate):
        """"""
        modes = ['extrapolate',
                 'raise',
                 'const',
                 'border']
        if extrapolate not in modes:
            msg = 'invalid extrapolation mode {}'.format(extrapolate)
            raise ValueError(msg)

        if extrapolate == 'raise':
            self.bounds_error = True
            self.extrapolate = False
        else:
            self.extrapolate = True
            self.bounds_error = False
        self.extrapolate_mode = extrapolate
551160
def _merge_extra_filerefs(*args):
    '''
    
    '''
    ret = []
    for arg in args:
        if isinstance(arg, six.string_types):
            if arg:
                ret.extend(arg.split(','))
        elif isinstance(arg, list):
            if arg:
                ret.extend(arg)
    return ','.join(ret)
293011
def process_raw_data(cls, raw_data):
        """"""
        properties = raw_data.get("properties", {})

        raw_ip_configuration = properties.get("backendIPConfiguration", [])
        if isinstance(raw_ip_configuration, dict):
            raw_ip_configuration = [raw_ip_configuration]

        for raw_content in raw_ip_configuration:
            backend_ip_configuration = Resource.from_raw_data(raw_content)
            properties["backendIPConfiguration"] = backend_ip_configuration

        frontend_ip_configurations = []
        for raw_content in properties.get("frontendIPConfigurations", []):
            resource = Resource.from_raw_data(raw_content)
            frontend_ip_configurations.append(resource)
        properties["frontendIPConfigurations"] = frontend_ip_configurations

        return super(InboundNATRules, cls).process_raw_data(raw_data)
980459
def _merge_data(self, data: AnyMapping, *additional: AnyMapping) -> dict:
        
        """
        return defaults(
            dict(data) if not isinstance(data, dict) else data,
            *(dict(item) for item in additional))
1219384
def merge_record_extra(record, target, reserved):
    
    for key, value in record.__dict__.items():
        # this allows to have numeric keys
        if (key not in reserved
            and not (hasattr(key, "startswith")
                     and key.startswith('_'))):
            target[key] = value
    return target
183656
def _encode_config(conf_dict):
    """"""
    out = []

    # get variables in order defined in settings._ALLOWED_MERGES
    for var in settings._ALLOWED_MERGES:
        out.append(conf_dict[var])

    # convert bools to chars
    out = map(
        lambda x: "t" if x else "f",
        out
    )

    return "".join(out)
1361420
def extra_configuration_collection(self, configuration):
        
        harpoon_spec = HarpoonSpec()

        for image in configuration.get('images', {}).keys():
            self.make_image_converters(image, configuration, harpoon_spec)

        self.register_converters(
              { (0, ("content", )): sb.dictof(sb.string_spec(), sb.string_spec())
              , (0, ("harpoon", )): harpoon_spec.harpoon_spec
              , (0, ("authentication", )): harpoon_spec.authentications_spec
              }
            , Meta, configuration, sb.NotSpecified
            )

        # Some other code works better when harpoon no existy
        if configuration["harpoon"] is sb.NotSpecified:
            del configuration["harpoon"]