<commit_before>"""
MySQL database backend for Django.

Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""

from django.core.db import base, typecasts
from django.core.db.dicthelpers import *
import MySQLdb as Database
from MySQLdb.converters import conversions
from MySQLdb.constants import FIELD_TYPE
import types

DatabaseError = Database.DatabaseError

django_conversions = conversions.copy()
django_conversions.update({
    types.BooleanType: typecasts.rev_typecast_boolean,
    FIELD_TYPE.DATETIME: typecasts.typecast_timestamp,
    FIELD_TYPE.DATE: typecasts.typecast_date,
    FIELD_TYPE.TIME: typecasts.typecast_time,
})

class DatabaseWrapper:
    def __init__(self):
        self.connection = None
        self.queries = []

    def cursor(self):
        from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG
        if self.connection is None:
            self.connection = Database.connect(user=DATABASE_USER, db=DATABASE_NAME,
                passwd=<PASSWORD>, host=DATABASE_HOST, conv=django_conversions)
        if DEBUG:
            return base.CursorDebugWrapper(self.connection.cursor(), self)
        return self.connection.cursor()<commit_msg>Fixed #316 -- Changed MySQL backend to disregard warnings<commit_after>"""
MySQL database backend for Django.

Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""

from django.core.db import base, typecasts
from django.core.db.dicthelpers import *
import MySQLdb as Database
from MySQLdb.converters import conversions
from MySQLdb.constants import FIELD_TYPE
from MySQLdb.cursors import CursorNW # Ignores MySQL warnings.
import types

DatabaseError = Database.DatabaseError

django_conversions = conversions.copy()
django_conversions.update({
    types.BooleanType: typecasts.rev_typecast_boolean,
    FIELD_TYPE.DATETIME: typecasts.typecast_timestamp,
    FIELD_TYPE.DATE: typecasts.typecast_date,
    FIELD_TYPE.TIME: typecasts.typecast_time,
})

class DatabaseWrapper:
    def __init__(self):
        self.connection = None
        self.queries = []

    def cursor(self):
        from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG
        if self.connection is None:
            self.connection = Database.connect(user=DATABASE_USER, db=DATABASE_NAME,
                passwd=<PASSWORD>, host=DATABASE_HOST, conv=django_conversions,
                cursorclass=CursorNW)
        if DEBUG:
            return base.CursorDebugWrapper(self.connection.cursor(), self)
        return self.connection.cursor()
{'fraction_non_alphanumeric': 0.08298117556665387, 'fraction_numerical': 0.001152516327314637, 'mean_word_length': 4.007692307692308, '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': '2864477', 'n_tokens_mistral': 794, 'n_tokens_neox': 742, 'n_words': 170}