<commit_before>from __future__ import absolute_import
from pony.py23compat import PY2, imap, basestring, buffer, int_types

from decimal import Decimal
from datetime import datetime, date, time, timedelta
from uuid import UUID

import warnings
warnings.filterwarnings('ignore', '^Table.+already exists$', Warning, '^pony\\.orm\\.dbapiprovider$')

try: import MySQLdb as mysql_module
except ImportError:
    try: import pymysql as mysql_module
    except ImportError: raise ImportError('No module named MySQLdb or pymysql found')
    else:
        import pymysql.converters as mysql_converters
        from pymysql.constants import FIELD_TYPE, FLAG, CLIENT
        if PY2:
            mysql_converters.encoders[buffer] = lambda val: mysql_converters.escape_str(str(val))
        mysql_converters.encoders[timedelta] = lambda val: mysql_converters.escape_str(timedelta2str(val))
        mysql_module_name = 'pymysql'
else:
    import MySQLdb.converters as mysql_converters
    from MySQLdb.constants import FIELD_TYPE, FLAG, CLIENT
    mysql_module_name = 'MySQLdb'
    from MySQLdb import string_literal

from pony.orm import core, dbschema, dbapiprovider
from pony.orm.core import log_orm, OperationalError
from pony.orm.dbapiprovider import DBAPIProvider, Pool, get_version_tuple, wrap_dbapi_exceptions
from pony.orm.sqltranslation import SQLTranslator
from pony.orm.sqlbuilding import SQLBuilder, join<commit_msg>Fixes #87: Pony fails with pymysql installed as MySQLdb<commit_after>from __future__ import absolute_import
from pony.py23compat import PY2, imap, basestring, buffer, int_types

from decimal import Decimal
from datetime import datetime, date, time, timedelta
from uuid import UUID

import warnings
warnings.filterwarnings('ignore', '^Table.+already exists$', Warning, '^pony\\.orm\\.dbapiprovider$')

try:
    import MySQLdb as mysql_module
    from MySQLdb import string_literal
    import MySQLdb.converters as mysql_converters
    from MySQLdb.constants import FIELD_TYPE, FLAG, CLIENT
    mysql_module_name = 'MySQLdb'
except ImportError:
    try:
        import pymysql as mysql_module
    except ImportError:
        raise ImportError('No module named MySQLdb or pymysql found')
    import pymysql.converters as mysql_converters
    from pymysql.constants import FIELD_TYPE, FLAG, CLIENT
    if PY2: mysql_converters.encoders[buffer] = lambda val: mysql_converters.escape_str(str(val))
    mysql_converters.encoders[timedelta] = lambda val: mysql_converters.escape_str(timedelta2str(val))
    mysql_module_name = 'pymysql'

from pony.orm import core, dbschema, dbapiprovider
from pony.orm.core import log_orm, OperationalError
from pony.orm.dbapiprovider import DBAPIProvider, Pool, get_version_tuple, wrap_dbapi_exceptions
from pony.orm.sqltranslation import SQLTranslator
from pony.orm.sqlbuilding import SQLBuilder, join
{'fraction_non_alphanumeric': 0.06751054852320675, 'fraction_numerical': 0.004219409282700422, 'mean_word_length': 5.144708423326134, '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': '1051804', 'n_tokens_mistral': 924, 'n_tokens_neox': 885, 'n_words': 251}