diff --git a/django_2_2_pymysql_patch.py b/django_2_2_pymysql_patch.py deleted file mode 100644 index db94d4772..000000000 --- a/django_2_2_pymysql_patch.py +++ /dev/null @@ -1,17 +0,0 @@ -import django -from django.utils.encoding import force_str - -if (2, 2) <= django.VERSION < (3,): - # Django 2.2.x is incompatible with PyMySQL. - # This monkey patch backports the Django 3.0+ code. - - from django.db.backends.mysql.operations import DatabaseOperations - - def last_executed_query(self, cursor, sql, params): - # With MySQLdb, cursor objects have an (undocumented) "_executed" - # attribute where the exact query sent to the database is saved. - # See MySQLdb/cursors.py in the source distribution. - # MySQLdb returns string, PyMySQL bytes. - return force_str(getattr(cursor, '_executed', None), errors='replace') - - DatabaseOperations.last_executed_query = last_executed_query diff --git a/dmoj/wsgi_async.py b/dmoj/wsgi_async.py index b62d3531a..ec114d1fd 100644 --- a/dmoj/wsgi_async.py +++ b/dmoj/wsgi_async.py @@ -9,6 +9,4 @@ gevent.monkey.patch_all() import dmoj_install_pymysql # noqa: E402, F401, I100, I202, imported for side effect from django.core.wsgi import get_wsgi_application # noqa: E402, I100, I202, django must be imported here -# noinspection PyUnresolvedReferences -import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect application = get_wsgi_application() diff --git a/dmoj_bridge_async.py b/dmoj_bridge_async.py index dee411242..376f8cf8d 100644 --- a/dmoj_bridge_async.py +++ b/dmoj_bridge_async.py @@ -11,9 +11,6 @@ import dmoj_install_pymysql # noqa: E402, F401, I100, I202, imported for side e import django # noqa: E402, F401, I100, I202, django must be imported here django.setup() -# noinspection PyUnresolvedReferences -import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect - from judge.bridge.daemon import judge_daemon # noqa: E402, I100, I202, django code must be imported here if __name__ == '__main__': diff --git a/dmoj_celery.py b/dmoj_celery.py index d25a7452a..3f9701f17 100644 --- a/dmoj_celery.py +++ b/dmoj_celery.py @@ -8,8 +8,5 @@ except ImportError: # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings') -# noinspection PyUnresolvedReferences -import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect - # noinspection PyUnresolvedReferences from dmoj.celery import app # noqa: E402, F401, imported for side effect diff --git a/manage.py b/manage.py index 73945155a..adaffbd99 100755 --- a/manage.py +++ b/manage.py @@ -11,7 +11,4 @@ if __name__ == '__main__': os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings') from django.core.management import execute_from_command_line - # noinspection PyUnresolvedReferences - import django_2_2_pymysql_patch # noqa: F401, imported for side effect - execute_from_command_line(sys.argv)