common.py 文件源码

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

项目:mongodb-monitoring 作者: jruaux 项目源码 文件源码
def get_validated_options(options, warn=True):
    """Validate each entry in options and raise a warning if it is not valid.
    Returns a copy of options with invalid entries removed
    """
    validated_options = {}
    for opt, value in iteritems(options):
        lower = opt.lower()
        try:
            validator = URI_VALIDATORS.get(lower, raise_config_error)
            value = validator(opt, value)
        except (ValueError, ConfigurationError) as exc:
            if warn:
                warnings.warn(str(exc))
            else:
                raise
        else:
            validated_options[lower] = value
    return validated_options
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号