<commit_before>from django.db.models.signals import post_syncdb

message = """
    'django-email-accounts' has detected that you just installed Django's authentication system (django.auth). 
         
    For your convenience, django-email-accounts can alter the user table's username field to allow 75 characters instead
    of the default 35 chars. Unless you do this, emails that are longer than 30 characters will be cut off, and this 
    app will probably not work!
    
    NOTE: this will only work if the SQL user account you have created for django has the privileges
    to run ALTER statements.
    
    Do you want django-email-accounts to try to alter the auth_user.username column to allow 75 characters? 
    (y/N): """

def query_fix_usertable(sender, app, created_models, verbosity, interactive, **kwargs):
    model_names = [m.__name__ for m in created_models]
    if not interactive or app.__name__ != 'django.contrib.auth.models' or "User" not in model_names:
        return
    
    answer = raw_input(message)
    while not answer.lower() in ('y', 'n', 'yes', 'no'):
        raw_input("You need to either decide yes ('y') or no ('n'). Default is no. (y/N): ")

    from django.conf import settings
    from django.db import connection

    engine = settings.DATABASES['default']['ENGINE']

    cursor = connection.cursor()

    if 'postgis' in engine or 'postgresql_psycopg2' in engine:
        cursor.execute('ALTER TABLE auth_user ALTER username TYPE character varying(75)')
    elif 'sqlite3' in engine:
        cursor.execute('ALTER TABLE "auth_user" RENAME TO "auth_user_temp"')
        cursor.execute('CREATE TABLE "auth_user" ("id" integer NOT NULL PRIMARY KEY,"username" varchar(75) NOT NULL UNIQUE,"first_name" varchar(30) NOT NULL,"last_name" varchar(30) NOT NULL,"email" varchar(75) NOT NULL,"password" varchar(128) NOT NULL,"is_staff" bool NOT NULL,"is_active" bool NOT NULL,"is_superuser" bool NOT NULL,"last_login" datetime NOT NULL,"date_joined" datetime NOT NULL)')
        cursor.execute('INSERT INTO "auth_user" SELECT * FROM "auth_user_temp"')
        cursor.execute('DROP TABLE "auth_user_temp"')<commit_msg>Rename old app name reference in management.py message<commit_after>from django.db.models.signals import post_syncdb

message = """
    'django-email-usernames' has detected that you just installed Django's authentication system (django.auth). 
         
    For your convenience, django-email-usernames can alter the user table's username field to allow 75 characters instead
    of the default 35 chars. Unless you do this, emails that are longer than 30 characters will be cut off, and this 
    app will probably not work!
    
    NOTE: this will only work if the SQL user account you have created for django has the privileges
    to run ALTER statements.
    
    Do you want django-email-usernames to try to alter the auth_user.username column to allow 75 characters? 
    (y/N): """

def query_fix_usertable(sender, app, created_models, verbosity, interactive, **kwargs):
    model_names = [m.__name__ for m in created_models]
    if not interactive or app.__name__ != 'django.contrib.auth.models' or "User" not in model_names:
        return
    
    answer = raw_input(message)
    while not answer.lower() in ('y', 'n', 'yes', 'no'):
        raw_input("You need to either decide yes ('y') or no ('n'). Default is no. (y/N): ")

    from django.conf import settings
    from django.db import connection

    engine = settings.DATABASES['default']['ENGINE']

    cursor = connection.cursor()

    if 'postgis' in engine or 'postgresql_psycopg2' in engine:
        cursor.execute('ALTER TABLE auth_user ALTER username TYPE character varying(75)')
    elif 'sqlite3' in engine:
        cursor.execute('ALTER TABLE "auth_user" RENAME TO "auth_user_temp"')
        cursor.execute('CREATE TABLE "auth_user" ("id" integer NOT NULL PRIMARY KEY,"username" varchar(75) NOT NULL UNIQUE,"first_name" varchar(30) NOT NULL,"last_name" varchar(30) NOT NULL,"email" varchar(75) NOT NULL,"password" varchar(128) NOT NULL,"is_staff" bool NOT NULL,"is_active" bool NOT NULL,"is_superuser" bool NOT NULL,"last_login" datetime NOT NULL,"date_joined" datetime NOT NULL)')
        cursor.execute('INSERT INTO "auth_user" SELECT * FROM "auth_user_temp"')
        cursor.execute('DROP TABLE "auth_user_temp"')
{'fraction_non_alphanumeric': 0.09733087896916705, 'fraction_numerical': 0.01058444546709618, 'mean_word_length': 3.9229898074745186, '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': '6788764', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1223, 'n_words': 472}