From 3e6b3e41f858011a49e926b455743b6b6c86fb38 Mon Sep 17 00:00:00 2001 From: Usama Sadiq <usama.sadiq@arbisoft.com> Date: Wed, 24 Mar 2021 17:55:04 +0500 Subject: [PATCH] refactor: remove unused imports (#27084) --- common/djangoapps/course_modes/admin.py | 1 - common/djangoapps/course_modes/helpers.py | 1 - common/djangoapps/course_modes/models.py | 1 - .../djangoapps/course_modes/rest_api/v1/tests/test_views.py | 1 - common/djangoapps/course_modes/tests/factories.py | 1 - common/djangoapps/course_modes/tests/test_admin.py | 1 - common/djangoapps/course_modes/tests/test_models.py | 2 +- common/djangoapps/course_modes/tests/test_views.py | 1 - common/djangoapps/course_modes/views.py | 1 - .../student/management/commands/anonymized_id_mapping.py | 1 - .../student/management/commands/bulk_change_enrollment.py | 1 - .../student/management/commands/change_enrollment.py | 1 - common/djangoapps/student/management/commands/set_staff.py | 1 - .../djangoapps/student/management/commands/set_superuser.py | 1 - .../student/management/commands/transfer_students.py | 1 - .../student/management/tests/test_create_random_users.py | 1 - .../student/management/tests/test_create_test_users.py | 1 - common/djangoapps/student/tests/test_models.py | 2 +- common/djangoapps/student/views/dashboard.py | 1 - common/djangoapps/student/views/management.py | 2 -- common/djangoapps/third_party_auth/lti.py | 2 -- common/djangoapps/third_party_auth/saml.py | 1 - common/djangoapps/third_party_auth/tasks.py | 1 - common/djangoapps/third_party_auth/tests/testutil.py | 1 - .../xmodule/modulestore/tests/test_mixed_modulestore.py | 2 +- common/lib/xmodule/xmodule/modulestore/tests/utils.py | 1 - common/lib/xmodule/xmodule/modulestore/xml.py | 1 - common/lib/xmodule/xmodule/modulestore/xml_importer.py | 1 - common/lib/xmodule/xmodule/raw_module.py | 4 ++-- common/lib/xmodule/xmodule/seq_module.py | 2 +- 30 files changed, 6 insertions(+), 33 deletions(-) diff --git a/common/djangoapps/course_modes/admin.py b/common/djangoapps/course_modes/admin.py index 74a9d2892e7..4b75e16677a 100644 --- a/common/djangoapps/course_modes/admin.py +++ b/common/djangoapps/course_modes/admin.py @@ -1,7 +1,6 @@ """Django admin for course_modes""" -import six from django import forms from django.conf import settings from django.contrib import admin diff --git a/common/djangoapps/course_modes/helpers.py b/common/djangoapps/course_modes/helpers.py index 4511a32ffdc..d62573d9da0 100644 --- a/common/djangoapps/course_modes/helpers.py +++ b/common/djangoapps/course_modes/helpers.py @@ -2,7 +2,6 @@ import logging -import six from django.utils.translation import ugettext_lazy as _ from requests.exceptions import ConnectionError, Timeout # pylint: disable=redefined-builtin diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index c9972cd93dc..67fa750ba11 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -6,7 +6,6 @@ Add and create new modes for running courses on this particular LMS from collections import defaultdict, namedtuple from datetime import timedelta import logging -import six from config_models.models import ConfigurationModel from django.conf import settings from django.core.exceptions import ValidationError diff --git a/common/djangoapps/course_modes/rest_api/v1/tests/test_views.py b/common/djangoapps/course_modes/rest_api/v1/tests/test_views.py index 37aad866516..d329e9c7bbe 100644 --- a/common/djangoapps/course_modes/rest_api/v1/tests/test_views.py +++ b/common/djangoapps/course_modes/rest_api/v1/tests/test_views.py @@ -12,7 +12,6 @@ from django.urls import reverse from opaque_keys.edx.keys import CourseKey from rest_framework import status from rest_framework.test import APITestCase -from six import text_type from common.djangoapps.course_modes.rest_api.v1.views import CourseModesView from common.djangoapps.course_modes.models import CourseMode diff --git a/common/djangoapps/course_modes/tests/factories.py b/common/djangoapps/course_modes/tests/factories.py index 624189690cf..a2fbea0190e 100644 --- a/common/djangoapps/course_modes/tests/factories.py +++ b/common/djangoapps/course_modes/tests/factories.py @@ -4,7 +4,6 @@ Factories for course mode models. import random -import six from factory import lazy_attribute from factory.django import DjangoModelFactory diff --git a/common/djangoapps/course_modes/tests/test_admin.py b/common/djangoapps/course_modes/tests/test_admin.py index f04be6d51a5..c71d011f65c 100644 --- a/common/djangoapps/course_modes/tests/test_admin.py +++ b/common/djangoapps/course_modes/tests/test_admin.py @@ -7,7 +7,6 @@ import unittest from datetime import datetime, timedelta import ddt -import six from django.conf import settings from django.urls import reverse from pytz import UTC, timezone diff --git a/common/djangoapps/course_modes/tests/test_models.py b/common/djangoapps/course_modes/tests/test_models.py index 7279166929e..9ce06d13e3c 100644 --- a/common/djangoapps/course_modes/tests/test_models.py +++ b/common/djangoapps/course_modes/tests/test_models.py @@ -17,7 +17,7 @@ from django.utils.timezone import now from opaque_keys.edx.locator import CourseLocator from common.djangoapps.course_modes.helpers import enrollment_mode_display -from common.djangoapps.course_modes.models import ( # lint-amnesty, pylint: disable=line-too-long +from common.djangoapps.course_modes.models import ( CourseMode, Mode, get_cosmetic_display_price, diff --git a/common/djangoapps/course_modes/tests/test_views.py b/common/djangoapps/course_modes/tests/test_views.py index d60c1908916..dfc28b264bf 100644 --- a/common/djangoapps/course_modes/tests/test_views.py +++ b/common/djangoapps/course_modes/tests/test_views.py @@ -12,7 +12,6 @@ import ddt import freezegun import httpretty import pytz -import six from django.conf import settings from django.urls import reverse diff --git a/common/djangoapps/course_modes/views.py b/common/djangoapps/course_modes/views.py index df7bd13bd53..69dcf48b79b 100644 --- a/common/djangoapps/course_modes/views.py +++ b/common/djangoapps/course_modes/views.py @@ -23,7 +23,6 @@ from django.views.generic.base import View from edx_django_utils.monitoring.utils import increment from ipware.ip import get_client_ip from opaque_keys.edx.keys import CourseKey -from six import text_type from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.course_modes.helpers import get_course_final_price diff --git a/common/djangoapps/student/management/commands/anonymized_id_mapping.py b/common/djangoapps/student/management/commands/anonymized_id_mapping.py index 3a3fcc85b25..645fad370e8 100644 --- a/common/djangoapps/student/management/commands/anonymized_id_mapping.py +++ b/common/djangoapps/student/management/commands/anonymized_id_mapping.py @@ -13,7 +13,6 @@ import csv from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core.management.base import BaseCommand, CommandError from opaque_keys.edx.keys import CourseKey -from six import text_type from common.djangoapps.student.models import anonymous_id_for_user diff --git a/common/djangoapps/student/management/commands/bulk_change_enrollment.py b/common/djangoapps/student/management/commands/bulk_change_enrollment.py index 7787f7fc780..c59b2533b6c 100644 --- a/common/djangoapps/student/management/commands/bulk_change_enrollment.py +++ b/common/djangoapps/student/management/commands/bulk_change_enrollment.py @@ -7,7 +7,6 @@ from django.core.management.base import BaseCommand, CommandError from django.db import transaction from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey -from six import text_type from common.djangoapps.course_modes.models import CourseMode from openedx.core.djangoapps.content.course_overviews.models import CourseOverview diff --git a/common/djangoapps/student/management/commands/change_enrollment.py b/common/djangoapps/student/management/commands/change_enrollment.py index 53a770b4b78..fa322fdd7be 100644 --- a/common/djangoapps/student/management/commands/change_enrollment.py +++ b/common/djangoapps/student/management/commands/change_enrollment.py @@ -7,7 +7,6 @@ from django.core.management.base import BaseCommand, CommandError from django.db import transaction from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey -from six import text_type from openedx.core.djangoapps.credit.email_utils import get_credit_provider_attribute_values from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAttribute, User diff --git a/common/djangoapps/student/management/commands/set_staff.py b/common/djangoapps/student/management/commands/set_staff.py index 2664d377514..579f4775e8b 100644 --- a/common/djangoapps/student/management/commands/set_staff.py +++ b/common/djangoapps/student/management/commands/set_staff.py @@ -4,7 +4,6 @@ import re from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core.management.base import BaseCommand -from six import text_type class Command(BaseCommand): # lint-amnesty, pylint: disable=missing-class-docstring diff --git a/common/djangoapps/student/management/commands/set_superuser.py b/common/djangoapps/student/management/commands/set_superuser.py index 226353bd6c7..aa73b7498c5 100644 --- a/common/djangoapps/student/management/commands/set_superuser.py +++ b/common/djangoapps/student/management/commands/set_superuser.py @@ -3,7 +3,6 @@ from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core.management.base import BaseCommand -from six import text_type class Command(BaseCommand): diff --git a/common/djangoapps/student/management/commands/transfer_students.py b/common/djangoapps/student/management/commands/transfer_students.py index 0c69c35c5f3..2f865df7668 100644 --- a/common/djangoapps/student/management/commands/transfer_students.py +++ b/common/djangoapps/student/management/commands/transfer_students.py @@ -8,7 +8,6 @@ from textwrap import dedent from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.db import transaction from opaque_keys.edx.keys import CourseKey -from six import text_type from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.track.management.tracked_command import TrackedCommand diff --git a/common/djangoapps/student/management/tests/test_create_random_users.py b/common/djangoapps/student/management/tests/test_create_random_users.py index 2e00b6a6758..d172e33a7f1 100644 --- a/common/djangoapps/student/management/tests/test_create_random_users.py +++ b/common/djangoapps/student/management/tests/test_create_random_users.py @@ -7,7 +7,6 @@ import pytest from django.contrib.auth import get_user_model from django.core.management import call_command from opaque_keys import InvalidKeyError -from six import text_type from common.djangoapps.student.models import CourseEnrollment from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase diff --git a/common/djangoapps/student/management/tests/test_create_test_users.py b/common/djangoapps/student/management/tests/test_create_test_users.py index 44965c6375f..8b3fd3fde78 100644 --- a/common/djangoapps/student/management/tests/test_create_test_users.py +++ b/common/djangoapps/student/management/tests/test_create_test_users.py @@ -9,7 +9,6 @@ from django.core.exceptions import ValidationError from django.core.management import call_command from django.core.management.base import CommandError from opaque_keys import InvalidKeyError -from six import text_type from common.djangoapps.student.helpers import AccountValidationError from common.djangoapps.student.models import CourseAccessRole, CourseEnrollment diff --git a/common/djangoapps/student/tests/test_models.py b/common/djangoapps/student/tests/test_models.py index 584c86ce1e1..b9b553147b7 100644 --- a/common/djangoapps/student/tests/test_models.py +++ b/common/djangoapps/student/tests/test_models.py @@ -8,7 +8,7 @@ import pytz from crum import set_current_request from django.contrib.auth.models import AnonymousUser, User # lint-amnesty, pylint: disable=imported-auth-user from django.core.cache import cache -from django.db.models import signals +from django.db.models import signals # pylint: disable=unused-import from django.db.models.functions import Lower from django.test import TestCase from edx_toggles.toggles.testutils import override_waffle_flag diff --git a/common/djangoapps/student/views/dashboard.py b/common/djangoapps/student/views/dashboard.py index 64a01fffbe4..a0ba7af5782 100644 --- a/common/djangoapps/student/views/dashboard.py +++ b/common/djangoapps/student/views/dashboard.py @@ -19,7 +19,6 @@ from edx_django_utils.plugins import get_plugins_view_context from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace from opaque_keys.edx.keys import CourseKey from pytz import UTC -from six import iteritems, text_type from lms.djangoapps.bulk_email.api import is_bulk_email_feature_enabled from lms.djangoapps.bulk_email.models import Optout diff --git a/common/djangoapps/student/views/management.py b/common/djangoapps/student/views/management.py index 60d3e20c0a7..36875e502fa 100644 --- a/common/djangoapps/student/views/management.py +++ b/common/djangoapps/student/views/management.py @@ -8,7 +8,6 @@ import logging import uuid from collections import namedtuple -import six from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required @@ -34,7 +33,6 @@ from ipware.ip import get_client_ip from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from pytz import UTC -from six import text_type from common.djangoapps.track import views as track_views from lms.djangoapps.bulk_email.models import Optout diff --git a/common/djangoapps/third_party_auth/lti.py b/common/djangoapps/third_party_auth/lti.py index b20885ceeb6..f2ce6715270 100644 --- a/common/djangoapps/third_party_auth/lti.py +++ b/common/djangoapps/third_party_auth/lti.py @@ -7,7 +7,6 @@ import calendar import logging import time -import six from django.contrib.auth import REDIRECT_FIELD_NAME from oauthlib.common import Request from oauthlib.oauth1.rfc5849.signature import ( @@ -17,7 +16,6 @@ from oauthlib.oauth1.rfc5849.signature import ( normalize_parameters, sign_hmac_sha1 ) -from six import text_type from social_core.backends.base import BaseAuth from social_core.exceptions import AuthFailed from social_core.utils import sanitize_redirect diff --git a/common/djangoapps/third_party_auth/saml.py b/common/djangoapps/third_party_auth/saml.py index 2937522b919..38fa157bb44 100644 --- a/common/djangoapps/third_party_auth/saml.py +++ b/common/djangoapps/third_party_auth/saml.py @@ -12,7 +12,6 @@ from django.http import Http404 from django.utils.functional import cached_property from django_countries import countries from onelogin.saml2.settings import OneLogin_Saml2_Settings -from six import text_type from social_core.backends.saml import OID_EDU_PERSON_ENTITLEMENT, SAMLAuth, SAMLIdentityProvider from social_core.exceptions import AuthForbidden diff --git a/common/djangoapps/third_party_auth/tasks.py b/common/djangoapps/third_party_auth/tasks.py index 38a4f50c6d7..90c256e67b3 100644 --- a/common/djangoapps/third_party_auth/tasks.py +++ b/common/djangoapps/third_party_auth/tasks.py @@ -15,7 +15,6 @@ from edx_django_utils.monitoring import set_code_owner_attribute from lxml import etree from onelogin.saml2.utils import OneLogin_Saml2_Utils from requests import exceptions -from six import text_type from openedx.core.djangolib.markup import Text from common.djangoapps.third_party_auth.models import SAMLConfiguration, SAMLProviderConfig, SAMLProviderData diff --git a/common/djangoapps/third_party_auth/tests/testutil.py b/common/djangoapps/third_party_auth/tests/testutil.py index ec8b1e65069..33eb30009b4 100644 --- a/common/djangoapps/third_party_auth/tests/testutil.py +++ b/common/djangoapps/third_party_auth/tests/testutil.py @@ -10,7 +10,6 @@ from contextlib import contextmanager from unittest import mock import django.test -import six from django.conf import settings from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.contrib.sites.models import Site diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py index e70320ed2fc..653dad78e62 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py @@ -22,7 +22,7 @@ import pytest # TODO remove this import and the configuration -- xmodule should not depend on django! from django.conf import settings from opaque_keys.edx.keys import CourseKey -from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator, LibraryLocator +from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator, LibraryLocator # pylint: disable=unused-import from pytz import UTC from web_fragments.fragment import Fragment from xblock.core import XBlockAside diff --git a/common/lib/xmodule/xmodule/modulestore/tests/utils.py b/common/lib/xmodule/xmodule/modulestore/tests/utils.py index 60a22b3d112..92dbbfd8e0d 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/utils.py @@ -3,7 +3,6 @@ Helper classes and methods for running modulestore tests without Django. """ -import io import os from contextlib import contextmanager from importlib import import_module diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index ca28f991fe5..06724aeec2a 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -2,7 +2,6 @@ import glob import hashlib -import io import itertools import json import logging diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py index 8f50d537ba8..2f6a31b2e90 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -23,7 +23,6 @@ Modulestore virtual | XML physical (draft, published) import json -import io import logging import mimetypes import os diff --git a/common/lib/xmodule/xmodule/raw_module.py b/common/lib/xmodule/xmodule/raw_module.py index c840ab2f565..cf349efbd89 100644 --- a/common/lib/xmodule/xmodule/raw_module.py +++ b/common/lib/xmodule/xmodule/raw_module.py @@ -4,8 +4,8 @@ import re from lxml import etree from xblock.fields import Scope, String -from xmodule.editing_module import XMLEditingDescriptor -from xmodule.xml_module import XmlDescriptor +from xmodule.editing_module import XMLEditingDescriptor # pylint: disable=unused-import +from xmodule.xml_module import XmlDescriptor # pylint: disable=unused-import from .exceptions import SerializationError diff --git a/common/lib/xmodule/xmodule/seq_module.py b/common/lib/xmodule/xmodule/seq_module.py index 96694aea9db..eba02ef5a64 100644 --- a/common/lib/xmodule/xmodule/seq_module.py +++ b/common/lib/xmodule/xmodule/seq_module.py @@ -38,7 +38,7 @@ from .exceptions import NotFoundError from .fields import Date from .mako_module import MakoTemplateBlockBase from .progress import Progress -from .x_module import AUTHOR_VIEW, PUBLIC_VIEW, STUDENT_VIEW, XModule +from .x_module import AUTHOR_VIEW, PUBLIC_VIEW, STUDENT_VIEW, XModule # pylint: disable=unused-import from .xml_module import XmlMixin -- GitLab