<commit_before>from google.appengine.ext.webapp import template
import os


# decorators
class templateSelector(object):
    def __init__(self, template):
        """
            If there are decorator arguments, the function
            to be decorated is not passed to the constructor!
        """
        self.template = template

    def __call__(self, f):
        """
            If there are decorator arguments, __call__() is only called
            once, as part of the decoration process! You can only give
            it a single argument, which is the function object.
        """
        def wrapped_f(*args, **kwargs):
            temp = os.path.join(os.path.dirname(__file__), self.template)
            response, template_data = f(*args)
            outstr = template.render(temp, template_data)
            response.out.write(outstr)
        
        return wrapped_f

#def selectorTemplate(method,tempplate):
#  temp = os.path.join(os.path.dirname(__file__),template)
#  outstr = template.render(temp,{
#                   'nombre_seccion':nombre_seccion,
#                   'texto_seccion':texto_seccion,'path':path})
#  self.response.out.write(outstr)<commit_msg>add dynamic host for urls<commit_after>from google.appengine.ext.webapp import template
import os


# decorators
class templateSelector(object):
    def __init__(self, template):
        """
            If there are decorator arguments, the function
            to be decorated is not passed to the constructor!
        """
        self.template = template

    def __call__(self, f):
        """
            If there are decorator arguments, __call__() is only called
            once, as part of the decoration process! You can only give
            it a single argument, which is the function object.
        """
        def wrapped_f(*args, **kwargs):
            temp = os.path.join(os.path.dirname(__file__), self.template)
            response, template_data = f(*args)
            template_data['host'] = args[0].request.host_url
            outstr = template.render(temp, template_data)
            response.out.write(outstr)
        
        return wrapped_f

#def selectorTemplate(method,tempplate):
#  temp = os.path.join(os.path.dirname(__file__),template)
#  outstr = template.render(temp,{
#                   'nombre_seccion':nombre_seccion,
#                   'texto_seccion':texto_seccion,'path':path})
#  self.response.out.write(outstr)
{'fraction_non_alphanumeric': 0.09881098810988109, 'fraction_numerical': 0.0004100041000410004, 'mean_word_length': 2.4173669467787113, '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': '1621213', 'n_tokens_mistral': 682, 'n_tokens_neox': 668, 'n_words': 177}