

def limited(items, request, max_limit=FLAGS.osapi_max_limit):
    "\n    Return a slice of items according to requested offset and limit.\n\n    @param items: A sliceable entity\n    @param request: `wsgi.Request` possibly containing 'offset' and 'limit'\n                    GET variables. 'offset' is where to start in the list,\n                    and 'limit' is the maximum number of items to return. If\n                    'limit' is not specified, 0, or > max_limit, we default\n                    to max_limit. Negative values for either offset or limit\n                    will cause exc.HTTPBadRequest() exceptions to be raised.\n    @kwarg max_limit: The maximum number of items to return from 'items'\n    "
    try:
        offset = int(request.GET.get('offset', 0))
    except ValueError:
        msg = _('offset param must be an integer')
        raise webob.exc.HTTPBadRequest(explanation=msg)
    try:
        limit = int(request.GET.get('limit', limit))
    except ValueError:
        msg = _('limit param must be an integer')
        raise webob.exc.HTTPBadRequest(explanation=msg)
    if (limit < 0):
        msg = _('limit param must be positive')
        raise webob.exc.HTTPBadRequest(explanation=msg)
    if (offset < 0):
        msg = _('offset param must be positive')
        raise webob.exc.HTTPBadRequest(explanation=msg)
    limit = min(max_limit, (limit or max_limit))
    range_end = (offset + limit)
    return items[offset:range_end]

dataset/ETHPy150Open nii-cloud/dodai-compute/nova/api/openstack/common.py limited/VarMisuse@82/343 `max_limit`->`limit`