def create_bravado_core_config(settings):
    """Create a configuration dict for bravado_core based on pyramid_swagger
    settings.

    :param settings: pyramid registry settings with configuration for
        building a swagger schema
    :type settings: dict
    :returns: config dict suitable for passing into
        bravado_core.spec.Spec.from_dict(..)
    :rtype: dict
    """
    # Map pyramid_swagger config key -> bravado_core config key
    config_keys = {
        'pyramid_swagger.enable_request_validation': 'validate_requests',
        'pyramid_swagger.enable_response_validation': 'validate_responses',
        'pyramid_swagger.enable_swagger_spec_validation':
            'validate_swagger_spec',
        'pyramid_swagger.use_models': 'use_models',
        'pyramid_swagger.user_formats': 'formats',
    }

    bravado_core_config_defaults = {
        'use_models': False
    }

    return dict(bravado_core_config_defaults, **dict(
        (bravado_core_key, settings[pyramid_swagger_key])
        for pyramid_swagger_key, bravado_core_key in config_keys.items()
        if pyramid_swagger_key in settings))
dataset/ETHPy150Open striglia/pyramid_swagger/pyramid_swagger/ingest.py/create_bravado_core_config/original