From 3353e7425e57b8a308318f2feac35c5b0b5dbdaf Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 3 Nov 2018 10:25:30 -0400 Subject: [PATCH] Remove unused imports --- .../features/advanced_settings.py | 2 +- cms/djangoapps/contentstore/views/preview.py | 1 - .../views/tests/test_course_index.py | 2 -- .../contentstore/views/transcript_settings.py | 1 - .../contentstore/views/transcripts_ajax.py | 4 ---- cms/djangoapps/xblock_config/forms.py | 3 --- .../third_party_auth/tests/test_decorators.py | 5 +--- common/test/acceptance/tests/lms/test_lms.py | 1 - .../tests/lms/test_lms_courseware.py | 2 +- .../tests/lms/test_lms_entrance_exams.py | 2 -- .../tests/studio/test_studio_home.py | 5 ---- lms/djangoapps/bulk_email/forms.py | 4 ---- .../certificates/apis/v0/tests/test_views.py | 2 -- .../tests/test_user_state_client.py | 2 -- .../courseware/tests/test_video_mongo.py | 2 +- lms/djangoapps/discussion/tasks.py | 1 - lms/djangoapps/discussion_api/views.py | 1 - lms/djangoapps/gating/api.py | 1 - lms/djangoapps/grades/config/forms.py | 4 ---- .../learner_dashboard/tests/test_programs.py | 1 - .../mobile_api/video_outlines/views.py | 8 +------ lms/djangoapps/notification_prefs/tests.py | 2 +- lms/djangoapps/staticbook/views.py | 1 - lms/djangoapps/support/tests/test_views.py | 2 +- .../support/views/course_entitlements.py | 2 +- lms/djangoapps/support/views/manage_user.py | 1 - lms/djangoapps/support/views/refund.py | 2 -- lms/djangoapps/verify_student/models.py | 3 --- lms/djangoapps/verify_student/utils.py | 5 ---- .../djangoapps/auth_exchange/tests/mixins.py | 2 +- .../core/djangoapps/auth_exchange/views.py | 2 -- .../djangoapps/catalog/tests/test_utils.py | 3 +-- openedx/core/djangoapps/catalog/utils.py | 1 - .../djangoapps/cors_csrf/authentication.py | 1 - .../core/djangoapps/course_groups/cohorts.py | 2 +- openedx/core/djangoapps/credentials/utils.py | 1 - .../core/djangoapps/external_auth/views.py | 2 -- .../lang_pref/tests/test_middleware.py | 1 - openedx/core/djangoapps/oauth_dispatch/api.py | 1 - .../oauth_dispatch/tests/test_views.py | 2 +- .../djangoapps/programs/tests/test_utils.py | 5 +--- .../djangoapps/theming/template_loaders.py | 2 -- .../user_api/accounts/tests/test_utils.py | 1 - .../user_api/accounts/tests/test_views.py | 23 ++----------------- .../djangoapps/user_api/accounts/utils.py | 1 - openedx/core/djangoapps/user_api/api.py | 1 - .../commands/migrate_user_profile_langs.py | 1 - openedx/core/djangoapps/user_api/models.py | 2 +- .../djangoapps/user_api/tests/test_views.py | 1 - openedx/core/djangoapps/video_config/forms.py | 3 --- .../core/djangoapps/video_pipeline/utils.py | 1 - openedx/core/lib/api/authentication.py | 1 - openedx/core/lib/logsettings.py | 1 - .../tests/views/test_course_outline.py | 1 - .../course_experience/views/course_home.py | 2 +- .../views/welcome_message.py | 4 ++-- openedx/features/learner_analytics/tests.py | 2 -- openedx/features/learner_analytics/views.py | 1 - .../tests/views/test_learner_profile.py | 1 - pavelib/paver_tests/test_paver_quality.py | 2 -- pavelib/paver_tests/utils.py | 1 - 61 files changed, 19 insertions(+), 128 deletions(-) diff --git a/cms/djangoapps/contentstore/features/advanced_settings.py b/cms/djangoapps/contentstore/features/advanced_settings.py index 48b7787799..63d63d3761 100644 --- a/cms/djangoapps/contentstore/features/advanced_settings.py +++ b/cms/djangoapps/contentstore/features/advanced_settings.py @@ -1,7 +1,7 @@ # pylint: disable=missing-docstring # pylint: disable=redefined-outer-name -from lettuce import step, world +from lettuce import world from cms.djangoapps.contentstore.features.common import press_the_notification_button, type_in_codemirror KEY_CSS = '.key h3.title' diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py index 17b8dcf398..9094546a61 100644 --- a/cms/djangoapps/contentstore/views/preview.py +++ b/cms/djangoapps/contentstore/views/preview.py @@ -42,7 +42,6 @@ from xmodule.services import SettingsService from xmodule.studio_editable import has_author_view from xmodule.util.xmodule_django import add_webpack_to_fragment from xmodule.x_module import AUTHOR_VIEW, PREVIEW_VIEWS, STUDENT_VIEW, ModuleSystem, XModule, XModuleDescriptor -import webpack_loader.utils from .helpers import render_from_lms from .session_kv_store import SessionKeyValueStore diff --git a/cms/djangoapps/contentstore/views/tests/test_course_index.py b/cms/djangoapps/contentstore/views/tests/test_course_index.py index 72b137db8a..c264a3811d 100644 --- a/cms/djangoapps/contentstore/views/tests/test_course_index.py +++ b/cms/djangoapps/contentstore/views/tests/test_course_index.py @@ -33,8 +33,6 @@ from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace from student.auth import has_course_author_access from student.roles import CourseStaffRole, GlobalStaff, LibraryUserRole from student.tests.factories import UserFactory -from util.date_utils import get_default_time_display -from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, LibraryFactory, check_mongo_calls diff --git a/cms/djangoapps/contentstore/views/transcript_settings.py b/cms/djangoapps/contentstore/views/transcript_settings.py index e53c81eac1..3e87f4c082 100644 --- a/cms/djangoapps/contentstore/views/transcript_settings.py +++ b/cms/djangoapps/contentstore/views/transcript_settings.py @@ -2,7 +2,6 @@ Views related to the transcript preferences feature """ import os -import json import logging from django.contrib.auth.decorators import login_required diff --git a/cms/djangoapps/contentstore/views/transcripts_ajax.py b/cms/djangoapps/contentstore/views/transcripts_ajax.py index 99c8b80e38..cd16093caf 100644 --- a/cms/djangoapps/contentstore/views/transcripts_ajax.py +++ b/cms/djangoapps/contentstore/views/transcripts_ajax.py @@ -30,14 +30,10 @@ from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.video_module.transcripts_utils import ( clean_video_id, - copy_or_rename_transcript, download_youtube_subs, GetTranscriptsFromYouTubeException, - get_video_transcript_content, - generate_subs_from_source, get_transcript_for_video, get_transcripts_from_youtube, - remove_subs_from_store, Transcript, TranscriptsRequestValidationException, TranscriptsGenerationException, diff --git a/cms/djangoapps/xblock_config/forms.py b/cms/djangoapps/xblock_config/forms.py index 70d91623f9..33773d7a5b 100644 --- a/cms/djangoapps/xblock_config/forms.py +++ b/cms/djangoapps/xblock_config/forms.py @@ -4,12 +4,9 @@ Defines a form for providing validation of LTI consumer course-specific configur import logging from django import forms -from opaque_keys import InvalidKeyError -from opaque_keys.edx.locator import CourseLocator from openedx.core.lib.courses import clean_course_id from xblock_config.models import CourseEditLTIFieldsEnabledFlag -from xmodule.modulestore.django import modulestore log = logging.getLogger(__name__) diff --git a/common/djangoapps/third_party_auth/tests/test_decorators.py b/common/djangoapps/third_party_auth/tests/test_decorators.py index 0bc1b8bd60..c069ac412d 100644 --- a/common/djangoapps/third_party_auth/tests/test_decorators.py +++ b/common/djangoapps/third_party_auth/tests/test_decorators.py @@ -1,16 +1,13 @@ """ Tests for third_party_auth decorators. """ -import json import unittest import ddt from django.conf import settings -from django.http import HttpResponse, JsonResponse +from django.http import HttpResponse from django.test import RequestFactory -from mock import MagicMock -from six.moves.urllib.parse import urlencode from third_party_auth.decorators import xframe_allow_whitelisted from third_party_auth.tests.testutil import TestCase diff --git a/common/test/acceptance/tests/lms/test_lms.py b/common/test/acceptance/tests/lms/test_lms.py index 9f0b3b52bb..d2423293ff 100644 --- a/common/test/acceptance/tests/lms/test_lms.py +++ b/common/test/acceptance/tests/lms/test_lms.py @@ -2,7 +2,6 @@ """ End-to-end tests for the LMS. """ -import urllib from datetime import datetime, timedelta from textwrap import dedent diff --git a/common/test/acceptance/tests/lms/test_lms_courseware.py b/common/test/acceptance/tests/lms/test_lms_courseware.py index f25f87d5d9..79a66f52e4 100644 --- a/common/test/acceptance/tests/lms/test_lms_courseware.py +++ b/common/test/acceptance/tests/lms/test_lms_courseware.py @@ -14,7 +14,7 @@ from ...fixtures.course import CourseFixture, XBlockFixtureDesc from ...pages.common.auto_auth import AutoAuthPage from ...pages.common.logout import LogoutPage from ...pages.lms.course_home import CourseHomePage -from ...pages.lms.courseware import CoursewarePage, CoursewareSequentialTabPage, RenderXBlockPage +from ...pages.lms.courseware import CoursewarePage, CoursewareSequentialTabPage from ...pages.lms.create_mode import ModeCreationPage from ...pages.lms.dashboard import DashboardPage from ...pages.lms.pay_and_verify import FakePaymentPage, FakeSoftwareSecureVerificationPage, PaymentAndVerificationFlow diff --git a/common/test/acceptance/tests/lms/test_lms_entrance_exams.py b/common/test/acceptance/tests/lms/test_lms_entrance_exams.py index d67e19a9ea..24ff7ae24e 100644 --- a/common/test/acceptance/tests/lms/test_lms_entrance_exams.py +++ b/common/test/acceptance/tests/lms/test_lms_entrance_exams.py @@ -6,9 +6,7 @@ from textwrap import dedent from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc from common.test.acceptance.pages.common.auto_auth import AutoAuthPage -from common.test.acceptance.pages.lms.course_home import CourseHomePage from common.test.acceptance.pages.lms.courseware import CoursewarePage -from common.test.acceptance.pages.lms.problem import ProblemPage from common.test.acceptance.tests.helpers import UniqueCourseTest diff --git a/common/test/acceptance/tests/studio/test_studio_home.py b/common/test/acceptance/tests/studio/test_studio_home.py index 721fc23e50..342f5338ac 100644 --- a/common/test/acceptance/tests/studio/test_studio_home.py +++ b/common/test/acceptance/tests/studio/test_studio_home.py @@ -2,16 +2,11 @@ Acceptance tests for Home Page (My Courses / My Libraries). """ import datetime -from uuid import uuid4 - -from opaque_keys.edx.locator import LibraryLocator from base_studio_test import StudioCourseTest from common.test.acceptance.pages.common.auto_auth import AutoAuthPage from common.test.acceptance.pages.lms.account_settings import AccountSettingsPage from common.test.acceptance.pages.studio.index import DashboardPage -from common.test.acceptance.pages.studio.library import LibraryEditPage -from common.test.acceptance.pages.studio.overview import CourseOutlinePage from common.test.acceptance.tests.helpers import AcceptanceTest, get_selected_option_text, select_option_by_text diff --git a/lms/djangoapps/bulk_email/forms.py b/lms/djangoapps/bulk_email/forms.py index 17427c6a7a..179cecbf1c 100644 --- a/lms/djangoapps/bulk_email/forms.py +++ b/lms/djangoapps/bulk_email/forms.py @@ -5,13 +5,9 @@ import logging from django import forms from django.core.exceptions import ValidationError -from opaque_keys import InvalidKeyError -from opaque_keys.edx.keys import CourseKey -from six import text_type from bulk_email.models import COURSE_EMAIL_MESSAGE_BODY_TAG, CourseAuthorization, CourseEmailTemplate from openedx.core.lib.courses import clean_course_id -from xmodule.modulestore.django import modulestore log = logging.getLogger(__name__) diff --git a/lms/djangoapps/certificates/apis/v0/tests/test_views.py b/lms/djangoapps/certificates/apis/v0/tests/test_views.py index be35679485..bbc190f55e 100644 --- a/lms/djangoapps/certificates/apis/v0/tests/test_views.py +++ b/lms/djangoapps/certificates/apis/v0/tests/test_views.py @@ -2,7 +2,6 @@ Tests for the Certificate REST APIs. """ # pylint: disable=missing-docstring -from itertools import product import ddt from django.urls import reverse @@ -15,7 +14,6 @@ from course_modes.models import CourseMode from lms.djangoapps.certificates.apis.v0.views import CertificatesDetailView from lms.djangoapps.certificates.models import CertificateStatuses from lms.djangoapps.certificates.tests.factories import GeneratedCertificateFactory -from openedx.core.djangoapps.oauth_dispatch.toggles import ENFORCE_JWT_SCOPES from openedx.core.djangoapps.user_authn.tests.utils import AuthType, AuthAndScopesTestMixin from student.tests.factories import UserFactory from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase diff --git a/lms/djangoapps/courseware/tests/test_user_state_client.py b/lms/djangoapps/courseware/tests/test_user_state_client.py index 7bcae8bd86..3b26dda171 100644 --- a/lms/djangoapps/courseware/tests/test_user_state_client.py +++ b/lms/djangoapps/courseware/tests/test_user_state_client.py @@ -4,9 +4,7 @@ defined in edx_user_state_client. """ from collections import defaultdict -from unittest import skip -from django.test import TestCase from edx_user_state_client.tests import UserStateClientTestBase from courseware.tests.factories import UserFactory diff --git a/lms/djangoapps/courseware/tests/test_video_mongo.py b/lms/djangoapps/courseware/tests/test_video_mongo.py index 346adb26bf..9dd142d0f6 100644 --- a/lms/djangoapps/courseware/tests/test_video_mongo.py +++ b/lms/djangoapps/courseware/tests/test_video_mongo.py @@ -45,7 +45,7 @@ from xmodule.modulestore.inheritance import own_metadata from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_MODULESTORE, TEST_DATA_SPLIT_MODULESTORE from xmodule.tests.test_import import DummySystem from xmodule.tests.test_video import VideoDescriptorTestBase, instantiate_descriptor -from xmodule.video_module import VideoDescriptor, bumper_utils, rewrite_video_url, video_utils +from xmodule.video_module import VideoDescriptor, bumper_utils, video_utils from xmodule.video_module.transcripts_utils import Transcript, save_to_store, subs_filename from xmodule.video_module.video_module import ( EXPORT_IMPORT_COURSE_DIR, diff --git a/lms/djangoapps/discussion/tasks.py b/lms/djangoapps/discussion/tasks.py index d28bd3fcaf..19a94732e1 100644 --- a/lms/djangoapps/discussion/tasks.py +++ b/lms/djangoapps/discussion/tasks.py @@ -12,7 +12,6 @@ from django.contrib.auth.models import User from django.contrib.sites.models import Site from celery_utils.logged_task import LoggedTask -from django_comment_common.utils import set_course_discussion_settings from django_comment_common.models import DiscussionsIdMapping from edx_ace import ace from edx_ace.utils import date diff --git a/lms/djangoapps/discussion_api/views.py b/lms/djangoapps/discussion_api/views.py index bb7efee54d..a17952ea56 100644 --- a/lms/djangoapps/discussion_api/views.py +++ b/lms/djangoapps/discussion_api/views.py @@ -2,7 +2,6 @@ Discussion API views """ from django.core.exceptions import ValidationError -from django.contrib.auth import get_user_model from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication from opaque_keys.edx.keys import CourseKey from rest_framework import permissions diff --git a/lms/djangoapps/gating/api.py b/lms/djangoapps/gating/api.py index 5155310a06..9b490db6d2 100644 --- a/lms/djangoapps/gating/api.py +++ b/lms/djangoapps/gating/api.py @@ -1,7 +1,6 @@ """ API for the gating djangoapp """ -import json import logging from collections import defaultdict diff --git a/lms/djangoapps/grades/config/forms.py b/lms/djangoapps/grades/config/forms.py index 31457ea97c..0ac317d866 100644 --- a/lms/djangoapps/grades/config/forms.py +++ b/lms/djangoapps/grades/config/forms.py @@ -4,13 +4,9 @@ Defines a form for providing validation of subsection grade templates. import logging from django import forms -from opaque_keys import InvalidKeyError -from opaque_keys.edx.locator import CourseLocator -from six import text_type from lms.djangoapps.grades.config.models import CoursePersistentGradesFlag from openedx.core.lib.courses import clean_course_id -from xmodule.modulestore.django import modulestore log = logging.getLogger(__name__) diff --git a/lms/djangoapps/learner_dashboard/tests/test_programs.py b/lms/djangoapps/learner_dashboard/tests/test_programs.py index a888db14eb..634b5cbaeb 100644 --- a/lms/djangoapps/learner_dashboard/tests/test_programs.py +++ b/lms/djangoapps/learner_dashboard/tests/test_programs.py @@ -23,7 +23,6 @@ from openedx.core.djangoapps.catalog.tests.factories import ( ) from openedx.core.djangoapps.catalog.tests.mixins import CatalogIntegrationMixin from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin -from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag from openedx.core.djangolib.testing.utils import skip_unless_lms from student.tests.factories import CourseEnrollmentFactory, UserFactory from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase diff --git a/lms/djangoapps/mobile_api/video_outlines/views.py b/lms/djangoapps/mobile_api/video_outlines/views.py index 47cc04938c..1d015925f1 100644 --- a/lms/djangoapps/mobile_api/video_outlines/views.py +++ b/lms/djangoapps/mobile_api/video_outlines/views.py @@ -6,7 +6,6 @@ only displayed at the course level. This is because it makes it a lot easier to optimize and reason about, and it avoids having to tackle the bigger problem of general XBlock representation in this rather specialized formatting. """ -import os from functools import partial from django.http import Http404, HttpResponse @@ -17,12 +16,7 @@ from rest_framework.response import Response from mobile_api.models import MobileApiConfig from xmodule.exceptions import NotFoundError from xmodule.modulestore.django import modulestore -from xmodule.video_module.transcripts_utils import ( - convert_video_transcript, - get_video_transcript_content, - Transcript, - get_transcript, -) +from xmodule.video_module.transcripts_utils import get_transcript from ..decorators import mobile_course_access, mobile_view from .serializers import BlockOutline, video_summary diff --git a/lms/djangoapps/notification_prefs/tests.py b/lms/djangoapps/notification_prefs/tests.py index 85bc646876..54b50d4476 100644 --- a/lms/djangoapps/notification_prefs/tests.py +++ b/lms/djangoapps/notification_prefs/tests.py @@ -7,7 +7,7 @@ from django.http import Http404 from django.test import TestCase from django.test.client import RequestFactory from django.test.utils import override_settings -from mock import Mock, patch +from mock import patch from notification_prefs import NOTIFICATION_PREF_KEY from notification_prefs.views import UsernameCipher, ajax_disable, ajax_enable, ajax_status, set_subscription diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 9ada2322ca..0ffa909563 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -11,7 +11,6 @@ from courseware.access import has_access from courseware.courses import get_course_with_access from edxmako.shortcuts import render_to_response from static_replace import replace_static_urls -from xmodule.annotator_token import retrieve_token @login_required diff --git a/lms/djangoapps/support/tests/test_views.py b/lms/djangoapps/support/tests/test_views.py index 271e83876a..853538c40a 100644 --- a/lms/djangoapps/support/tests/test_views.py +++ b/lms/djangoapps/support/tests/test_views.py @@ -20,7 +20,7 @@ from course_modes.tests.factories import CourseModeFactory from lms.djangoapps.verify_student.models import VerificationDeadline from student.models import ENROLLED_TO_ENROLLED, CourseEnrollment, ManualEnrollmentAudit from student.roles import GlobalStaff, SupportStaffRole -from student.tests.factories import TEST_PASSWORD, CourseEnrollmentFactory, UserFactory +from student.tests.factories import CourseEnrollmentFactory, UserFactory from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/support/views/course_entitlements.py b/lms/djangoapps/support/views/course_entitlements.py index 08fee20109..f6186bcc75 100644 --- a/lms/djangoapps/support/views/course_entitlements.py +++ b/lms/djangoapps/support/views/course_entitlements.py @@ -5,7 +5,7 @@ from django.utils.decorators import method_decorator from django.views.generic import View from edxmako.shortcuts import render_to_response -from entitlements.models import CourseEntitlement, CourseEntitlementSupportDetail +from entitlements.models import CourseEntitlementSupportDetail from lms.djangoapps.commerce.utils import EcommerceService from lms.djangoapps.support.decorators import require_support_permission diff --git a/lms/djangoapps/support/views/manage_user.py b/lms/djangoapps/support/views/manage_user.py index 9b64d69d58..f5ca57a480 100644 --- a/lms/djangoapps/support/views/manage_user.py +++ b/lms/djangoapps/support/views/manage_user.py @@ -8,7 +8,6 @@ from django.utils.decorators import method_decorator from django.utils.translation import ugettext as _ from django.views.generic import View from rest_framework.generics import GenericAPIView -from rest_framework.response import Response from edxmako.shortcuts import render_to_response from lms.djangoapps.support.decorators import require_support_permission diff --git a/lms/djangoapps/support/views/refund.py b/lms/djangoapps/support/views/refund.py index e88a851608..1c13e0cd31 100644 --- a/lms/djangoapps/support/views/refund.py +++ b/lms/djangoapps/support/views/refund.py @@ -19,8 +19,6 @@ from django.http import HttpResponseRedirect from django.utils.decorators import method_decorator from django.utils.translation import ugettext as _ from django.views.generic.edit import FormView -from opaque_keys import InvalidKeyError -from opaque_keys.edx.keys import CourseKey from openedx.core.lib.courses import clean_course_id from student.models import CourseEnrollment diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py index d21617493b..08c9d3a8ad 100644 --- a/lms/djangoapps/verify_student/models.py +++ b/lms/djangoapps/verify_student/models.py @@ -21,8 +21,6 @@ import requests import six from django.conf import settings from django.contrib.auth.models import User -from django.contrib.contenttypes.fields import GenericForeignKey -from django.contrib.contenttypes.models import ContentType from django.core.cache import cache from django.core.files.base import ContentFile from django.urls import reverse @@ -33,7 +31,6 @@ from django.utils.translation import ugettext_lazy from model_utils import Choices from model_utils.models import StatusModel, TimeStampedModel from opaque_keys.edx.django.models import CourseKeyField -from openedx.core.djangolib.model_mixins import DeletableByUserValue from lms.djangoapps.verify_student.ssencrypt import ( encrypt_and_encode, diff --git a/lms/djangoapps/verify_student/utils.py b/lms/djangoapps/verify_student/utils.py index 196828cb91..1b32a16868 100644 --- a/lms/djangoapps/verify_student/utils.py +++ b/lms/djangoapps/verify_student/utils.py @@ -8,11 +8,6 @@ import logging import pytz from django.conf import settings -from django.core.mail import send_mail -from django.utils.translation import ugettext as _ - -from edxmako.shortcuts import render_to_string -from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from sailthru import SailthruClient log = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/auth_exchange/tests/mixins.py b/openedx/core/djangoapps/auth_exchange/tests/mixins.py index 671c542517..6ddd305380 100644 --- a/openedx/core/djangoapps/auth_exchange/tests/mixins.py +++ b/openedx/core/djangoapps/auth_exchange/tests/mixins.py @@ -3,7 +3,7 @@ Mixins to facilitate testing OAuth connections to Django-OAuth-Toolkit or Django-OAuth2-Provider. """ -from unittest import skip, expectedFailure +from unittest import expectedFailure from django.test.client import RequestFactory from openedx.core.djangoapps.oauth_dispatch import adapters diff --git a/openedx/core/djangoapps/auth_exchange/views.py b/openedx/core/djangoapps/auth_exchange/views.py index 0fd37122e7..4f6b9f1ad2 100644 --- a/openedx/core/djangoapps/auth_exchange/views.py +++ b/openedx/core/djangoapps/auth_exchange/views.py @@ -17,9 +17,7 @@ from django.http import HttpResponse from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt from oauth2_provider import models as dot_models -from oauth2_provider.settings import oauth2_settings from oauth2_provider.views.base import TokenView as DOTAccessTokenView -from oauthlib.oauth2.rfc6749.tokens import BearerToken from provider import constants from provider import scope as dop_scope from provider.oauth2.views import AccessTokenView as DOPAccessTokenView diff --git a/openedx/core/djangoapps/catalog/tests/test_utils.py b/openedx/core/djangoapps/catalog/tests/test_utils.py index a0a5bdaed1..5b809694e4 100644 --- a/openedx/core/djangoapps/catalog/tests/test_utils.py +++ b/openedx/core/djangoapps/catalog/tests/test_utils.py @@ -1,9 +1,8 @@ """Tests covering utilities for integrating with the catalog service.""" # pylint: disable=missing-docstring -import copy + from datetime import timedelta -import ddt import mock from django.contrib.auth import get_user_model from django.core.cache import cache diff --git a/openedx/core/djangoapps/catalog/utils.py b/openedx/core/djangoapps/catalog/utils.py index f4530a38ca..164e3034c2 100644 --- a/openedx/core/djangoapps/catalog/utils.py +++ b/openedx/core/djangoapps/catalog/utils.py @@ -5,7 +5,6 @@ import logging import uuid import pycountry -from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist from edx_rest_api_client.client import EdxRestApiClient diff --git a/openedx/core/djangoapps/cors_csrf/authentication.py b/openedx/core/djangoapps/cors_csrf/authentication.py index f4f2471932..7640c248be 100644 --- a/openedx/core/djangoapps/cors_csrf/authentication.py +++ b/openedx/core/djangoapps/cors_csrf/authentication.py @@ -1,7 +1,6 @@ """ Django Rest Framework Authentication classes for cross-domain end-points. """ -import django from django.middleware.csrf import CsrfViewMiddleware from rest_framework import authentication diff --git a/openedx/core/djangoapps/course_groups/cohorts.py b/openedx/core/djangoapps/course_groups/cohorts.py index 876031c2b2..3788f6b6af 100644 --- a/openedx/core/djangoapps/course_groups/cohorts.py +++ b/openedx/core/djangoapps/course_groups/cohorts.py @@ -10,7 +10,7 @@ from courseware import courses from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.core.validators import validate_email -from django.db import IntegrityError, transaction +from django.db import IntegrityError from django.db.models.signals import m2m_changed, post_save from django.dispatch import receiver from django.http import Http404 diff --git a/openedx/core/djangoapps/credentials/utils.py b/openedx/core/djangoapps/credentials/utils.py index 98dfbec430..0462b12ca1 100644 --- a/openedx/core/djangoapps/credentials/utils.py +++ b/openedx/core/djangoapps/credentials/utils.py @@ -1,7 +1,6 @@ """Helper functions for working with Credentials.""" from __future__ import unicode_literals -from django.conf import settings from edx_rest_api_client.client import EdxRestApiClient from openedx.core.djangoapps.credentials.models import CredentialsApiConfig diff --git a/openedx/core/djangoapps/external_auth/views.py b/openedx/core/djangoapps/external_auth/views.py index 0d01a07d8b..3f147f207e 100644 --- a/openedx/core/djangoapps/external_auth/views.py +++ b/openedx/core/djangoapps/external_auth/views.py @@ -5,9 +5,7 @@ import fnmatch import functools import json import logging -import random import re -import string import unicodedata import urllib from textwrap import dedent diff --git a/openedx/core/djangoapps/lang_pref/tests/test_middleware.py b/openedx/core/djangoapps/lang_pref/tests/test_middleware.py index d668fdee82..15f80b706d 100644 --- a/openedx/core/djangoapps/lang_pref/tests/test_middleware.py +++ b/openedx/core/djangoapps/lang_pref/tests/test_middleware.py @@ -7,7 +7,6 @@ import mock import ddt from django.conf import settings -from django.test import TestCase from django.urls import reverse from django.test.client import RequestFactory from django.http import HttpResponse diff --git a/openedx/core/djangoapps/oauth_dispatch/api.py b/openedx/core/djangoapps/oauth_dispatch/api.py index 786c066486..edde0bd407 100644 --- a/openedx/core/djangoapps/oauth_dispatch/api.py +++ b/openedx/core/djangoapps/oauth_dispatch/api.py @@ -1,6 +1,5 @@ """ OAuth related Python apis. """ import json -from django.conf import settings from oauthlib.oauth2.rfc6749.errors import OAuth2Error from oauthlib.oauth2.rfc6749.tokens import BearerToken diff --git a/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py b/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py index 3305cc67a8..aae611079c 100644 --- a/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py +++ b/openedx/core/djangoapps/oauth_dispatch/tests/test_views.py @@ -9,7 +9,7 @@ import ddt import httpretty from django.conf import settings from django.urls import reverse -from django.test import RequestFactory, TestCase, override_settings +from django.test import RequestFactory, TestCase from mock import call, patch from Cryptodome.PublicKey import RSA diff --git a/openedx/core/djangoapps/programs/tests/test_utils.py b/openedx/core/djangoapps/programs/tests/test_utils.py index b1e591ee49..4a95e1e99f 100644 --- a/openedx/core/djangoapps/programs/tests/test_utils.py +++ b/openedx/core/djangoapps/programs/tests/test_utils.py @@ -30,10 +30,7 @@ from openedx.core.djangoapps.catalog.tests.factories import ( SeatFactory, generate_course_run_key ) -from openedx.core.djangoapps.programs import ( - PROGRAMS_WAFFLE_SWITCH_NAMESPACE, - ALWAYS_CALCULATE_PROGRAM_PRICE_AS_ANONYMOUS_USER -) +from openedx.core.djangoapps.programs import ALWAYS_CALCULATE_PROGRAM_PRICE_AS_ANONYMOUS_USER from openedx.core.djangoapps.programs.tests.factories import ProgressFactory from openedx.core.djangoapps.programs.utils import ( DEFAULT_ENROLLMENT_START_DATE, diff --git a/openedx/core/djangoapps/theming/template_loaders.py b/openedx/core/djangoapps/theming/template_loaders.py index 467605f2d1..a989b2f71c 100644 --- a/openedx/core/djangoapps/theming/template_loaders.py +++ b/openedx/core/djangoapps/theming/template_loaders.py @@ -1,9 +1,7 @@ """ Theming aware template loaders. """ -from django.core.exceptions import SuspiciousFileOperation from django.template.loaders.filesystem import Loader as FilesystemLoader -from django.utils._os import safe_join from edxmako.makoloader import MakoLoader from openedx.core.djangoapps.theming.helpers import get_all_theme_template_dirs, get_current_request, get_current_theme diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_utils.py b/openedx/core/djangoapps/user_api/accounts/tests/test_utils.py index a938c8bf46..6c2e66c047 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_utils.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_utils.py @@ -5,7 +5,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera import ddt from django.test import TestCase from django.test.utils import override_settings -from mock import patch from completion import models from completion.test_utils import CompletionWaffleTestMixin diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py index 7672aea82a..d4d480ac7d 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py @@ -21,27 +21,8 @@ from openedx.core.djangoapps.user_api.accounts import ACCOUNT_VISIBILITY_PREF_KE from openedx.core.djangoapps.user_api.models import UserPreference from openedx.core.djangoapps.user_api.preferences.api import set_user_preference from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms -from student.models import ( - CourseEnrollment, - CourseEnrollmentAllowed, - ManualEnrollmentAudit, - PasswordHistory, - PendingEmailChange, - PendingNameChange, - Registration, - SocialLink, - UserProfile, - get_retired_username_by_username, -) -from student.tests.factories import ( - TEST_PASSWORD, - ContentTypeFactory, - CourseEnrollmentAllowedFactory, - PendingEmailChangeFactory, - PermissionFactory, - SuperuserFactory, - UserFactory -) +from student.models import PendingEmailChange, UserProfile +from student.tests.factories import TEST_PASSWORD, UserFactory from .. import ALL_USERS_VISIBILITY, PRIVATE_VISIBILITY diff --git a/openedx/core/djangoapps/user_api/accounts/utils.py b/openedx/core/djangoapps/user_api/accounts/utils.py index 460f768fe2..1d25a23caa 100644 --- a/openedx/core/djangoapps/user_api/accounts/utils.py +++ b/openedx/core/djangoapps/user_api/accounts/utils.py @@ -9,7 +9,6 @@ import string from urlparse import urlparse from django.conf import settings -from django.contrib.auth.models import User from django.utils.translation import ugettext as _ from six import text_type diff --git a/openedx/core/djangoapps/user_api/api.py b/openedx/core/djangoapps/user_api/api.py index dd7c6d8194..eb3be3cf50 100644 --- a/openedx/core/djangoapps/user_api/api.py +++ b/openedx/core/djangoapps/user_api/api.py @@ -13,7 +13,6 @@ from edxmako.shortcuts import marketing_link from openedx.core.djangolib.markup import HTML, Text from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.user_api.helpers import FormDescription -from openedx.core.lib.mobile_utils import is_request_from_mobile_app from openedx.features.enterprise_support.api import enterprise_customer_for_request from student.forms import get_registration_extension_form from student.models import UserProfile diff --git a/openedx/core/djangoapps/user_api/management/commands/migrate_user_profile_langs.py b/openedx/core/djangoapps/user_api/management/commands/migrate_user_profile_langs.py index c8a064d351..e544ec0199 100644 --- a/openedx/core/djangoapps/user_api/management/commands/migrate_user_profile_langs.py +++ b/openedx/core/djangoapps/user_api/management/commands/migrate_user_profile_langs.py @@ -8,7 +8,6 @@ from time import sleep from django.conf import settings from django.core.management.base import BaseCommand, CommandError -from django.db import transaction from django.db.models import Q, Max from openedx.core.djangoapps.dark_lang.models import DarkLangConfig diff --git a/openedx/core/djangoapps/user_api/models.py b/openedx/core/djangoapps/user_api/models.py index 882a3ef508..ab59dc3af0 100644 --- a/openedx/core/djangoapps/user_api/models.py +++ b/openedx/core/djangoapps/user_api/models.py @@ -4,7 +4,7 @@ Django ORM model specifications for the User API application from django.contrib.auth.models import User from django.core.validators import RegexValidator from django.db import models -from django.db.models.signals import post_delete, post_save, pre_delete, pre_save +from django.db.models.signals import post_delete, post_save, pre_save from django.dispatch import receiver from model_utils.models import TimeStampedModel from opaque_keys.edx.django.models import CourseKeyField diff --git a/openedx/core/djangoapps/user_api/tests/test_views.py b/openedx/core/djangoapps/user_api/tests/test_views.py index c389a3486c..13c80aeeb2 100644 --- a/openedx/core/djangoapps/user_api/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/tests/test_views.py @@ -20,7 +20,6 @@ from six import text_type from social_django.models import UserSocialAuth, Partial from django_comment_common import models -from openedx.core.djangoapps.user_api.models import UserRetirementStatus from openedx.core.djangoapps.site_configuration.helpers import get_value from openedx.core.lib.api.test_utils import ApiTestCase, TEST_API_KEY from openedx.core.lib.time_zone_utils import get_display_time_zone diff --git a/openedx/core/djangoapps/video_config/forms.py b/openedx/core/djangoapps/video_config/forms.py index e5b13d2f84..843f9e653d 100644 --- a/openedx/core/djangoapps/video_config/forms.py +++ b/openedx/core/djangoapps/video_config/forms.py @@ -4,15 +4,12 @@ Defines a form for providing validation of HLS Playback course-specific configur import logging from django import forms -from opaque_keys import InvalidKeyError -from opaque_keys.edx.locator import CourseLocator from openedx.core.djangoapps.video_config.models import ( CourseHLSPlaybackEnabledFlag, CourseVideoTranscriptEnabledFlag, ) from openedx.core.lib.courses import clean_course_id -from xmodule.modulestore.django import modulestore log = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/video_pipeline/utils.py b/openedx/core/djangoapps/video_pipeline/utils.py index 85b1e10e30..fb40d8095a 100644 --- a/openedx/core/djangoapps/video_pipeline/utils.py +++ b/openedx/core/djangoapps/video_pipeline/utils.py @@ -1,7 +1,6 @@ """ Utils for video_pipeline app. """ -from django.conf import settings from edx_rest_api_client.client import EdxRestApiClient from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user diff --git a/openedx/core/lib/api/authentication.py b/openedx/core/lib/api/authentication.py index ee94115a21..a22aced6d7 100644 --- a/openedx/core/lib/api/authentication.py +++ b/openedx/core/lib/api/authentication.py @@ -6,7 +6,6 @@ import django.utils.timezone from oauth2_provider import models as dot_models from provider.oauth2 import models as dop_models from rest_framework.exceptions import AuthenticationFailed -from rest_framework.authentication import SessionAuthentication from rest_framework_oauth.authentication import OAuth2Authentication diff --git a/openedx/core/lib/logsettings.py b/openedx/core/lib/logsettings.py index 1f1f4c65dc..d925ad5b89 100644 --- a/openedx/core/lib/logsettings.py +++ b/openedx/core/lib/logsettings.py @@ -1,7 +1,6 @@ """Get log settings.""" import logging -import os import platform import sys import warnings diff --git a/openedx/features/course_experience/tests/views/test_course_outline.py b/openedx/features/course_experience/tests/views/test_course_outline.py index ead323255b..c4feb98ff3 100644 --- a/openedx/features/course_experience/tests/views/test_course_outline.py +++ b/openedx/features/course_experience/tests/views/test_course_outline.py @@ -21,7 +21,6 @@ from gating import api as lms_gating_api from lms.djangoapps.course_api.blocks.transformers.milestones import MilestonesAndSpecialExamsTransformer from milestones.tests.utils import MilestonesTestCaseMixin from opaque_keys.edx.keys import CourseKey, UsageKey -from openedx.core.djangoapps.site_configuration.models import SiteConfiguration from openedx.core.lib.gating import api as gating_api from openedx.features.course_experience.views.course_outline import ( CourseOutlineFragmentView, DEFAULT_COMPLETION_TRACKING_START diff --git a/openedx/features/course_experience/views/course_home.py b/openedx/features/course_experience/views/course_home.py index 0f3eb2801f..021eb3fc1c 100644 --- a/openedx/features/course_experience/views/course_home.py +++ b/openedx/features/course_experience/views/course_home.py @@ -8,7 +8,7 @@ from django.template.loader import render_to_string from django.utils.decorators import method_decorator from django.views.decorators.cache import cache_control from django.views.decorators.csrf import ensure_csrf_cookie -from opaque_keys.edx.keys import CourseKey, UsageKey +from opaque_keys.edx.keys import CourseKey from web_fragments.fragment import Fragment from course_modes.models import get_cosmetic_verified_display_price diff --git a/openedx/features/course_experience/views/welcome_message.py b/openedx/features/course_experience/views/welcome_message.py index 98d965ef5c..f9be8070e2 100644 --- a/openedx/features/course_experience/views/welcome_message.py +++ b/openedx/features/course_experience/views/welcome_message.py @@ -3,14 +3,14 @@ View logic for handling course welcome messages. """ from django.urls import reverse -from django.http import HttpResponse, HttpResponseBadRequest +from django.http import HttpResponse from django.template.loader import render_to_string from django.views.decorators.csrf import ensure_csrf_cookie from opaque_keys.edx.keys import CourseKey from web_fragments.fragment import Fragment from course_updates import get_ordered_updates -from courseware.courses import get_course_info_section_module, get_course_with_access +from courseware.courses import get_course_with_access from openedx.core.djangoapps.plugin_api.views import EdxFragmentView from openedx.core.djangoapps.user_api.course_tag.api import set_course_tag, get_course_tag diff --git a/openedx/features/learner_analytics/tests.py b/openedx/features/learner_analytics/tests.py index 3f734ee41e..4776ef0837 100644 --- a/openedx/features/learner_analytics/tests.py +++ b/openedx/features/learner_analytics/tests.py @@ -1,3 +1 @@ -from django.test import TestCase - # TODO: LEARNER-3854: Implement tests or remove file after Learner Analytics test. diff --git a/openedx/features/learner_analytics/views.py b/openedx/features/learner_analytics/views.py index 0edf212db5..5fdbf00af1 100644 --- a/openedx/features/learner_analytics/views.py +++ b/openedx/features/learner_analytics/views.py @@ -29,7 +29,6 @@ from lms.djangoapps.commerce.utils import EcommerceService from lms.djangoapps.courseware.courses import get_course_with_access from lms.djangoapps.discussion.views import create_user_profile_context from lms.djangoapps.grades.course_grade_factory import CourseGradeFactory -from lms.lib.comment_client.utils import CommentClient500Error from openedx.features.course_experience import default_course_url_name from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_image_urls_for_user diff --git a/openedx/features/learner_profile/tests/views/test_learner_profile.py b/openedx/features/learner_profile/tests/views/test_learner_profile.py index cdf9cacddb..c2c459d91c 100644 --- a/openedx/features/learner_profile/tests/views/test_learner_profile.py +++ b/openedx/features/learner_profile/tests/views/test_learner_profile.py @@ -13,7 +13,6 @@ from django.conf import settings from django.urls import reverse from django.test.client import RequestFactory from opaque_keys.edx.locator import CourseLocator -from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag from openedx.features.learner_profile.views.learner_profile import learner_profile_context from student.tests.factories import CourseEnrollmentFactory, UserFactory from util.testing import UrlResetMixin diff --git a/pavelib/paver_tests/test_paver_quality.py b/pavelib/paver_tests/test_paver_quality.py index 6ae2942b99..8a26d747fb 100644 --- a/pavelib/paver_tests/test_paver_quality.py +++ b/pavelib/paver_tests/test_paver_quality.py @@ -7,8 +7,6 @@ import tempfile import textwrap import unittest -import paver.easy -import paver.tasks from ddt import ddt, file_data, data, unpack from mock import MagicMock, mock_open, patch from path import Path as path diff --git a/pavelib/paver_tests/utils.py b/pavelib/paver_tests/utils.py index ab0f1b9d3d..931ca2f5d9 100644 --- a/pavelib/paver_tests/utils.py +++ b/pavelib/paver_tests/utils.py @@ -3,7 +3,6 @@ import os from unittest import TestCase -import paver.easy from paver import tasks from paver.easy import BuildFailure