Merge pull request #26615 from edx/jawayria/bom-2408-7

BOM-2408: Removed unused imports from openedx/core/{djangolib, lib} a…
This commit is contained in:
Jawayria
2021-04-12 14:45:52 +05:00
committed by GitHub
12 changed files with 6 additions and 37 deletions

View File

@@ -3,7 +3,7 @@ i18n utility functions
"""
from django.utils.translation import ugettext as _, override # lint-amnesty, pylint: disable=unused-import
from django.utils.translation import override
from django.utils.formats import dateformat, get_format

View File

@@ -11,7 +11,7 @@ from datetime import timedelta
import ddt
from django.conf import settings
from django.conf.urls import include, url # lint-amnesty, pylint: disable=unused-import
from django.conf.urls import url
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.http import HttpResponse
from django.test import TestCase

View File

@@ -1,8 +1,6 @@
"""
Test audit user's access to various content based on content-gating features.
"""
import os
from datetime import datetime, timedelta
@@ -33,8 +31,7 @@ from openedx.core.djangoapps.django_comment_common.models import (
FORUM_ROLE_ADMINISTRATOR,
FORUM_ROLE_COMMUNITY_TA,
FORUM_ROLE_GROUP_MODERATOR,
FORUM_ROLE_MODERATOR,
Role
FORUM_ROLE_MODERATOR
)
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
from openedx.core.djangoapps.util.testing import TestConditionalContent

View File

@@ -12,7 +12,6 @@ from unittest.mock import Mock
from opaque_keys.edx.locator import CourseLocator
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
from edx_toggles.toggles.testutils import override_waffle_flag
from openedx.core.djangoapps.config_model_utils.models import Provenance
from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory
from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory

View File

@@ -1,6 +1,4 @@
from datetime import datetime
from django.conf import settings
from django.test import RequestFactory
from unittest.mock import Mock, patch
from opaque_keys.edx.keys import CourseKey
@@ -10,10 +8,9 @@ from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from openedx.features.content_type_gating.helpers import CONTENT_GATING_PARTITION_ID, FULL_ACCESS, LIMITED_ACCESS
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
from openedx.features.content_type_gating.partitions import ContentTypeGatingPartition, create_content_gating_partition
from openedx.features.content_type_gating.partitions import create_content_gating_partition
from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory
from common.djangoapps.student.tests.factories import GroupFactory
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID, UserPartitionError
from xmodule.partitions.partitions import UserPartitionError
class TestContentTypeGatingPartition(CacheIsolationTestCase):

View File

@@ -8,7 +8,6 @@ from django.conf.urls import url
from .views.course_dates import CourseDatesFragmentMobileView
from .views.course_home import CourseHomeFragmentView, CourseHomeView
from .views.course_outline import CourseOutlineFragmentView
from .views.course_sock import CourseSockFragmentView # lint-amnesty, pylint: disable=unused-import
from .views.course_updates import CourseUpdatesFragmentView, CourseUpdatesView
from .views.latest_update import LatestUpdateFragmentView
from .views.welcome_message import WelcomeMessageFragmentView, dismiss_welcome_message

View File

@@ -2,7 +2,6 @@
Common utilities for the course experience, including course outline.
"""
from django.utils import timezone
from opaque_keys.edx.keys import CourseKey

View File

@@ -5,33 +5,21 @@ Views to show a course outline.
import datetime
import re
import six # lint-amnesty, pylint: disable=unused-import
from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.db.models import Q # lint-amnesty, pylint: disable=unused-import
from django.shortcuts import redirect # lint-amnesty, pylint: disable=unused-import
from django.template.context_processors import csrf
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils import timezone # lint-amnesty, pylint: disable=unused-import
from django.views.decorators.csrf import ensure_csrf_cookie # lint-amnesty, pylint: disable=unused-import
import edx_when.api as edx_when_api
from opaque_keys.edx.keys import CourseKey
from pytz import UTC
from waffle.models import Switch
from web_fragments.fragment import Fragment
from lms.djangoapps.courseware.access import has_access # lint-amnesty, pylint: disable=unused-import
from lms.djangoapps.courseware.courses import get_course_overview_with_access
from lms.djangoapps.courseware.date_summary import verified_upgrade_deadline_link
from lms.djangoapps.courseware.masquerade import setup_masquerade # lint-amnesty, pylint: disable=unused-import
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview # lint-amnesty, pylint: disable=unused-import
from openedx.core.djangoapps.plugin_api.views import EdxFragmentView
from openedx.core.djangoapps.schedules.utils import reset_self_paced_schedule # lint-amnesty, pylint: disable=unused-import
from openedx.features.course_experience import RELATIVE_DATES_FLAG # lint-amnesty, pylint: disable=unused-import
from openedx.features.course_experience.utils import dates_banner_should_display
from openedx.features.content_type_gating.models import ContentTypeGatingConfig # lint-amnesty, pylint: disable=unused-import
from common.djangoapps.student.models import CourseEnrollment
from common.djangoapps.util.milestones_helpers import get_course_content_milestones
from xmodule.course_module import COURSE_VISIBILITY_PUBLIC
@@ -52,7 +40,6 @@ class CourseOutlineFragmentView(EdxFragmentView):
Renders the course outline as a fragment.
"""
from lms.urls import RESET_COURSE_DEADLINES_NAME
from openedx.features.course_experience.urls import COURSE_HOME_VIEW_NAME # lint-amnesty, pylint: disable=unused-import
course_key = CourseKey.from_string(course_id)
course_overview = get_course_overview_with_access(

View File

@@ -2,7 +2,7 @@
Enterprise support admin views.
"""
from django.contrib import admin, messages # lint-amnesty, pylint: disable=unused-import
from django.contrib import messages
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.views.generic.edit import FormView

View File

@@ -8,7 +8,6 @@ from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.shortcuts import redirect, render
from django.urls import reverse
from django.utils.translation import ugettext as _ # lint-amnesty, pylint: disable=unused-import
from django.views.decorators.http import require_http_methods
from django_countries import countries
@@ -20,7 +19,6 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
from openedx.core.djangoapps.user_api.errors import UserNotAuthorized, UserNotFound
from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences
from openedx.core.djangolib.markup import HTML, Text # lint-amnesty, pylint: disable=unused-import
from openedx.features.learner_profile.toggles import should_redirect_to_profile_microfrontend
from openedx.features.learner_profile.views.learner_achievements import LearnerAchievementsFragmentView
from common.djangoapps.student.models import User

View File

@@ -3,9 +3,6 @@ FieldOverride that forces Show Answer values that use Past Due logic to
new Show Answer values that remove the Past Due check (keeping the rest intact)
"""
from django.conf import settings # lint-amnesty, pylint: disable=unused-import
from common.lib.xmodule.xmodule.capa_base import SHOWANSWER
from lms.djangoapps.courseware.field_overrides import FieldOverrideProvider
from openedx.features.course_experience import RELATIVE_DATES_FLAG

View File

@@ -2,13 +2,9 @@
Minimal Django settings for tests of common/lib.
Required in Django 1.9+ due to imports of models in stock Django apps.
"""
import sys # lint-amnesty, pylint: disable=unused-import
import tempfile
from django.utils.translation import ugettext_lazy as _
from path import Path # lint-amnesty, pylint: disable=unused-import
ALL_LANGUAGES = []