diff --git a/openedx/core/djangoapps/user_api/accounts/views.py b/openedx/core/djangoapps/user_api/accounts/views.py index 45963bfc5d..14845cf4a9 100644 --- a/openedx/core/djangoapps/user_api/accounts/views.py +++ b/openedx/core/djangoapps/user_api/accounts/views.py @@ -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, diff --git a/openedx/core/djangoapps/user_api/legacy_urls.py b/openedx/core/djangoapps/user_api/legacy_urls.py index 04318cfc46..2f8baf47f5 100644 --- a/openedx/core/djangoapps/user_api/legacy_urls.py +++ b/openedx/core/djangoapps/user_api/legacy_urls.py @@ -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 diff --git a/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py b/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py index 5ac97f8524..6bc4e96b1a 100644 --- a/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py +++ b/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py @@ -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 diff --git a/openedx/core/djangoapps/user_api/management/commands/retire_user.py b/openedx/core/djangoapps/user_api/management/commands/retire_user.py index cac9f045e8..337251ca1e 100644 --- a/openedx/core/djangoapps/user_api/management/commands/retire_user.py +++ b/openedx/core/djangoapps/user_api/management/commands/retire_user.py @@ -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 diff --git a/openedx/core/djangoapps/user_api/models.py b/openedx/core/djangoapps/user_api/models.py index c1beac1f5f..95f7d9da4a 100644 --- a/openedx/core/djangoapps/user_api/models.py +++ b/openedx/core/djangoapps/user_api/models.py @@ -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, + ) diff --git a/openedx/core/djangoapps/user_api/serializers.py b/openedx/core/djangoapps/user_api/serializers.py index 509a80d658..437a9a61cf 100644 --- a/openedx/core/djangoapps/user_api/serializers.py +++ b/openedx/core/djangoapps/user_api/serializers.py @@ -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 ( diff --git a/openedx/core/djangoapps/user_api/tests/test_helpers.py b/openedx/core/djangoapps/user_api/tests/test_helpers.py index 958bb3fb4e..0d7ef25b27 100644 --- a/openedx/core/djangoapps/user_api/tests/test_helpers.py +++ b/openedx/core/djangoapps/user_api/tests/test_helpers.py @@ -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 diff --git a/openedx/core/djangoapps/user_api/tests/test_views.py b/openedx/core/djangoapps/user_api/tests/test_views.py index 6d615adf9b..bce054d2ff 100644 --- a/openedx/core/djangoapps/user_api/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/tests/test_views.py @@ -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/" diff --git a/openedx/core/djangoapps/user_api/verification_api/tests/test_views.py b/openedx/core/djangoapps/user_api/verification_api/tests/test_views.py index aa211622cf..9d8fa0c702 100644 --- a/openedx/core/djangoapps/user_api/verification_api/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/verification_api/tests/test_views.py @@ -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 diff --git a/openedx/core/djangoapps/user_api/views.py b/openedx/core/djangoapps/user_api/views.py index 1870115e57..421a23adf6 100644 --- a/openedx/core/djangoapps/user_api/views.py +++ b/openedx/core/djangoapps/user_api/views.py @@ -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):