<commit_before>import base64
import flask
import json
import logging
from marshmallow import ValidationError
import sqlalchemy as sa
from sqlalchemy import Column, sql

from . import meta
from . import utils

__all__ = ('IdCursorPagination',)

# -----------------------------------------------------------------------------

logger = logging.getLogger(__name__)

# -----------------------------------------------------------------------------


class IdCursorPagination(object):
    def __init__(self, default_limit=None, max_limit=None):
        self._default_limit = utils.if_none(default_limit, max_limit)
        self._max_limit = max_limit

    def __call__(self, query, view):
        column_specs = self.get_column_specs(query, view)
<commit_msg>Validate default_limit not exceeding max_limit<commit_after>import base64
import flask
import json
import logging
from marshmallow import ValidationError
import sqlalchemy as sa
from sqlalchemy import Column, sql

from . import meta
from . import utils

__all__ = ('IdCursorPagination',)

# -----------------------------------------------------------------------------

logger = logging.getLogger(__name__)

# -----------------------------------------------------------------------------


class IdCursorPagination(object):
    def __init__(self, default_limit=None, max_limit=None):
        self._default_limit = utils.if_none(default_limit, max_limit)
        self._max_limit = max_limit

        if self._max_limit is not None:
            assert \
                self._default_limit <= self._max_limit, \
                "default limit exceeds max limit"

    def __call__(self, query, view):
        column_specs = self.get_column_specs(query, view)

{'fraction_non_alphanumeric': 0.24049151550614395, 'fraction_numerical': 0.0023405500292568754, 'mean_word_length': 1.8452579034941763, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6516403', 'n_tokens_mistral': 436, 'n_tokens_neox': 423, 'n_words': 115}