<commit_before>import re
import os

from django.core import checks
from django.conf import settings

re_url = re.compile(r'\shref="(?P<url>/[^"]*)"')

@checks.register()
def hardcoded_urls(app_configs, **kwargs):
    for x in settings.TEMPLATES:
        for y in x['DIRS']:
            for root, _, filenames in os.walk(y):
                for z in filenames:
                    fullpath = os.path.join(root, z)

                    with open(fullpath) as f:
                        html = f.read()

                    for m in re_url.finditer(html):
                        yield checks.Error("%s contains hardcoded URL %s" % (
                            fullpath,
                            m.group('url'),
                        ), id='takeyourmeds.utils.E001')<commit_msg>Use repr so it's more obvious what the problem is<commit_after>import re
import os

from django.core import checks
from django.conf import settings

re_url = re.compile(r'\shref="(?P<url>/[^"]*)"')

@checks.register()
def hardcoded_urls(app_configs, **kwargs):
    for x in settings.TEMPLATES:
        for y in x['DIRS']:
            for root, _, filenames in os.walk(y):
                for z in filenames:
                    fullpath = os.path.join(root, z)

                    with open(fullpath) as f:
                        html = f.read()

                    for m in re_url.finditer(html):
                        yield checks.Error("%s contains hardcoded URL %r" % (
                            fullpath,
                            m.group('url'),
                        ), id='takeyourmeds.utils.E001')
{'fraction_non_alphanumeric': 0.1132665832290363, 'fraction_numerical': 0.0037546933667083854, 'mean_word_length': 1.5220820189274449, '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': '3839820', 'n_tokens_mistral': 481, 'n_tokens_neox': 446, 'n_words': 122}