<commit_before>import os
from django.conf import settings
from django.template import loader
from django.template.loader_tags import ExtendsNode


def find_template_source(name):
    for loader_path in settings.TEMPLATE_LOADERS:
        template_loader = loader.find_template_loader(loader_path)
        try:
            source, origin = template_loader.load_template_source(name)
            break
        except Exception as e:
            print e
    return source, origin

def find_parents(name, parents=None):
    """
    Recursively find all of this template's parents and return them as a list.
    """
    template = loader.get_template(name)
    source, origin = find_template_source(name)
    if parents is None:
        parents = []
    else:
        parents.append({'name': name, 'file': origin})
    for node in template:
        if isinstance(node, ExtendsNode):
            parent_name = node.parent_name.token.strip('"')<commit_msg>Cleaned up a bare except.<commit_after>import os
from django.conf import settings
from django.template import loader, TemplateDoesNotExist
from django.template.loader_tags import ExtendsNode


def find_template_source(name):
    """
    Load the source code and origin of the first template that matches the
    given name.
    """
    for loader_path in settings.TEMPLATE_LOADERS:
        template_loader = loader.find_template_loader(loader_path)
        try:
            source, origin = template_loader.load_template_source(name)
        except TemplateDoesNotExist:
            continue
        break
    return source, origin

def find_parents(name, parents=None):
    """
    Recursively find all of this template's parents and return them as a list.
    """
    template = loader.get_template(name)
    source, origin = find_template_source(name)
    if parents is None:
        parents = []
    else:
        parents.append({'name': name, 'file': origin})
    for node in template:
        if isinstance(node, ExtendsNode):
            parent_name = node.parent_name.token.strip('"')
{'fraction_non_alphanumeric': 0.07892156862745098, 'fraction_numerical': 0.0, 'mean_word_length': 3.033596837944664, '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': '1728642', 'n_tokens_mistral': 555, 'n_tokens_neox': 550, 'n_words': 168}