Return a tuple with config section and key.
196485
def _split_section_and_key(key):
    """"""
    parts = key.split('.')
    if len(parts) > 1:
        return 'renku "{0}"'.format(parts[0]), '.'.join(parts[1:])
    return 'renku', key
1258770
def config(self) -> dict:
        """"""
        # Check that the key exists
        self._check_object_exists()
        config_dict = DB.get_hash_dict(self.key)
        for _, value in config_dict.items():
            for char in ['[', '{']:
                if char in value:
                    value = ast.literal_eval(value)
        return config_dict
1220915
def config_section(self):
        
        names = []
        cmd = self
        while cmd.parent:
            names.append(cmd.name)
            cmd = cmd.parent
        if not names:
            return self.name
        else:
            return ' '.join(reversed(names))
834478
def config_(cls, key, default=None):
        
        return cls._app.config.get(key, default)
364233
def parse_config(main_section, *filenames):
    """"""
    filename = filenames[-1]
    filename = os.path.abspath(filename)
    here = os.path.dirname(filename)
    defaults = dict(here=here, hash='#')
    defaults['#'] = '#'

    config = configparser.ConfigParser(
        defaults, allow_no_value=False,
        interpolation=configparser.ExtendedInterpolation(),
    )
    config.optionxform = str
    config.read([os.path.expanduser('~/.irc3/passwd.ini')] + list(filenames))

    value = {}
    for s in config.sections():
        items = {}
        for k, v in config.items(s):
            if '\n' in v:
                v = as_list(v)
            elif v.isdigit():
                v = int(v)
            elif v.replace('.', '').isdigit() and v.count('.') == 1:
                v = float(v)
            elif v in ('true', 'false'):
                v = v == 'true' and True or False
            items[k] = v
        if s == main_section:
            value.update(items)
        else:
            for k in ('here', 'config'):
                items.pop(k, '')
            value[s] = items
    value.update(defaults)
    value['configfiles'] = filenames
    return value
262314
def _call_config(self, method, *args, **kwargs):
        """"""
        return getattr(self._config, method)(self._section_name, *args, **kwargs)
434861
def keys(self):
        """"""
        s = set()
        for config in self.__configs:
            s |= config.keys()
        return s
688974
def by_name(self):
        """"""
        return {key.split(preferences_settings.SECTION_KEY_SEPARATOR)[-1]: value for key, value in self.all().items()}
102056
def conf_from_dict(conf_dict):
    '''
    
    '''
    conf = Config(filename=conf_dict.get('__file__', ''))

    for k, v in six.iteritems(conf_dict):
        if k.startswith('__'):
            continue
        elif inspect.ismodule(v):
            continue

        conf[k] = v
    return conf
927706
def get_config(cls, key, default=None):
        
        return cls._app.config.get(key, default)
744608
def items(self, section=None):
        """"""
        if not section and self.section:
            section = self.section
        config = self.config.get(section, {}) if section else self.config
        return config.items()
750481
def sections(self) -> list:
        """"""
        self.config.read(self.filepath)
        return self.config.sections()
628500
def get_configuration_dict(self, secret_attrs=False):
        """"""
        rd = {'name': self.name,
              'path': self.path,
              'git_dir': self.git_dir,
              'assumed_doc_version': self.assumed_doc_version,
              'doc_dir': self.doc_dir,
              'git_ssh': self.git_ssh, }
        if secret_attrs:
            rd['pkey'] = self.pkey
        with self._index_lock:
            si = self._doc_index
        r = _invert_dict_list_val(si)
        key_list = list(r.keys())
        rd['number of documents'] = len(key_list)
        key_list.sort()
        m = []
        for k in key_list:
            v = r[k]
            fp = k[2]
            assert fp.startswith(self.doc_dir)
            rp = fp[len(self.doc_dir) + 1:]
            m.append({'keys': v, 'relpath': rp})
        rd['documents'] = m
        return rd
1200486
def _get_value_from_config(self, section, name):
        """"""

        conf = configuration.get_config()

        try:
            value = conf.get(section, name)
        except (NoSectionError, NoOptionError, KeyError):
            return _no_value

        return self.parse(value)
829080
def get_config(name, expand=False):
    
    cfg = Config.instance()
    only_section = "." not in name

    # when only the section is given, print all keys
    if only_section:
        return "\n".join(cfg.keys(name))

    else:
        section, option = name.split(".", 1)
        func = cfg.get_expanded if expand else cfg.get
        return func(section, option)
418803
def as_dict(config):
    
    settings = defaultdict(lambda: {})
    for section in config.sections():
        for key, val in config.items(section):
            settings[section][key] = val
    return settings
882176
def config_at(self, i):
      """"""
      selections = {}
      for key in self.store:
        value = self.store[key]
        if isinstance(value, list):
            selected = i % len(value)
            i = i // len(value)
            selections[key]= value[selected]
        else:
            selections[key]= value

      return Config(selections)