Merge pull request #19215 from edx/nedbat/remove-unused-imports

Remove unused imports
This commit is contained in:
Ned Batchelder
2018-11-06 13:57:46 -05:00
committed by GitHub
61 changed files with 19 additions and 128 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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__)

View File

@@ -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

View File

@@ -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

View File

@@ -1,7 +1,6 @@
"""Get log settings."""
import logging
import os
import platform
import sys
import warnings

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +1 @@
from django.test import TestCase
# TODO: LEARNER-3854: Implement tests or remove file after Learner Analytics test.

View File

@@ -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

View File

@@ -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