<commit_before>import jinja2

from inspector import Inspector

templateLoader = jinja2.FileSystemLoader(searchpath="templates")
templateEnv = jinja2.Environment(loader=templateLoader)


class Generator(object):

    def __init__(self, view, module):
        self.view = view
        self.module = module
        self.inspector = Inspector(self.view, self.module)

    def get_context(self):
        ancestors = self.inspector.get_views_mro()
        attributes = self.inspector.get_attributes()
        methods = self.inspector.get_methods()
        return {'name': self.view, 'ancestors': ancestors,
                'attributes': attributes, 'methods': methods}

    def generate(self, filename):
        template = templateEnv.get_template('detail_view.html')
        context = self.get_context()
        with open(filename, 'w') as f:
            f.write(template.render(context))


# generator = Generator('CreateAPIView', 'rest_framework.generics')
# generator.generate()<commit_msg>Remove comment<commit_after>import jinja2

from inspector import Inspector

templateLoader = jinja2.FileSystemLoader(searchpath="templates")
templateEnv = jinja2.Environment(loader=templateLoader)


class Generator(object):

    def __init__(self, view, module):
        self.view = view
        self.module = module
        self.inspector = Inspector(self.view, self.module)

    def get_context(self):
        ancestors = self.inspector.get_views_mro()
        attributes = self.inspector.get_attributes()
        methods = self.inspector.get_methods()
        return {'name': self.view, 'ancestors': ancestors,
                'attributes': attributes, 'methods': methods}

    def generate(self, filename):
        template = templateEnv.get_template('detail_view.html')
        context = self.get_context()
        with open(filename, 'w') as f:
            f.write(template.render(context))
{'fraction_non_alphanumeric': 0.11040339702760085, 'fraction_numerical': 0.0031847133757961785, 'mean_word_length': 3.393939393939394, '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': '1672572', 'n_tokens_mistral': 545, 'n_tokens_neox': 517, 'n_words': 110}