<commit_before>'''
Created on Oct 12, 2013

@author: <NAME>
'''

from flask.globals import _request_ctx_stack


class RenderTemplateWidget(object):

    template = 'appbuilder/general/widgets/render.html'
    template_args = None

    def __init__(self, **kwargs):
        self.template_args = kwargs
    
    def __call__(self, **kwargs):
        ctx = _request_ctx_stack.top
        jinja_env = ctx.app.jinja_env

        template = jinja_env.get_template(self.template)
        args = dict(self.template_args.items() + kwargs.items())
        return template.render(args)<commit_msg>Update widgets.py<commit_after>'''
Created on Oct 12, 2013

@author: <NAME>
'''

import logging
from flask.globals import _request_ctx_stack

log = logging.getLogger(__name__)

class RenderTemplateWidget(object):

    template = 'appbuilder/general/widgets/render.html'
    template_args = None

    def __init__(self, **kwargs):
        self.template_args = kwargs
    
    def __call__(self, **kwargs):
        ctx = _request_ctx_stack.top
        jinja_env = ctx.app.jinja_env
        
        template = jinja_env.get_template(self.template)
        args = dict(self.template_args.items() + kwargs.items())
        log.debug('RenderTemplateWidget.__class__.args: %s' % (str(args)))
        return template.render(args)
{'fraction_non_alphanumeric': 0.11238532110091744, 'fraction_numerical': 0.009174311926605505, 'mean_word_length': 3.3059210526315788, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2983264', 'n_tokens_mistral': 426, 'n_tokens_neox': 402, 'n_words': 81}