Refactor: Removed unused imports

Removed unused imports from openedx/core/djangoapps/user_api
This commit is contained in:
Jawayria
2021-02-17 19:00:37 +05:00
parent 401789dad3
commit 83aa5f02f1
10 changed files with 5 additions and 55 deletions

View File

@@ -53,7 +53,6 @@ from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiv
from openedx.core.lib.api.parsers import MergePatchParser
from common.djangoapps.student.models import ( # lint-amnesty, pylint: disable=unused-import
AccountRecovery,
CourseEnrollment,
CourseEnrollmentAllowed,
LoginFailures,
ManualEnrollmentAudit,

View File

@@ -1,9 +1,6 @@
"""
Defines the URL routes for this app.
"""
from django.conf import settings # lint-amnesty, pylint: disable=unused-import
from django.conf.urls import include, url
from rest_framework import routers

View File

@@ -32,7 +32,6 @@ from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.db import connections
from django.utils import timezone
from opaque_keys.edx.keys import CourseKey # lint-amnesty, pylint: disable=unused-import
from xmodule.modulestore.django import modulestore

View File

@@ -1,7 +1,7 @@
# lint-amnesty, pylint: disable=missing-module-docstring
import logging
from django.contrib.auth import get_user_model, logout # lint-amnesty, pylint: disable=unused-import
from django.contrib.auth import get_user_model # lint-amnesty, pylint: disable=unused-import
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction

View File

@@ -23,15 +23,13 @@ from openedx.core.djangolib.model_mixins import DeletableByUserValue
from openedx.core.lib.cache_utils import request_cached
# pylint: disable=unused-import
from common.djangoapps.student.models import (
PendingEmailChange,
Registration,
UserProfile,
get_retired_email_by_email,
get_retired_username_by_username
)
from common.djangoapps.util.model_utils import (
emit_settings_changed_event,
get_changed_fields_dict,
)

View File

@@ -4,7 +4,6 @@ Django REST Framework serializers for the User API application
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.utils.timezone import now # lint-amnesty, pylint: disable=unused-import
from rest_framework import serializers
from lms.djangoapps.verify_student.models import (

View File

@@ -7,7 +7,6 @@ import json
import re
from unittest import mock
import ddt # lint-amnesty, pylint: disable=unused-import
import pytest
from django import forms
from django.test import TestCase

View File

@@ -1,53 +1,20 @@
"""Tests for the user API at the HTTP request level. """
import json # lint-amnesty, pylint: disable=unused-import
from unittest import skipUnless # lint-amnesty, pylint: disable=unused-import
from unittest import mock # lint-amnesty, pylint: disable=unused-import
import pytest
import ddt
import httpretty # lint-amnesty, pylint: disable=unused-import
from django.conf import settings # lint-amnesty, pylint: disable=unused-import
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user, unused-import
from django.core import mail # lint-amnesty, pylint: disable=unused-import
from django.test.client import RequestFactory # lint-amnesty, pylint: disable=unused-import
from django.test.testcases import TransactionTestCase # lint-amnesty, pylint: disable=unused-import
from django.test.utils import override_settings
from django.urls import reverse
from opaque_keys.edx.keys import CourseKey
from pytz import UTC, common_timezones_set # lint-amnesty, pylint: disable=unused-import
from social_django.models import Partial, UserSocialAuth # lint-amnesty, pylint: disable=unused-import
from pytz import common_timezones_set
from openedx.core.djangoapps.django_comment_common import models
from openedx.core.djangoapps.site_configuration.helpers import get_value # lint-amnesty, pylint: disable=unused-import
from openedx.core.djangoapps.site_configuration.tests.test_util import with_site_configuration # lint-amnesty, pylint: disable=unused-import
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
from openedx.core.lib.api.test_utils import TEST_API_KEY, ApiTestCase
from openedx.core.lib.time_zone_utils import get_display_time_zone
from common.djangoapps.student.tests.factories import UserFactory
from common.djangoapps.third_party_auth.tests.testutil import ThirdPartyAuthTestMixin, simulate_running_pipeline # lint-amnesty, pylint: disable=unused-import
from common.djangoapps.third_party_auth.tests.utils import ( # lint-amnesty, pylint: disable=unused-import
ThirdPartyOAuthTestMixin,
ThirdPartyOAuthTestMixinFacebook,
ThirdPartyOAuthTestMixinGoogle
)
from common.djangoapps.util.password_policy_validators import ( # lint-amnesty, pylint: disable=unused-import
create_validator_config,
password_validators_instruction_texts,
password_validators_restrictions
)
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from ..accounts import ( # lint-amnesty, pylint: disable=unused-import
EMAIL_MAX_LENGTH,
EMAIL_MIN_LENGTH,
NAME_MAX_LENGTH,
USERNAME_BAD_LENGTH_MSG,
USERNAME_MAX_LENGTH,
USERNAME_MIN_LENGTH
)
from ..accounts.api import get_account_settings # lint-amnesty, pylint: disable=unused-import
from ..accounts.tests.retirement_helpers import ( # pylint: disable=unused-import
RetirementTestCase,
fake_requested_retirement,
@@ -55,8 +22,6 @@ from ..accounts.tests.retirement_helpers import ( # pylint: disable=unused-impo
)
from ..models import UserOrgTag
from ..tests.factories import UserPreferenceFactory
from ..tests.test_constants import SORTED_COUNTRIES # lint-amnesty, pylint: disable=unused-import
from .test_helpers import TestCaseForm # lint-amnesty, pylint: disable=unused-import
USER_LIST_URI = "/api/user/v1/users/"
USER_PREFERENCE_LIST_URI = "/api/user/v1/user_prefs/"

View File

@@ -10,7 +10,7 @@ from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from lms.djangoapps.verify_student.models import ManualVerification, SoftwareSecurePhotoVerification, SSOVerification # lint-amnesty, pylint: disable=unused-import
from lms.djangoapps.verify_student.models import ManualVerification, SoftwareSecurePhotoVerification
from lms.djangoapps.verify_student.tests.factories import SSOVerificationFactory
from common.djangoapps.student.tests.factories import UserFactory

View File

@@ -2,11 +2,8 @@
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.exceptions import NON_FIELD_ERRORS, PermissionDenied, ValidationError # lint-amnesty, pylint: disable=unused-import
from django.db import transaction # lint-amnesty, pylint: disable=unused-import
from django.http import HttpResponse, HttpResponseForbidden # lint-amnesty, pylint: disable=unused-import
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _ # lint-amnesty, pylint: disable=unused-import
from django.views.decorators.csrf import ensure_csrf_cookie
from django_filters.rest_framework import DjangoFilterBackend
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
@@ -19,7 +16,6 @@ from rest_framework.permissions import IsAuthenticated
from rest_framework.views import APIView
from openedx.core.djangoapps.django_comment_common.models import Role
from openedx.core.djangoapps.user_api import accounts # lint-amnesty, pylint: disable=unused-import
from openedx.core.lib.api.view_utils import require_post_params
from openedx.core.djangoapps.user_api.models import UserPreference
from openedx.core.djangoapps.user_api.preferences.api import get_country_time_zones, update_email_opt_in
@@ -29,8 +25,6 @@ from openedx.core.djangoapps.user_api.serializers import (
UserSerializer
)
from openedx.core.lib.api.permissions import ApiKeyHeaderPermission
from common.djangoapps.student.helpers import AccountValidationError # lint-amnesty, pylint: disable=unused-import
from common.djangoapps.util.json_request import JsonResponse # lint-amnesty, pylint: disable=unused-import
class UserViewSet(viewsets.ReadOnlyModelViewSet):