<commit_before>from uber.common import *

def check_if_can_reg(func):
    @wraps(func)
    def with_check(*args,**kwargs):
        if state.BADGES_SOLD >= MAX_BADGE_SALES:
            raise HTTPRedirect('../static_views/prereg_soldout.html')
        elif state.PREREG_OPEN == "notopenyet":
            raise HTTPRedirect('../static_views/prereg_not_yet_open.html')
        elif state.PREREG_OPEN == "closed":
            raise HTTPRedirect('../static_views/prereg_closed.html')
        else:
            return func(*args,**kwargs)
    return with_check

def site_mappable(func):
    func.site_mappable = True
    return func


def cached_property(func):
    pname = '_' + func.__name__
    @property
    @wraps(func)
    def caching(self, *args, **kwargs):
        if not hasattr(self, pname):
            setattr(self, pname, func(self, *args, **kwargs))
        return getattr(self, pname)
    return caching<commit_msg>dont redirect prereg closed/open/capped fixes #270<commit_after>from uber.common import *

def check_if_can_reg(func):
    @wraps(func)
    def with_check(*args,**kwargs):
        if state.BADGES_SOLD >= MAX_BADGE_SALES:
            return render('static_views/prereg_soldout.html')
        elif state.PREREG_OPEN == "notopenyet":
            return render('static_views/prereg_not_yet_open.html')
        elif state.PREREG_OPEN == "closed":
            return render('static_views/prereg_closed.html')
        else:
            return func(*args,**kwargs)
    return with_check

def site_mappable(func):
    func.site_mappable = True
    return func


def cached_property(func):
    pname = '_' + func.__name__
    @property
    @wraps(func)
    def caching(self, *args, **kwargs):
        if not hasattr(self, pname):
            setattr(self, pname, func(self, *args, **kwargs))
        return getattr(self, pname)
    return caching
{'fraction_non_alphanumeric': 0.11619150080688542, 'fraction_numerical': 0.0016137708445400753, 'mean_word_length': 2.9157894736842107, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, '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': '3580458', 'n_tokens_mistral': 626, 'n_tokens_neox': 610, 'n_words': 120}