<commit_before>from django.conf import settings
from django.core.validators import validate_email
from email.utils import parseaddr
from pkgtools.pypi import PyPIJson
import sys

if sys.version_info >= (3,):
    from urllib.error import HTTPError, URLError
    import urllib.request as urllib2
else:
    from urllib2 import HTTPError, URLError
    import urllib2


def is_pretty_from_address(input):
    name, email = parseaddr(input)
    validate_email(email)

    if name:
        return True
    else:
        return False


def _get_installed_version_from_app(app):
    if hasattr(app, 'get_version'):
        if callable(app.get_version):
            return app.get_version()
        return app.get_version<commit_msg>Changes so that djohno still works on Django 1.6<commit_after>from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from email.utils import parseaddr
from pkgtools.pypi import PyPIJson
import sys

if sys.version_info >= (3,):
    from urllib.error import HTTPError, URLError
    import urllib.request as urllib2
else:
    from urllib2 import HTTPError, URLError
    import urllib2


def is_pretty_from_address(input):
    name, email = parseaddr(input)

    if email == 'webmaster@localhost':
        # This is the default setting for DEFAULT_FROM_EMAIL, so if
        # this is the email we've got, you should probably override
        # DEFAULT_FROM_EMAIL in your settings file.
        raise ValidationError("Enter a valid value.")

    validate_email(email)

    if name:
        return True
    else:
        return False


def _get_installed_version_from_app(app):
    if hasattr(app, 'get_version'):
        if callable(app.get_version):
            return app.get_version()
        return app.get_version
{'fraction_non_alphanumeric': 0.06446280991735537, 'fraction_numerical': 0.005509641873278237, 'mean_word_length': 3.407766990291262, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2044494', 'n_tokens_mistral': 563, 'n_tokens_neox': 541, 'n_words': 167}