config.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:UrbanSearch 作者: urbansearchTUD 项目源码 文件源码
def get(entity, param):
    """
    Returns the configuration value belonging to a specified entity
    (e.g. neo4j) and parameter (e.g. host).

    :param entity: The configuration entity
    :param param: The configuration parameter
    :return: The configuration value
    :raises ValueError if a requested parameter is not configured
    """
    try:
        value = _get_config()[entity][param]
        LOGGER.debug('Found config: {}:{} => {}'.format(entity, param, value))
        return _get_config()[entity][param]
    except KeyError:
        # Should _never_ happen in production!
        msg = 'Parameter {} is not present for entity {}!'.format(param,
                                                                  entity)
        LOGGER.critical(msg)
        raise ValueError(msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号