Scans the config block and parses the domain-id value

        Args:
            config (str): The config block to scan

        Returns:
            dict: A dict object that is intended to be merged into the
                resource dict
334097
def _parse_domain_id(self, config):
        
        match = re.search(r'domain-id (.+)$', config)
        value = match.group(1) if match else None
        return dict(domain_id=value)
151622
def parse_config(data)
      config = {'graph' => {}, 'metrics' => {}}
      data.each do |l|
        if l =~ /^graph_/
          key_name, value = l.scan(/^graph_([\w]+)\s(.*)/).flatten
          config['graph'][key_name] = value
        # according to http://munin-monitoring.org/wiki/notes_on_datasource_names
        elsif l =~ /^[a-zA-Z_][a-zA-Z\d_]*\./
          # according to http://munin-monitoring.org/wiki/fieldnames the second one
          # can only be [a-z]
          matches = l.scan(/^([a-zA-Z_][a-zA-Z\d_]*)\.([a-z]+)\s(.*)/).flatten
          config['metrics'][matches[0]] ||= {}
          config['metrics'][matches[0]][matches[1]] = matches[2]
        end
      end

      # Now, lets process the args hash
      if config['graph'].key?('args')
        config['graph']['args'] = parse_config_args(config['graph']['args'])
      end

      config
    end
651172
def _parse_config(config_file_path):
    
    config_file = open(config_file_path, 'r')
    config = yaml.load(config_file)
    config_file.close()
    return config
369472
def parse_dom(self):
        
        if self.dom is None:
            return {}
        else:
            domain = {}
            for child in self.dom:
                if len(child) == 0:
                    domain[child.tag] = child.text
                else:
                    domain[child.tag] = [c.items() for c in child]

            return domain
690330
def parse(self, ifconfig=None):  # noqa: max-complexity=12
        
        if not ifconfig:
            ifconfig, __, __ = exec_cmd(self.get_command())
        self.ifconfig_data = ifconfig
        cur = None
        patterns = self.get_patterns()
        for line in self.ifconfig_data.splitlines():
            for pattern in patterns:
                m = re.match(pattern, line)
                if not m:
                    continue
                groupdict = m.groupdict()
                # Special treatment to trigger which interface we're
                # setting for if 'device' is in the line.  Presumably the
                # device of the interface is within the first line of the
                # device block.
                if 'device' in groupdict:
                    cur = groupdict['device']
                    self.add_device(cur)
                elif cur is None:
                    raise RuntimeError(
                        "Got results that don't belong to a device"
                    )

                for k, v in groupdict.items():
                    if k in self._interfaces[cur]:
                        if self._interfaces[cur][k] is None:
                            self._interfaces[cur][k] = v
                        elif hasattr(self._interfaces[cur][k], 'append'):
                            self._interfaces[cur][k].append(v)
                        elif self._interfaces[cur][k] == v:
                            # Silently ignore if the it's the same value as last. Example: Multiple
                            # inet4 addresses, result in multiple netmasks. Cardinality mismatch
                            continue
                        else:
                            raise RuntimeError(
                                "Tried to add {}={} multiple times to {}, it was already: {}".format(
                                    k,
                                    v,
                                    cur,
                                    self._interfaces[cur][k]
                                )
                            )
                    else:
                        self._interfaces[cur][k] = v

        # Copy the first 'inet4' ip address to 'inet' for backwards compatibility
        for device, device_dict in self._interfaces.items():
            if len(device_dict['inet4']) > 0:
                device_dict['inet'] = device_dict['inet4'][0]

        # fix it up
        self._interfaces = self.alter(self._interfaces)
1292045
def read_config(config):
    
    for line in config.splitlines():
        line = line.lstrip()
        if line and not line.startswith("#"):
            return line
    return ""
602940
def from_dict(self, d: Dict[str, Any]) -> None:
        """"""
        for key, value in d.items():
            if key.isupper():
                self._setattr(key, value)

        logger.info("Config is loaded from dict: %r", d)
