<commit_before># Package

from .... import models as m

class Root(object):
    """Root

    The main root object for v1 API traversal
    """

    __name__ = None
    __parent__ = None

    def __init__(self, request):
        """Create the default root object

        :request: The Pyramid request object

        """
        self._request = request

    def __getitem__(self, key):
        """Check to see if we can traverse this ..."""

        next_ctx = None

        if key == 'v1':
            next_ctx = None

        if next_ctx is None:
            raise KeyError
        else:
            next_ctx.__parent__ = self
            return next_ctx

    def finalise(self, **kw):
        """Gets the list of sites

        :returns: None
        """

        self.sites = m.DBSession.query(m.Site)<commit_msg>Traverse to Site when passed an key<commit_after>from .site import Site

from .... import models as m

class Root(object):
    """Root

    The main root object for v1 API traversal
    """

    __name__ = None
    __parent__ = None

    def __init__(self, request):
        """Create the default root object

        :request: The Pyramid request object

        """
        self._request = request

    def __getitem__(self, key):
        """Check to see if we can traverse this ..."""

        next_ctx = None

        try:
            next_ctx = Site(key)
        except ValueError:
            next_ctx = None

        if next_ctx is None:
            raise KeyError
        else:
            next_ctx.__parent__ = self
            return next_ctx

    def finalise(self, **kw):
        """Gets the list of sites

        :returns: None
        """

        self.sites = m.DBSession.query(m.Site)
{'fraction_non_alphanumeric': 0.09080325960419092, 'fraction_numerical': 0.0017462165308498253, 'mean_word_length': 1.7113564668769716, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5704155', 'n_tokens_mistral': 501, 'n_tokens_neox': 470, 'n_words': 165}