<commit_before>import functools
try:
    from urlparse import urlunparse
except ImportError:
    from urllib.parse import urlunparse

from django.conf import settings
from django.core.urlresolvers import reverse as simple_reverse


def current_site_domain():
    domain = getattr(settings, 'BASE_DOMAIN', False)

    prefix = 'www.'
    if getattr(settings, 'REMOVE_WWW_FROM_DOMAIN', False) \
            and domain.startswith(prefix):
        domain = domain.replace(prefix, '', 1)

    return domain<commit_msg>Raise an exception if BASE_DOMAIN is not defined<commit_after>import functools
try:
    from urlparse import urlunparse
except ImportError:
    from urllib.parse import urlunparse

from django.conf import settings
from django.core.urlresolvers import reverse as simple_reverse


def current_site_domain():
    domain = getattr(settings, 'BASE_DOMAIN')

    prefix = 'www.'
    if getattr(settings, 'REMOVE_WWW_FROM_DOMAIN', False) \
            and domain.startswith(prefix):
        domain = domain.replace(prefix, '', 1)

    return domain
{'fraction_non_alphanumeric': 0.07874762808349146, 'fraction_numerical': 0.0018975332068311196, 'mean_word_length': 3.9530516431924885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4781738', 'n_tokens_mistral': 317, 'n_tokens_neox': 308, 'n_words': 89}