1196662
def _parse_config(self, config):
        
        self._batch_size = config['batch_size']
        self._im_height = config['im_height']
        self._im_width = config['im_width']
        self._num_channels = config['channels']
        self._output_layer = config['out_layer']
        self._feature_layer = config['feature_layer']
        self._out_size = None
        if 'out_size' in config.keys():
            self._out_size = config['out_size']
        self._input_arr = np.zeros([self._batch_size, self._im_height,
                                    self._im_width, self._num_channels])

        if self._model_dir is None:
            self._net_data = np.load(config['caffe_weights']).item()
            self._mean = np.load(config['mean_file'])
            self._model_filename = None
        else:
            self._net_data = None
            self._mean = np.load(os.path.join(self._model_dir, 'mean.npy'))
            self._model_filename = os.path.join(self._model_dir, 'model.ckpt')
389707
def get_config_dict(config):
    '''
    
    '''
    dst = {}
    tmp = config.__dict__
    key_list = dir(config)
    key_list.remove('os')
    for k, v in tmp.items():
        if k in key_list and not k.startswith('_'):
            dst[k] = v
    return dst
1299854
def _read_config(config_location):
    
    global LOGGING_CONFIG
    with open(config_location, "r") as config_loc:
        cfg_file = json.load(config_loc)
        if "logging" in cfg_file:
            log_dict = cfg_file.get("logging")
            with open(os.path.abspath(os.path.join(__file__,
                                                   os.path.pardir,
                                                   'logging_schema.json'))) as schema_file:
                logging_schema = json.load(schema_file)
                jsonschema.validate(log_dict, logging_schema)
                merged = jsonmerge.merge(LOGGING_CONFIG, log_dict)
                LOGGING_CONFIG = merged
327948
def _parse_website_config(self, (response, xml_bytes)):
        """"""
        root = XML(xml_bytes)
        index_suffix = root.findtext("IndexDocument/Suffix")
        error_key = root.findtext("ErrorDocument/Key")

        return WebsiteConfiguration(index_suffix, error_key)
751146
def get(self):
        
        resource = dict()
        resource.update(self._parse_config())
        resource.update(self._parse_interfaces())

        return resource
644518
def _parse_interfaces(self):
        
        interfaces = dict()
        names = re.findall(r'^interface (Po.+)$', self.config, re.M)
        for name in names:
            config = self.get_block('interface %s' % name)
            match = re.search(r'mlag (\d+)', config)
            if match:
                interfaces[name] = dict(mlag_id=match.group(1))
        return dict(interfaces=interfaces)
591941
def security(self, domain):
        '''
        '''
        uri = self._uris["security"].format(domain)
        return self.get_parse(uri)
1258049
def _get_config_dict_from_file(config_path=None):
    
    if config_path is None:
        config_path = DEFAULT_CONFIG_PATH

    # Default (empty) content will be used if config file does not exist.
    config_content = {}

    # If the config file exists we use that content.
    if os.path.isfile(config_path):
        with open(config_path) as fh:
            config_content = json.load(fh)

    return config_content
502764
def read_config(config_path_or_dict=None):
    
    config = None

    if isinstance(config_path_or_dict, dict):
        config = Config(config_path_or_dict)

    if isinstance(config_path_or_dict, string_types):
        if os.path.isabs(config_path_or_dict):
            config_path = config_path_or_dict
        else:
            config_path = os.path.join(
                os.getcwd(),
                os.path.normpath(config_path_or_dict)
            )
    else:
        config_path = os.path.join(
            os.getcwd(),
            DEFAULT_CONFIG_PATH
        )

    if os.path.exists(config_path):
        with open(config_path, 'r') as f:
            data = json.load(f)
            config = Config(data)

    if config is None:
        raise ConfigNotFound()
    else:
        config.validate()

        return config
354940
def get_targets(self, config):
        

        return {urllib.parse.urljoin(self.url, attrs['href'])
                for attrs in self._targets
                if self._check_rel(attrs, config.rel_whitelist, config.rel_blacklist)
                and self._domain_differs(attrs['href'])}