

def register_api_doc_endpoints(config, endpoints, base_path='/api-docs'):
    'Create and register pyramid endpoints to service swagger api docs.\n    Routes and views will be registered on the `config` at `path`.\n\n    :param config: a pyramid configuration to register the new views and routes\n    :type  config: :class:`pyramid.config.Configurator`\n    :param endpoints: a list of endpoints to register as routes and views\n    :type  endpoints: a list of :class:`pyramid_swagger.model.PyramidEndpoint`\n    :param base_path: the base path used to register api doc endpoints.\n        Defaults to `/api-docs`.\n    :type  base_path: string\n    '
    for endpoint in endpoints:
        path = (base_path.rstrip('/') + endpoint.path)
        config.add_route(endpoint.route_name, path)
        config.add_view(endpoint.view, route_name=endpoint.route_name, renderer=endpoint.renderer)

dataset/ETHPy150Open striglia/pyramid_swagger/pyramid_swagger/api.py register_api_doc_endpoints/original