Slice config for printing as defined in key.

    :param ConfigManager config: configuration dictionary
    :param str key: dotted key, by which config should be sliced for printing

    :returns: sliced config
    :rtype: dict
515508
def slice_config(config, key):
    
    if key:
        keys = key.split('.')
        for k in keys:
            config = config[k]

    return config
1334675
def set_key(key: str, value: str) -> dict:
    
    if not _conf.path:
        return {}

    if "toml" in _conf.path:
        with open(_conf.path, "r") as f:
            parser = parse(f.read())
        parser["tool"]["commitizen"][key] = value
        with open(_conf.path, "w") as f:
            f.write(parser.as_string())
    else:
        parser = configparser.ConfigParser()
        parser.read(_conf.path)
        parser["commitizen"][key] = value
        with open(_conf.path, "w") as f:
            parser.write(f)

    return _conf.config
426860
def configuration(ctx):
    
    t = [["Key", "Value"]]
    for key in ctx.bitshares.config:
        t.append([key, ctx.bitshares.config[key]])
    print_table(t)
1297202
def config_dict(config):
    
    return dict(
        (key, getattr(config, key))
        for key in config.values
    )
66226
def configuration(*args, **kwargs):
    """"""
    try:
        config_kwargs = {'mapping_class': kwargs.pop('mapping_class')}
    except KeyError:
        config_kwargs = {}
    cm = ConfigurationManager(*args, **kwargs)
    return cm.get_config(**config_kwargs)
436178
def config(_config=None, **kwargs):
    
    if _config is None:
        _config = {}
    _config.update(kwargs)

    def wrapper(func):
        func._config = _config
        return func
    return wrapper
1077257
def config(self):
        
        if not hasattr(self, '_config'):
            raw_config = configparser.RawConfigParser()
            f = self._open()
            if f:
                raw_config.readfp(f)
                f.close()
            self._config = raw_config
        return self._config
1001580
def print_config(self):
        """"""
        linters = self.user_linters or list(self.linters)
        print('linters:', ', '.join(linters))
        for key, value in self._config.items():
            if key != 'linters':
                print('{}: {}'.format(key, value))
1097724
def config():
    '''
    
    '''
    config = get_config()
    print('Client version: {0}'.format(click.style(__version__, bold=True)))
    print('API endpoint: {0}'.format(click.style(str(config.endpoint), bold=True)))
    print('API version: {0}'.format(click.style(config.version, bold=True)))
    print('Access key: "{0}"'.format(click.style(config.access_key, bold=True)))
    masked_skey = config.secret_key[:6] + ('*' * 24) + config.secret_key[-10:]
    print('Secret key: "{0}"'.format(click.style(masked_skey, bold=True)))
    print('Signature hash type: {0}'.format(
        click.style(config.hash_type, bold=True)))
    print('Skip SSL certificate validation? {0}'.format(
        click.style(str(config.skip_sslcert_validation), bold=True)))
1179517
def print_config(self, cfg, hide_password=True, history=False, module_id=None):
		
		shutit_global.shutit_global_object.yield_to_draw()
		cp = self.config_parser
		s = ''
		keys1 = list(cfg.keys())
		if keys1:
			keys1.sort()
		for k in keys1:
			if module_id is not None and k != module_id:
				continue
			if isinstance(k, str) and isinstance(cfg[k], dict):
				s += '\n[' + k + ']\n'
				keys2 = list(cfg[k].keys())
				if keys2:
					keys2.sort()
				for k1 in keys2:
					line = ''
					line += k1 + ':'
					# If we want to hide passwords, we do so using a sha512
					# done an aritrary number of times (27).
					if hide_password and (k1 == 'password' or k1 == 'passphrase'):
						p = hashlib.sha512(cfg[k][k1]).hexdigest()
						i = 27
						while i > 0:
							i -= 1
							p = hashlib.sha512(s).hexdigest()
						line += p
					else:
						if type(cfg[k][k1] == bool):
							line += str(cfg[k][k1])
						elif type(cfg[k][k1] == str):
							line += cfg[k][k1]
					if history:
						try:
							line += (30-len(line)) * ' ' + ' # ' + cp.whereset(k, k1)
						except Exception:
							# Assume this is because it was never set by a config parser.
							line += (30-len(line)) * ' ' + ' # ' + "defaults in code"
					s += line + '\n'
		return s
676857
def tcfg_get(key)
      t_tcfg = tcfg
      unless t_tcfg.key? key
        raise NoSuchConfigurationKeyError, "No configuration defined for '#{key}'"
      end
      t_tcfg[key]
    end
1069852
def get_value(self, key):
        # type: (str) -> Any
        
        try:
            return self._dictionary[key]
        except KeyError:
            raise ConfigurationError("No such key - {}".format(key))
38833
def print_config_values(self, prefix='- '):
        
        print('Configuration values from ' + self.config_dir)
        self.print_config_value(self.CONFIG_NAME_USER, prefix=prefix)
        self.print_config_value(self.CONFIG_NAME_PATH, prefix=prefix)
        self.print_config_value(self.CONFIG_NAME_PROXY, prefix=prefix)
        self.print_config_value(self.CONFIG_NAME_COMPETITION, prefix=prefix)
1210821
def parse(self):
        

        self._config = _Config()

        self._setDefaults()

        for parser in self.parsers:
            for key, value in parser.parse(self, self._config).items():
                key = self._sanitizeName(key)
                if key not in self.configs:
                    raise UnknownConfigurationException(key)
                if value is not None:
                    self._setConfig(key, value)

        self._ensureRequired()
        self._cast()

        return self._config
1340317
def config_to_dict_of_dict(desired_type: Type[T], config: ConfigParser, logger: Logger,
                           conversion_finder: ConversionFinder, **kwargs) -> DictOfDict:
    
    # return dict(config)

    # get the base collection type if provided
    base_typ, discarded = _extract_collection_base_type(desired_type, exception_if_none=False)
    # if none, at least declare dict
    base_typ = base_typ or Dict

    # convert the whole config to a dictionary by flattening all sections. If a key is found twice in two different
    # sections an error is raised
    results = dict()
    for section, props in config.items():
        # convert all values of the sub-dictionary
        results[section] = ConversionFinder.convert_collection_values_according_to_pep(props, base_typ,
                                                                                       conversion_finder, logger,
                                                                                       **kwargs)

    return results
571248
def config(key, default=None):
    
    return Mocha._app.config.get(key, default) if Mocha._app else default
927706
def get_config(cls, key, default=None):
        
        return cls._app.config.get(key, default)