diff --git a/common/djangoapps/course_modes/admin.py b/common/djangoapps/course_modes/admin.py index 0181c0c50b..d738dd3673 100644 --- a/common/djangoapps/course_modes/admin.py +++ b/common/djangoapps/course_modes/admin.py @@ -4,7 +4,6 @@ from django.conf import settings from django.contrib import admin from django.http.request import QueryDict from django.utils.translation import ugettext_lazy as _ -from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from pytz import UTC, timezone @@ -22,7 +21,6 @@ from course_modes.models import CourseMode, CourseModeExpirationConfig from lms.djangoapps.verify_student import models as verification_models from openedx.core.lib.courses import clean_course_id from util.date_utils import get_time_display -from xmodule.modulestore.django import modulestore COURSE_MODE_SLUG_CHOICES = [(key, enrollment_mode['display_name']) for key, enrollment_mode in six.iteritems(settings.COURSE_ENROLLMENT_MODES)] diff --git a/common/djangoapps/enrollment/tests/test_views.py b/common/djangoapps/enrollment/tests/test_views.py index edaff1fe41..bc70c20928 100644 --- a/common/djangoapps/enrollment/tests/test_views.py +++ b/common/djangoapps/enrollment/tests/test_views.py @@ -40,11 +40,7 @@ from openedx.core.djangoapps.user_api.models import ( from openedx.core.lib.django_test_client_utils import get_absolute_url from openedx.features.enterprise_support.tests import FAKE_ENTERPRISE_CUSTOMER from openedx.features.enterprise_support.tests.mixins.enterprise import EnterpriseServiceMockMixin -from student.models import ( - CourseEnrollment, - get_retired_username_by_username, - get_retired_email_by_email, -) +from student.models import CourseEnrollment from student.roles import CourseStaffRole from student.tests.factories import AdminFactory, UserFactory, SuperuserFactory from util.models import RateLimitConfiguration diff --git a/common/djangoapps/enrollment/views.py b/common/djangoapps/enrollment/views.py index 246d8a0cd2..f502fde54f 100644 --- a/common/djangoapps/enrollment/views.py +++ b/common/djangoapps/enrollment/views.py @@ -6,8 +6,6 @@ consist primarily of authentication, request validation, and serialization. import logging from course_modes.models import CourseMode -from django.db import transaction -from django.contrib.auth import get_user_model from django.core.exceptions import ObjectDoesNotExist from django.utils.decorators import method_decorator from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication diff --git a/common/djangoapps/entitlements/api/v1/views.py b/common/djangoapps/entitlements/api/v1/views.py index c8bf87203f..5559c1225c 100644 --- a/common/djangoapps/entitlements/api/v1/views.py +++ b/common/djangoapps/entitlements/api/v1/views.py @@ -3,7 +3,6 @@ import logging from django.db import IntegrityError, transaction from django.db.models import Q from django.http import HttpResponseBadRequest -from django.utils import timezone from django_filters.rest_framework import DjangoFilterBackend from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication from edx_rest_framework_extensions.paginators import DefaultPagination diff --git a/common/djangoapps/pipeline_mako/tests/test_render.py b/common/djangoapps/pipeline_mako/tests/test_render.py index c2b12d1b29..86a08d2f13 100644 --- a/common/djangoapps/pipeline_mako/tests/test_render.py +++ b/common/djangoapps/pipeline_mako/tests/test_render.py @@ -3,10 +3,8 @@ from unittest import skipUnless import ddt -import os from django.conf import settings from django.test import TestCase -from paver.easy import call_task from mock import patch from pipeline_mako import compressed_css, compressed_js, render_require_js_path_overrides diff --git a/common/djangoapps/student/management/commands/bulk_unenroll.py b/common/djangoapps/student/management/commands/bulk_unenroll.py index 6671b92bc7..16009318b4 100644 --- a/common/djangoapps/student/management/commands/bulk_unenroll.py +++ b/common/djangoapps/student/management/commands/bulk_unenroll.py @@ -2,7 +2,7 @@ import logging import unicodecsv from django.core.exceptions import ObjectDoesNotExist -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand from django.db.models import Q from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey diff --git a/common/djangoapps/student/management/commands/manage_user.py b/common/djangoapps/student/management/commands/manage_user.py index f7cc172ac1..1a08714533 100644 --- a/common/djangoapps/student/management/commands/manage_user.py +++ b/common/djangoapps/student/management/commands/manage_user.py @@ -5,7 +5,7 @@ Django users, set/unset permission bits, and associate groups by name. from django.contrib.auth import get_user_model from django.contrib.auth.hashers import is_password_usable -from django.contrib.auth.models import Group, BaseUserManager +from django.contrib.auth.models import Group from django.core.management.base import BaseCommand, CommandError from django.db import transaction from django.utils.translation import gettext as _ diff --git a/common/djangoapps/student/management/tests/test_bulk_unenroll.py b/common/djangoapps/student/management/tests/test_bulk_unenroll.py index a86352bf3e..d9984a0d42 100644 --- a/common/djangoapps/student/management/tests/test_bulk_unenroll.py +++ b/common/djangoapps/student/management/tests/test_bulk_unenroll.py @@ -7,7 +7,7 @@ from testfixtures import LogCapture from course_modes.tests.factories import CourseModeFactory from student.tests.factories import UserFactory -from student.models import CourseEnrollment, User +from student.models import CourseEnrollment LOGGER_NAME = 'student.management.commands.bulk_unenroll' diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index 2906d2fd66..130e09b9e5 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -30,7 +30,7 @@ from django.contrib.auth.models import User from django.contrib.auth.signals import user_logged_in, user_logged_out from django.core.cache import cache from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist -from django.db import IntegrityError, models, transaction +from django.db import IntegrityError, models from django.db.models import Count, Q from django.db.models.signals import post_save, pre_save from django.db.utils import ProgrammingError diff --git a/common/djangoapps/student/tests/test_activate_account.py b/common/djangoapps/student/tests/test_activate_account.py index 099516b53a..aacbbbcf21 100644 --- a/common/djangoapps/student/tests/test_activate_account.py +++ b/common/djangoapps/student/tests/test_activate_account.py @@ -7,7 +7,6 @@ from django.urls import reverse from django.test import TestCase, override_settings from mock import patch -from edxmako.shortcuts import render_to_string from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.user_api.config.waffle import PREVENT_AUTH_USER_WRITES, SYSTEM_MAINTENANCE_MSG, waffle from student.models import Registration diff --git a/common/djangoapps/student/tests/test_email.py b/common/djangoapps/student/tests/test_email.py index babf69167b..f0ba4135b4 100644 --- a/common/djangoapps/student/tests/test_email.py +++ b/common/djangoapps/student/tests/test_email.py @@ -17,14 +17,12 @@ from edxmako.shortcuts import render_to_string from openedx.core.djangoapps.ace_common.tests.mixins import EmailTemplateTagMixin from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme -from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration from openedx.core.djangoapps.user_api.config.waffle import PREVENT_AUTH_USER_WRITES, SYSTEM_MAINTENANCE_MSG, waffle from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, CacheIsolationMixin from student.models import ( PendingEmailChange, Registration, UserProfile, - get_retired_email_by_email ) from openedx.core.lib.request_utils import safe_get_host from student.tests.factories import PendingEmailChangeFactory, RegistrationFactory, UserFactory diff --git a/common/djangoapps/student/tests/test_enrollment.py b/common/djangoapps/student/tests/test_enrollment.py index 0574e7e106..aebf47f78f 100644 --- a/common/djangoapps/student/tests/test_enrollment.py +++ b/common/djangoapps/student/tests/test_enrollment.py @@ -13,7 +13,6 @@ from course_modes.tests.factories import CourseModeFactory from openedx.core.djangoapps.embargo.test_utils import restrict_course from student.models import ( CourseEnrollment, - CourseEnrollmentAllowed, CourseFullError, EnrollmentClosedError, SCORE_RECALCULATION_DELAY_ON_ENROLLMENT_UPDATE, diff --git a/common/djangoapps/student/tests/test_events.py b/common/djangoapps/student/tests/test_events.py index ccb1f058d2..7b66b985b4 100644 --- a/common/djangoapps/student/tests/test_events.py +++ b/common/djangoapps/student/tests/test_events.py @@ -7,7 +7,7 @@ from django.db.utils import IntegrityError from django.test import TestCase from django_countries.fields import Country -from student.models import CourseEnrollmentAllowed, PasswordHistory +from student.models import CourseEnrollmentAllowed from student.tests.factories import UserFactory, CourseEnrollmentAllowedFactory from student.tests.tests import UserSettingsEventTestMixin diff --git a/common/djangoapps/util/tests/test_db.py b/common/djangoapps/util/tests/test_db.py index b3c3b2dd13..7a54dd467f 100644 --- a/common/djangoapps/util/tests/test_db.py +++ b/common/djangoapps/util/tests/test_db.py @@ -5,7 +5,6 @@ import time import unittest import ddt -import pytest from django.contrib.auth.models import User from django.core.management import call_command from django.db import IntegrityError, connection diff --git a/common/djangoapps/util/tests/test_password_policy_validators.py b/common/djangoapps/util/tests/test_password_policy_validators.py index 0ce7fe2c96..3ba9dc929d 100644 --- a/common/djangoapps/util/tests/test_password_policy_validators.py +++ b/common/djangoapps/util/tests/test_password_policy_validators.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- """Tests for util.password_policy_validators module.""" -import mock + import unittest from ddt import data, ddt, unpack -from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.test.utils import override_settings diff --git a/common/lib/calc/calc/calc.py b/common/lib/calc/calc/calc.py index 397e1bdc67..03af7d9b1c 100644 --- a/common/lib/calc/calc/calc.py +++ b/common/lib/calc/calc/calc.py @@ -9,7 +9,6 @@ import numbers import operator import numpy -import scipy.constants from pyparsing import ( CaselessLiteral, Combine, diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py index 61100e4d71..f276255822 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py @@ -9,7 +9,6 @@ import random import re import unittest import os -import uuid import ddt from contracts import contract diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py index c8121bc769..15f677469c 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py @@ -1,7 +1,6 @@ import datetime import random import unittest -import uuid import os import mock import pytest diff --git a/common/lib/xmodule/xmodule/modulestore/tests/utils.py b/common/lib/xmodule/xmodule/modulestore/tests/utils.py index d9b964be97..19103f2083 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/utils.py @@ -4,7 +4,6 @@ Helper classes and methods for running modulestore tests without Django. from uuid import uuid4 import io import os -import random from contextlib import contextmanager, nested from importlib import import_module diff --git a/common/lib/xmodule/xmodule/tests/test_import_static.py b/common/lib/xmodule/xmodule/tests/test_import_static.py index 7db84f5c42..723507d996 100644 --- a/common/lib/xmodule/xmodule/tests/test_import_static.py +++ b/common/lib/xmodule/xmodule/tests/test_import_static.py @@ -2,9 +2,8 @@ Tests that check that we ignore the appropriate files when importing courses. """ import unittest -import ddt from mock import Mock -import os + from xmodule.modulestore.xml_importer import StaticContentImporter from opaque_keys.edx.locator import CourseLocator from xmodule.tests import DATA_DIR diff --git a/common/lib/xmodule/xmodule/tests/test_mongo_utils.py b/common/lib/xmodule/xmodule/tests/test_mongo_utils.py index 05b2399b19..2f50f85329 100644 --- a/common/lib/xmodule/xmodule/tests/test_mongo_utils.py +++ b/common/lib/xmodule/xmodule/tests/test_mongo_utils.py @@ -8,8 +8,6 @@ from uuid import uuid4 from pymongo import ReadPreference -from django.conf import settings - from xmodule.mongo_utils import connect_to_mongodb diff --git a/common/lib/xmodule/xmodule/tests/test_vertical.py b/common/lib/xmodule/xmodule/tests/test_vertical.py index c272b95be3..e91bec4ef6 100644 --- a/common/lib/xmodule/xmodule/tests/test_vertical.py +++ b/common/lib/xmodule/xmodule/tests/test_vertical.py @@ -11,7 +11,6 @@ import json import ddt from fs.memoryfs import MemoryFS from mock import Mock, patch -import six from . import get_test_system from .helpers import StubUserService diff --git a/common/lib/xmodule/xmodule/vertical_block.py b/common/lib/xmodule/xmodule/vertical_block.py index 1cc44d69de..ec6d2100fc 100644 --- a/common/lib/xmodule/xmodule/vertical_block.py +++ b/common/lib/xmodule/xmodule/vertical_block.py @@ -20,8 +20,6 @@ from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.x_module import STUDENT_VIEW, XModuleFields from xmodule.xml_module import XmlParserMixin -import webpack_loader.utils - log = logging.getLogger(__name__) # HACK: This shouldn't be hard-coded to two types diff --git a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py index f734b474a1..bd1dee52c4 100644 --- a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py +++ b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py @@ -12,11 +12,9 @@ import logging from pysrt import SubRipTime, SubRipItem, SubRipFile from pysrt.srtexc import Error from lxml import etree -from opaque_keys.edx.locator import BlockUsageLocator from HTMLParser import HTMLParser from six import text_type -from xmodule.modulestore.django import modulestore from xmodule.exceptions import NotFoundError from xmodule.contentstore.content import StaticContent from xmodule.contentstore.django import contentstore diff --git a/common/lib/xmodule/xmodule/video_module/video_handlers.py b/common/lib/xmodule/xmodule/video_module/video_handlers.py index dca0a5d105..837f8625bc 100644 --- a/common/lib/xmodule/xmodule/video_module/video_handlers.py +++ b/common/lib/xmodule/xmodule/video_module/video_handlers.py @@ -25,7 +25,6 @@ from .transcripts_utils import ( clean_video_id, get_or_create_sjson, generate_sjson_for_all_speeds, - save_to_store, subs_filename, Transcript, TranscriptException,