From abd4cdc819df406342ba1e957541118fbba7c24c Mon Sep 17 00:00:00 2001 From: Jawayria Date: Thu, 25 Nov 2021 14:42:24 +0500 Subject: [PATCH] chore: Applied lint-amnesty on lms/djangoapps/courseware --- lms/djangoapps/courseware/access.py | 8 ++++---- lms/djangoapps/courseware/access_utils.py | 4 ++-- lms/djangoapps/courseware/courses.py | 6 +++--- lms/djangoapps/courseware/entrance_exams.py | 2 +- .../courseware/management/commands/import.py | 10 +++++----- lms/djangoapps/courseware/masquerade.py | 8 ++++---- lms/djangoapps/courseware/model_data.py | 2 +- lms/djangoapps/courseware/module_render.py | 14 +++++++------- lms/djangoapps/courseware/rules.py | 6 +++--- lms/djangoapps/courseware/tabs.py | 2 +- lms/djangoapps/courseware/testutils.py | 8 ++++---- lms/djangoapps/courseware/utils.py | 4 ++-- lms/djangoapps/courseware/views/index.py | 6 +++--- lms/djangoapps/courseware/views/views.py | 12 ++++++------ 14 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index da85f102dd..a3ef809614 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -63,10 +63,10 @@ from common.djangoapps.util.milestones_helpers import ( get_pre_requisite_courses_not_completed, is_prerequisite_courses_enabled ) -from xmodule.course_module import CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CourseBlock -from xmodule.error_module import ErrorBlock -from xmodule.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError -from xmodule.x_module import XModule +from xmodule.course_module import CATALOG_VISIBILITY_ABOUT, CATALOG_VISIBILITY_CATALOG_AND_ABOUT, CourseBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.partitions.partitions import NoSuchUserPartitionError, NoSuchUserPartitionGroupError # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.x_module import XModule # lint-amnesty, pylint: disable=wrong-import-order log = logging.getLogger(__name__) diff --git a/lms/djangoapps/courseware/access_utils.py b/lms/djangoapps/courseware/access_utils.py index 860f281045..059a11e5b3 100644 --- a/lms/djangoapps/courseware/access_utils.py +++ b/lms/djangoapps/courseware/access_utils.py @@ -24,8 +24,8 @@ from openedx.features.course_experience import ( ) from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.roles import CourseBetaTesterRole -from xmodule.util.xmodule_django import get_current_request_hostname -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC +from xmodule.util.xmodule_django import get_current_request_hostname # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.course_module import COURSE_VISIBILITY_PUBLIC # lint-amnesty, pylint: disable=wrong-import-order DEBUG_ACCESS = False log = getLogger(__name__) diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py index 145a4b3186..89fa7c0596 100644 --- a/lms/djangoapps/courseware/courses.py +++ b/lms/djangoapps/courseware/courses.py @@ -62,9 +62,9 @@ from openedx.features.course_experience.utils import is_block_structure_complete from common.djangoapps.static_replace import replace_static_urls from lms.djangoapps.survey.utils import SurveyRequiredAccessError, check_survey_required_and_unanswered from common.djangoapps.util.date_utils import strftime_localized -from xmodule.modulestore.django import modulestore -from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule.x_module import STUDENT_VIEW +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.x_module import STUDENT_VIEW # lint-amnesty, pylint: disable=wrong-import-order log = logging.getLogger(__name__) diff --git a/lms/djangoapps/courseware/entrance_exams.py b/lms/djangoapps/courseware/entrance_exams.py index 40724d2027..b4358773c5 100644 --- a/lms/djangoapps/courseware/entrance_exams.py +++ b/lms/djangoapps/courseware/entrance_exams.py @@ -9,7 +9,7 @@ from lms.djangoapps.courseware.access import has_access from common.djangoapps.student.models import EntranceExamConfiguration from common.djangoapps.util.milestones_helpers import get_required_content from openedx.core.toggles import ENTRANCE_EXAMS -from xmodule.modulestore.django import modulestore +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order def course_has_entrance_exam(course): diff --git a/lms/djangoapps/courseware/management/commands/import.py b/lms/djangoapps/courseware/management/commands/import.py index fc50bc264b..92fba632dd 100644 --- a/lms/djangoapps/courseware/management/commands/import.py +++ b/lms/djangoapps/courseware/management/commands/import.py @@ -6,11 +6,11 @@ Script for importing courseware from XML format from django.core.management.base import BaseCommand from openedx.core.djangoapps.django_comment_common.utils import are_permissions_roles_seeded, seed_permissions_roles -from xmodule.contentstore.django import contentstore -from xmodule.modulestore import ModuleStoreEnum -from xmodule.modulestore.django import modulestore -from xmodule.modulestore.xml_importer import import_course_from_xml -from xmodule.util.sandboxing import DEFAULT_PYTHON_LIB_FILENAME +from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.xml_importer import import_course_from_xml # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.util.sandboxing import DEFAULT_PYTHON_LIB_FILENAME # lint-amnesty, pylint: disable=wrong-import-order class Command(BaseCommand): diff --git a/lms/djangoapps/courseware/masquerade.py b/lms/djangoapps/courseware/masquerade.py index 64b016e838..e838f862c5 100644 --- a/lms/djangoapps/courseware/masquerade.py +++ b/lms/djangoapps/courseware/masquerade.py @@ -28,10 +28,10 @@ from openedx.features.content_type_gating.helpers import LIMITED_ACCESS from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.student.role_helpers import has_staff_roles from common.djangoapps.util.json_request import JsonResponse, expect_json -from xmodule.modulestore.django import modulestore -from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID -from xmodule.partitions.partitions import NoSuchUserPartitionGroupError -from xmodule.partitions.partitions_service import get_all_partitions_for_course +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.partitions.partitions import NoSuchUserPartitionGroupError # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.partitions.partitions_service import get_all_partitions_for_course # lint-amnesty, pylint: disable=wrong-import-order log = logging.getLogger(__name__) diff --git a/lms/djangoapps/courseware/model_data.py b/lms/djangoapps/courseware/model_data.py index 7db24f20f5..85ccceb6fc 100644 --- a/lms/djangoapps/courseware/model_data.py +++ b/lms/djangoapps/courseware/model_data.py @@ -37,7 +37,7 @@ from xblock.fields import Scope, UserScope from xblock.runtime import KeyValueStore from lms.djangoapps.courseware.user_state_client import DjangoXBlockUserStateClient -from xmodule.modulestore.django import modulestore +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order from .models import StudentModule, XModuleStudentInfoField, XModuleStudentPrefsField, XModuleUserStateSummaryField diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index b4acc4c3f6..6929cea8a8 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -42,7 +42,7 @@ from xblock.runtime import KvsFieldData from common.djangoapps import static_replace from common.djangoapps.xblock_django.constants import ATTR_KEY_USER_ID -from capa.xqueue_interface import XQueueInterface +from capa.xqueue_interface import XQueueInterface # lint-amnesty, pylint: disable=wrong-import-order from lms.djangoapps.courseware.access import get_user_role, has_access from lms.djangoapps.courseware.entrance_exams import user_can_skip_entrance_exam, user_has_passed_entrance_exam from lms.djangoapps.courseware.masquerade import ( @@ -91,12 +91,12 @@ from common.djangoapps.util import milestones_helpers from common.djangoapps.util.json_request import JsonResponse from common.djangoapps.edxmako.services import MakoService from common.djangoapps.xblock_django.user_service import DjangoXBlockUserService -from xmodule.contentstore.django import contentstore -from xmodule.error_module import ErrorBlock, NonStaffErrorBlock -from xmodule.exceptions import NotFoundError, ProcessingError -from xmodule.modulestore.django import modulestore -from xmodule.modulestore.exceptions import ItemNotFoundError -from xmodule.util.sandboxing import can_execute_unsafe_code, get_python_lib_zip +from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_module import ErrorBlock, NonStaffErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.exceptions import NotFoundError, ProcessingError # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.util.sandboxing import can_execute_unsafe_code, get_python_lib_zip # lint-amnesty, pylint: disable=wrong-import-order log = logging.getLogger(__name__) diff --git a/lms/djangoapps/courseware/rules.py b/lms/djangoapps/courseware/rules.py index c45718e84c..25931b6a89 100644 --- a/lms/djangoapps/courseware/rules.py +++ b/lms/djangoapps/courseware/rules.py @@ -19,9 +19,9 @@ from openedx.core.djangoapps.content.course_overviews.models import CourseOvervi from openedx.core.djangoapps.enrollments.api import is_enrollment_valid_for_proctoring from common.djangoapps.student.models import CourseAccessRole from common.djangoapps.student.roles import CourseRole, OrgRole -from xmodule.course_module import CourseBlock -from xmodule.error_module import ErrorBlock -from xmodule.x_module import XModule +from xmodule.course_module import CourseBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.error_module import ErrorBlock # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.x_module import XModule # lint-amnesty, pylint: disable=wrong-import-order from .access import has_access diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 3e7ebed546..5d2d6f6fc4 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -15,7 +15,7 @@ from openedx.core.lib.course_tabs import CourseTabPluginManager from openedx.features.course_experience import DISABLE_UNIFIED_COURSE_TAB_FLAG, default_course_url_name from openedx.features.course_experience.url_helpers import get_learning_mfe_home_url from common.djangoapps.student.models import CourseEnrollment -from xmodule.tabs import CourseTab, CourseTabList, course_reverse_func_from_name_func, key_checker +from xmodule.tabs import CourseTab, CourseTabList, course_reverse_func_from_name_func, key_checker # lint-amnesty, pylint: disable=wrong-import-order class EnrolledTab(CourseTab): diff --git a/lms/djangoapps/courseware/testutils.py b/lms/djangoapps/courseware/testutils.py index c624221e3c..8b9efd3177 100644 --- a/lms/djangoapps/courseware/testutils.py +++ b/lms/djangoapps/courseware/testutils.py @@ -17,10 +17,10 @@ from common.djangoapps.student.tests.factories import AdminFactory, CourseEnroll from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.course_modes.tests.factories import CourseModeFactory -from xmodule.modulestore import ModuleStoreEnum -from xmodule.modulestore.django import modulestore -from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase -from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls +from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls # lint-amnesty, pylint: disable=wrong-import-order from .field_overrides import OverrideModulestoreFieldData from .tests.helpers import MasqueradeMixin diff --git a/lms/djangoapps/courseware/utils.py b/lms/djangoapps/courseware/utils.py index 6ed5be423b..655a78deb6 100644 --- a/lms/djangoapps/courseware/utils.py +++ b/lms/djangoapps/courseware/utils.py @@ -8,8 +8,8 @@ from lms.djangoapps.commerce.utils import EcommerceService from pytz import utc # lint-amnesty, pylint: disable=wrong-import-order from common.djangoapps.course_modes.models import CourseMode -from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID -from xmodule.partitions.partitions_service import PartitionService +from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.partitions.partitions_service import PartitionService # lint-amnesty, pylint: disable=wrong-import-order def verified_upgrade_deadline_link(user, course=None, course_id=None): diff --git a/lms/djangoapps/courseware/views/index.py b/lms/djangoapps/courseware/views/index.py index b6b5ec31e2..2e7c3901ab 100644 --- a/lms/djangoapps/courseware/views/index.py +++ b/lms/djangoapps/courseware/views/index.py @@ -47,9 +47,9 @@ from openedx.features.course_experience.url_helpers import make_learning_mfe_cou from openedx.features.enterprise_support.api import data_sharing_consent_required from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.util.views import ensure_valid_course_key -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC -from xmodule.modulestore.django import modulestore -from xmodule.x_module import PUBLIC_VIEW, STUDENT_VIEW +from xmodule.course_module import COURSE_VISIBILITY_PUBLIC # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.x_module import PUBLIC_VIEW, STUDENT_VIEW # lint-amnesty, pylint: disable=wrong-import-order from ..access import has_access from ..access_utils import check_public_access diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index 895e05be7d..0e5fdc2b1e 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -22,7 +22,7 @@ from django.shortcuts import redirect from django.template.context_processors import csrf from django.urls import reverse from django.utils.decorators import method_decorator -from urllib.parse import quote_plus +from urllib.parse import quote_plus # lint-amnesty, pylint: disable=wrong-import-order from django.utils.text import slugify from django.utils.translation import gettext from django.utils.translation import gettext_lazy as _ @@ -129,11 +129,11 @@ from common.djangoapps.util.course import course_location_from_key from common.djangoapps.util.db import outer_atomic from common.djangoapps.util.milestones_helpers import get_prerequisite_courses_display from common.djangoapps.util.views import ensure_valid_course_key, ensure_valid_usage_key -from xmodule.course_module import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE -from xmodule.modulestore.django import modulestore -from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem -from xmodule.tabs import CourseTabList -from xmodule.x_module import STUDENT_VIEW +from xmodule.course_module import COURSE_VISIBILITY_PUBLIC, COURSE_VISIBILITY_PUBLIC_OUTLINE # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.tabs import CourseTabList # lint-amnesty, pylint: disable=wrong-import-order +from xmodule.x_module import STUDENT_VIEW # lint-amnesty, pylint: disable=wrong-import-order from ..context_processor import user_timezone_locale_prefs from ..entrance_exams import user_can_skip_entrance_exam