<commit_before>import pygit2

from ast import literal_eval

from beaker.cache import cache_region

from gitmodel import exceptions

from pyramid.view import view_config
from pyramid.renderers import get_renderer
from pyramid.decorator import reify
from pyramid.response import Response
from pyramid.httpexceptions import HTTPFound, HTTPNotFound

from unicore_gitmodels import models
from cms import utils

CACHE_TIME = 'long_term'


class CmsViews(object):

    def __init__(self, request):
        self.request = request
        self.repo_path = self.request.registry.settings['git.path']
        self.locale = request.locale_name

    def get_repo_models(self):
        repo = pygit2.Repository(self.repo_path)
        ws = utils.get_workspace(repo)
        return ws.import_models(models)

    @reify
    def get_available_languages(self):
        langs = self.request.registry.settings.get(
            'available_languages', '[]')
        return literal_eval(langs)

    @reify
    def global_template(self):
        renderer = get_renderer("templates/base.pt")
        return renderer.implementation().macros['layout']

    def get_categories(self):
        return self._get_categories(self.locale)
<commit_msg>change default cache region to `default_term`<commit_after>import pygit2

from ast import literal_eval

from beaker.cache import cache_region

from gitmodel import exceptions

from pyramid.view import view_config
from pyramid.renderers import get_renderer
from pyramid.decorator import reify
from pyramid.response import Response
from pyramid.httpexceptions import HTTPFound, HTTPNotFound

from unicore_gitmodels import models
from cms import utils

CACHE_TIME = 'default_term'


class CmsViews(object):

    def __init__(self, request):
        self.request = request
        self.repo_path = self.request.registry.settings['git.path']
        self.locale = request.locale_name

    def get_repo_models(self):
        repo = pygit2.Repository(self.repo_path)
        ws = utils.get_workspace(repo)
        return ws.import_models(models)

    @reify
    def get_available_languages(self):
        langs = self.request.registry.settings.get(
            'available_languages', '[]')
        return literal_eval(langs)

    @reify
    def global_template(self):
        renderer = get_renderer("templates/base.pt")
        return renderer.implementation().macros['layout']

    def get_categories(self):
        return self._get_categories(self.locale)

{'fraction_non_alphanumeric': 0.07857432158768732, 'fraction_numerical': 0.0016200891049007696, 'mean_word_length': 3.678030303030303, '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': '595173', 'n_tokens_mistral': 730, 'n_tokens_neox': 699, 'n_words': 171}