diff --git a/openedx/features/course_bookmarks/plugins.py b/openedx/features/course_bookmarks/plugins.py index 7acf0e5e5d..c93d6f8d61 100644 --- a/openedx/features/course_bookmarks/plugins.py +++ b/openedx/features/course_bookmarks/plugins.py @@ -32,14 +32,14 @@ class CourseBookmarksTool(CourseTool): return CourseEnrollment.is_enrolled(request.user, course_key) @classmethod - def title(cls): + def title(cls): # lint-amnesty, pylint: disable=arguments-differ """ Returns the title of this tool. """ return _('Bookmarks') @classmethod - def icon_classes(cls): + def icon_classes(cls): # lint-amnesty, pylint: disable=arguments-differ """ Returns the icon classes needed to represent this tool. """ diff --git a/openedx/features/course_bookmarks/views/course_bookmarks.py b/openedx/features/course_bookmarks/views/course_bookmarks.py index 3a3c740e5b..25b0783d43 100644 --- a/openedx/features/course_bookmarks/views/course_bookmarks.py +++ b/openedx/features/course_bookmarks/views/course_bookmarks.py @@ -66,7 +66,7 @@ class CourseBookmarksFragmentView(EdxFragmentView): Fragment view that shows a user's bookmarks for a course. """ - def render_to_fragment(self, request, course_id=None, **kwargs): + def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Renders the user's course bookmarks as a fragment. """ diff --git a/openedx/features/course_duration_limits/access.py b/openedx/features/course_duration_limits/access.py index 31b9775eb1..0e498fcee7 100644 --- a/openedx/features/course_duration_limits/access.py +++ b/openedx/features/course_duration_limits/access.py @@ -42,7 +42,7 @@ class AuditExpiredError(AccessError): ' for expired on {expiration_date}').format( expiration_date=expiration_date ) - super(AuditExpiredError, self).__init__(error_code, developer_message, user_message, + super(AuditExpiredError, self).__init__(error_code, developer_message, user_message, # lint-amnesty, pylint: disable=super-with-arguments additional_context_user_message) diff --git a/openedx/features/course_duration_limits/tests/test_access.py b/openedx/features/course_duration_limits/tests/test_access.py index d6139f9785..89f2ab56da 100644 --- a/openedx/features/course_duration_limits/tests/test_access.py +++ b/openedx/features/course_duration_limits/tests/test_access.py @@ -32,12 +32,12 @@ from common.djangoapps.util.date_utils import strftime_localized class TestAccess(CacheIsolationTestCase): """Tests of openedx.features.course_duration_limits.access""" def setUp(self): - super(TestAccess, self).setUp() + super(TestAccess, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments CourseDurationLimitConfig.objects.create(enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=UTC)) DynamicUpgradeDeadlineConfiguration.objects.create(enabled=True) - def assertDateInMessage(self, date, message): + def assertDateInMessage(self, date, message): # lint-amnesty, pylint: disable=missing-function-docstring # First, check that the formatted version is in there self.assertIn(strftime_localized(date, 'SHORT_DATE'), message) diff --git a/openedx/features/course_duration_limits/tests/test_course_expiration.py b/openedx/features/course_duration_limits/tests/test_course_expiration.py index 00cc1724c1..0324182fed 100644 --- a/openedx/features/course_duration_limits/tests/test_course_expiration.py +++ b/openedx/features/course_duration_limits/tests/test_course_expiration.py @@ -48,7 +48,7 @@ from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin): """Tests to verify the get_user_course_expiration_date function is working correctly""" def setUp(self): - super(CourseExpirationTestCase, self).setUp() + super(CourseExpirationTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory( start=now() - timedelta(weeks=10), ) @@ -61,7 +61,7 @@ class CourseExpirationTestCase(ModuleStoreTestCase, MasqueradeMixin): def tearDown(self): CourseEnrollment.unenroll(self.user, self.course.id) - super(CourseExpirationTestCase, self).tearDown() + super(CourseExpirationTestCase, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments def test_enrollment_mode(self): """Tests that verified enrollments do not have an expiration""" diff --git a/openedx/features/course_duration_limits/tests/test_models.py b/openedx/features/course_duration_limits/tests/test_models.py index 5294129278..4e72e4a580 100644 --- a/openedx/features/course_duration_limits/tests/test_models.py +++ b/openedx/features/course_duration_limits/tests/test_models.py @@ -35,7 +35,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): CourseModeFactory.create(course_id=self.course_overview.id, mode_slug='audit') CourseModeFactory.create(course_id=self.course_overview.id, mode_slug='verified') self.user = UserFactory.create() - super(TestCourseDurationLimitConfig, self).setUp() + super(TestCourseDurationLimitConfig, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments @ddt.data( (True, True), @@ -64,7 +64,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): ) if already_enrolled: - existing_enrollment = CourseEnrollmentFactory.create( + existing_enrollment = CourseEnrollmentFactory.create( # lint-amnesty, pylint: disable=unused-variable user=self.user, course=self.course_overview, ) @@ -72,7 +72,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): existing_enrollment = None user = self.user - course_key = self.course_overview.id + course_key = self.course_overview.id # lint-amnesty, pylint: disable=unused-variable query_count = 7 @@ -182,7 +182,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): def test_all_current_course_configs(self): # Set up test objects for global_setting in (True, False, None): - CourseDurationLimitConfig.objects.create(enabled=global_setting, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) + CourseDurationLimitConfig.objects.create(enabled=global_setting, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) # lint-amnesty, pylint: disable=line-too-long for site_setting in (True, False, None): test_site_cfg = SiteConfigurationFactory.create( site_values={'course_org_filter': []} @@ -206,7 +206,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): id=CourseLocator(test_org, 'test_course', 'run-{}'.format(course_setting)) ) CourseDurationLimitConfig.objects.create( - course=test_course, enabled=course_setting, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC) + course=test_course, enabled=course_setting, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC) # lint-amnesty, pylint: disable=line-too-long ) with self.assertNumQueries(4): @@ -267,7 +267,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): def test_caching_site(self): site_cfg = SiteConfigurationFactory() - site_config = CourseDurationLimitConfig(site=site_cfg.site, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) + site_config = CourseDurationLimitConfig(site=site_cfg.site, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) # lint-amnesty, pylint: disable=line-too-long site_config.save() RequestCache.clear_all_namespaces() @@ -305,7 +305,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): site_cfg = SiteConfigurationFactory.create( site_values={'course_org_filter': course.org} ) - org_config = CourseDurationLimitConfig(org=course.org, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) + org_config = CourseDurationLimitConfig(org=course.org, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) # lint-amnesty, pylint: disable=line-too-long org_config.save() RequestCache.clear_all_namespaces() @@ -338,7 +338,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): with self.assertNumQueries(0): self.assertFalse(CourseDurationLimitConfig.current(org=course.org).enabled) - site_config = CourseDurationLimitConfig(site=site_cfg.site, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) + site_config = CourseDurationLimitConfig(site=site_cfg.site, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) # lint-amnesty, pylint: disable=line-too-long site_config.save() RequestCache.clear_all_namespaces() @@ -352,7 +352,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): site_cfg = SiteConfigurationFactory.create( site_values={'course_org_filter': course.org} ) - course_config = CourseDurationLimitConfig(course=course, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) + course_config = CourseDurationLimitConfig(course=course, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) # lint-amnesty, pylint: disable=line-too-long course_config.save() RequestCache.clear_all_namespaces() @@ -385,7 +385,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): with self.assertNumQueries(0): self.assertFalse(CourseDurationLimitConfig.current(course_key=course.id).enabled) - site_config = CourseDurationLimitConfig(site=site_cfg.site, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) + site_config = CourseDurationLimitConfig(site=site_cfg.site, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) # lint-amnesty, pylint: disable=line-too-long site_config.save() RequestCache.clear_all_namespaces() @@ -394,7 +394,7 @@ class TestCourseDurationLimitConfig(CacheIsolationTestCase): with self.assertNumQueries(0): self.assertFalse(CourseDurationLimitConfig.current(course_key=course.id).enabled) - org_config = CourseDurationLimitConfig(org=course.org, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) + org_config = CourseDurationLimitConfig(org=course.org, enabled=True, enabled_as_of=datetime(2018, 1, 1, tzinfo=pytz.UTC)) # lint-amnesty, pylint: disable=line-too-long org_config.save() RequestCache.clear_all_namespaces() diff --git a/openedx/features/course_experience/__init__.py b/openedx/features/course_experience/__init__.py index 3f720cb503..01f6b53bd0 100644 --- a/openedx/features/course_experience/__init__.py +++ b/openedx/features/course_experience/__init__.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Unified course experience settings and helper methods. """ import crum diff --git a/openedx/features/course_experience/api/v1/serializers.py b/openedx/features/course_experience/api/v1/serializers.py index 75ac290eeb..ded6b05349 100644 --- a/openedx/features/course_experience/api/v1/serializers.py +++ b/openedx/features/course_experience/api/v1/serializers.py @@ -9,10 +9,10 @@ from lms.djangoapps.course_home_api.mixins import DatesBannerSerializerMixin from openedx.core.djangoapps.content.course_overviews.models import CourseOverview -class CourseDeadlinesMobileSerializer(DatesBannerSerializerMixin): +class CourseDeadlinesMobileSerializer(DatesBannerSerializerMixin): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring has_ended = serializers.SerializerMethodField() - def get_has_ended(self, _): + def get_has_ended(self, _): # lint-amnesty, pylint: disable=missing-function-docstring course_key_string = self.context['view'].kwargs.get('course_key_string') course_key = CourseKey.from_string(course_key_string) course = CourseOverview.get_from_id(course_key) diff --git a/openedx/features/course_experience/api/v1/views.py b/openedx/features/course_experience/api/v1/views.py index 2e4a34b1b1..8078bcda84 100644 --- a/openedx/features/course_experience/api/v1/views.py +++ b/openedx/features/course_experience/api/v1/views.py @@ -104,7 +104,7 @@ def reset_course_deadlines(request): }) except Exception as e: log.exception(e) - raise UnableToResetDeadlines + raise UnableToResetDeadlines # lint-amnesty, pylint: disable=raise-missing-from class CourseDeadlinesMobileView(RetrieveAPIView): diff --git a/openedx/features/course_experience/course_tools.py b/openedx/features/course_experience/course_tools.py index 7f67b8fa54..896b5eecd6 100644 --- a/openedx/features/course_experience/course_tools.py +++ b/openedx/features/course_experience/course_tools.py @@ -41,7 +41,7 @@ class CourseTool(object): raise NotImplementedError("Must specify an id to enable course tool eventing.") @classmethod - def is_enabled(cls, request, course_key): + def is_enabled(cls, request, course_key): # lint-amnesty, pylint: disable=unused-argument """ Returns true if this tool is enabled for the specified course key. """ diff --git a/openedx/features/course_experience/plugins.py b/openedx/features/course_experience/plugins.py index da4b78c7b3..cb44171d35 100644 --- a/openedx/features/course_experience/plugins.py +++ b/openedx/features/course_experience/plugins.py @@ -28,14 +28,14 @@ class CourseUpdatesTool(CourseTool): return 'edx.updates' @classmethod - def title(cls): + def title(cls): # lint-amnesty, pylint: disable=arguments-differ """ Returns the title of this tool. """ return _('Updates') @classmethod - def icon_classes(cls): + def icon_classes(cls): # lint-amnesty, pylint: disable=arguments-differ """ Returns icon classes needed to represent this tool. """ diff --git a/openedx/features/course_experience/tests/views/test_course_dates.py b/openedx/features/course_experience/tests/views/test_course_dates.py index 5bd34bb872..ef27c0eac9 100644 --- a/openedx/features/course_experience/tests/views/test_course_dates.py +++ b/openedx/features/course_experience/tests/views/test_course_dates.py @@ -20,7 +20,7 @@ class TestCourseDatesFragmentView(ModuleStoreTestCase): """Tests for the course dates fragment view.""" def setUp(self): - super(TestCourseDatesFragmentView, self).setUp() + super(TestCourseDatesFragmentView, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments with self.store.default_store(ModuleStoreEnum.Type.split): self.course = CourseFactory.create( org='edX', diff --git a/openedx/features/course_experience/tests/views/test_course_home.py b/openedx/features/course_experience/tests/views/test_course_home.py index 04f45d079c..367660dab5 100644 --- a/openedx/features/course_experience/tests/views/test_course_home.py +++ b/openedx/features/course_experience/tests/views/test_course_home.py @@ -166,7 +166,7 @@ class CourseHomePageTestCase(BaseCourseUpdatesTestCase): ) -class TestCourseHomePage(CourseHomePageTestCase): +class TestCourseHomePage(CourseHomePageTestCase): # lint-amnesty, pylint: disable=missing-class-docstring def test_welcome_message_when_unified(self): # Create a welcome message self.create_course_update(TEST_WELCOME_MESSAGE) @@ -888,7 +888,7 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase): CREATE_USER = False def setUp(self): - super(CourseHomeFragmentViewTests, self).setUp() + super(CourseHomeFragmentViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments CommerceConfiguration.objects.create(checkout_on_ecommerce_service=True) end = now() + timedelta(days=30) @@ -899,9 +899,9 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase): ) self.url = course_home_url(self.course) - CourseMode.objects.create(course_id=self.course.id, mode_slug=CourseMode.AUDIT) + CourseMode.objects.create(course_id=self.course.id, mode_slug=CourseMode.AUDIT) # lint-amnesty, pylint: disable=no-member self.verified_mode = CourseMode.objects.create( - course_id=self.course.id, + course_id=self.course.id, # lint-amnesty, pylint: disable=no-member mode_slug=CourseMode.VERIFIED, min_price=100, expiration_datetime=end, @@ -919,7 +919,7 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase): response = self.client.get(self.url) self.assertNotContains(response, 'section-upgrade') - def assert_upgrade_message_displayed(self): + def assert_upgrade_message_displayed(self): # lint-amnesty, pylint: disable=missing-function-docstring response = self.client.get(self.url) self.assertContains(response, 'section-upgrade') url = EcommerceService().get_checkout_page_url(self.verified_mode.sku) @@ -939,7 +939,7 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase): self.assert_upgrade_message_not_displayed() def test_no_upgrade_message_if_verified_track(self): - CourseEnrollment.enroll(self.user, self.course.id, CourseMode.VERIFIED) + CourseEnrollment.enroll(self.user, self.course.id, CourseMode.VERIFIED) # lint-amnesty, pylint: disable=no-member self.assert_upgrade_message_not_displayed() def test_no_upgrade_message_if_upgrade_deadline_passed(self): @@ -950,11 +950,11 @@ class CourseHomeFragmentViewTests(ModuleStoreTestCase): def test_no_upgrade_message_if_flag_disabled(self): self.flag.everyone = False self.flag.save() - CourseEnrollment.enroll(self.user, self.course.id, CourseMode.AUDIT) + CourseEnrollment.enroll(self.user, self.course.id, CourseMode.AUDIT) # lint-amnesty, pylint: disable=no-member self.assert_upgrade_message_not_displayed() def test_display_upgrade_message_if_audit_and_deadline_not_passed(self): - CourseEnrollment.enroll(self.user, self.course.id, CourseMode.AUDIT) + CourseEnrollment.enroll(self.user, self.course.id, CourseMode.AUDIT) # lint-amnesty, pylint: disable=no-member self.assert_upgrade_message_displayed() @mock.patch( diff --git a/openedx/features/course_experience/tests/views/test_course_outline.py b/openedx/features/course_experience/tests/views/test_course_outline.py index 838ecefa02..4f8e6123ff 100644 --- a/openedx/features/course_experience/tests/views/test_course_outline.py +++ b/openedx/features/course_experience/tests/views/test_course_outline.py @@ -64,7 +64,7 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase, MasqueradeMixin): ENABLED_SIGNALS = ['course_published'] @classmethod - def setUpClass(cls): + def setUpClass(cls): # lint-amnesty, pylint: disable=super-method-not-called """ Set up an array of various courses to be tested. """ @@ -77,7 +77,7 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase, MasqueradeMixin): course = CourseFactory.create(self_paced=True) with cls.store.bulk_operations(course.id): chapter = ItemFactory.create(category='chapter', parent_location=course.location) - sequential = ItemFactory.create(category='sequential', parent_location=chapter.location, graded=True, format="Homework") + sequential = ItemFactory.create(category='sequential', parent_location=chapter.location, graded=True, format="Homework") # lint-amnesty, pylint: disable=line-too-long vertical = ItemFactory.create(category='vertical', parent_location=sequential.location) problem = ItemFactory.create(category='problem', parent_location=vertical.location) course.children = [chapter] @@ -124,7 +124,7 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase, MasqueradeMixin): cls.courses.append(course) @classmethod - def setUpTestData(cls): + def setUpTestData(cls): # lint-amnesty, pylint: disable=super-method-not-called """Set up and enroll our fake user in the course.""" cls.user = UserFactory(password=TEST_PASSWORD) for course in cls.courses: @@ -138,7 +138,7 @@ class TestCourseOutlinePage(SharedModuleStoreTestCase, MasqueradeMixin): """ Set up for the tests. """ - super(TestCourseOutlinePage, self).setUp() + super(TestCourseOutlinePage, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.client.login(username=self.user.username, password=TEST_PASSWORD) @override_experiment_waffle_flag(RELATIVE_DATES_FLAG, active=True) @@ -308,7 +308,7 @@ class TestCourseOutlinePageWithPrerequisites(SharedModuleStoreTestCase, Mileston cls.course, cls.course_blocks = cls.create_test_course() @classmethod - def setUpTestData(cls): + def setUpTestData(cls): # lint-amnesty, pylint: disable=super-method-not-called """Set up and enroll our fake user in the course.""" cls.user = UserFactory(password=TEST_PASSWORD) CourseEnrollment.enroll(cls.user, cls.course.id) @@ -355,7 +355,7 @@ class TestCourseOutlinePageWithPrerequisites(SharedModuleStoreTestCase, Mileston """ Set up for the tests. """ - super(TestCourseOutlinePageWithPrerequisites, self).setUp() + super(TestCourseOutlinePageWithPrerequisites, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.client.login(username=self.user.username, password=TEST_PASSWORD) def setup_gated_section(self, gated_block, gating_block): @@ -457,7 +457,7 @@ class TestCourseOutlineResumeCourse(SharedModuleStoreTestCase, CompletionWaffleT cls.course = cls.create_test_course() @classmethod - def setUpTestData(cls): + def setUpTestData(cls): # lint-amnesty, pylint: disable=super-method-not-called """Set up and enroll our fake user in the course.""" cls.user = UserFactory(password=TEST_PASSWORD) CourseEnrollment.enroll(cls.user, cls.course.id) @@ -495,7 +495,7 @@ class TestCourseOutlineResumeCourse(SharedModuleStoreTestCase, CompletionWaffleT """ Set up for the tests. """ - super(TestCourseOutlineResumeCourse, self).setUp() + super(TestCourseOutlineResumeCourse, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.client.login(username=self.user.username, password=TEST_PASSWORD) def visit_sequential(self, course, chapter, sequential): diff --git a/openedx/features/course_experience/tests/views/test_course_sock.py b/openedx/features/course_experience/tests/views/test_course_sock.py index 6c11abb92a..1552999140 100644 --- a/openedx/features/course_experience/tests/views/test_course_sock.py +++ b/openedx/features/course_experience/tests/views/test_course_sock.py @@ -43,7 +43,7 @@ class TestCourseSockView(SharedModuleStoreTestCase): add_course_mode(cls.verified_course_already_enrolled, upgrade_deadline_expired=False) def setUp(self): - super(TestCourseSockView, self).setUp() + super(TestCourseSockView, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory.create() # Enroll the user in the four courses @@ -104,8 +104,8 @@ class TestCourseSockView(SharedModuleStoreTestCase): response = self.client.get(course_home_url(self.verified_course)) self.assertContains(response, "DISCOUNT_PRICE") - def assert_verified_sock_is_visible(self, course, response): + def assert_verified_sock_is_visible(self, course, response): # lint-amnesty, pylint: disable=unused-argument return self.assertContains(response, TEST_VERIFICATION_SOCK_LOCATOR, html=False) - def assert_verified_sock_is_not_visible(self, course, response): + def assert_verified_sock_is_not_visible(self, course, response): # lint-amnesty, pylint: disable=unused-argument return self.assertNotContains(response, TEST_VERIFICATION_SOCK_LOCATOR, html=False) diff --git a/openedx/features/course_experience/tests/views/test_masquerade.py b/openedx/features/course_experience/tests/views/test_masquerade.py index 20f9470c15..8fd2305616 100644 --- a/openedx/features/course_experience/tests/views/test_masquerade.py +++ b/openedx/features/course_experience/tests/views/test_masquerade.py @@ -37,7 +37,7 @@ class MasqueradeTestBase(SharedModuleStoreTestCase, MasqueradeMixin): add_course_mode(cls.masters_course, mode_slug='masters', mode_display_name='Masters') def setUp(self): - super(MasqueradeTestBase, self).setUp() + super(MasqueradeTestBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course_staff = UserFactory.create() CourseStaffRole(self.verified_course.id).add_users(self.course_staff) CourseStaffRole(self.masters_course.id).add_users(self.course_staff) diff --git a/openedx/features/course_experience/urls.py b/openedx/features/course_experience/urls.py index d785a76ab0..f550814c73 100644 --- a/openedx/features/course_experience/urls.py +++ b/openedx/features/course_experience/urls.py @@ -8,7 +8,7 @@ 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 +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 diff --git a/openedx/features/course_experience/utils.py b/openedx/features/course_experience/utils.py index 89ccf62a56..7fd85257b0 100644 --- a/openedx/features/course_experience/utils.py +++ b/openedx/features/course_experience/utils.py @@ -3,10 +3,10 @@ Common utilities for the course experience, including course outline. """ -from datetime import timedelta +from datetime import timedelta # lint-amnesty, pylint: disable=unused-import from completion.models import BlockCompletion -from django.db.models import Q +from django.db.models import Q # lint-amnesty, pylint: disable=unused-import from django.utils import timezone from opaque_keys.edx.keys import CourseKey from six.moves import range @@ -14,7 +14,7 @@ from six.moves import range from lms.djangoapps.course_api.blocks.api import get_blocks from lms.djangoapps.course_blocks.api import get_course_blocks from lms.djangoapps.course_blocks.utils import get_student_module_as_dict -from lms.djangoapps.courseware.access import has_access +from lms.djangoapps.courseware.access import has_access # lint-amnesty, pylint: disable=unused-import from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.lib.cache_utils import request_cached from openedx.features.course_experience import RELATIVE_DATES_FLAG @@ -23,7 +23,7 @@ from xmodule.modulestore.django import modulestore @request_cached() -def get_course_outline_block_tree(request, course_id, user=None, allow_start_dates_in_future=False): +def get_course_outline_block_tree(request, course_id, user=None, allow_start_dates_in_future=False): # lint-amnesty, pylint: disable=too-many-statements """ Returns the root block of the course outline, with children as blocks. diff --git a/openedx/features/course_experience/views/course_dates.py b/openedx/features/course_experience/views/course_dates.py index b2e8ae0b74..1bb7e122d3 100644 --- a/openedx/features/course_experience/views/course_dates.py +++ b/openedx/features/course_experience/views/course_dates.py @@ -25,7 +25,7 @@ class CourseDatesFragmentView(EdxFragmentView): """ template_name = 'course_experience/course-dates-fragment.html' - def render_to_fragment(self, request, course_id=None, **kwargs): + def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Render the course dates fragment. """ @@ -67,7 +67,7 @@ class CourseDatesFragmentMobileView(CourseDatesFragmentView): def get(self, request, *args, **kwargs): if not request.user.is_authenticated: raise Http404 - return super(CourseDatesFragmentMobileView, self).get(request, *args, **kwargs) + return super(CourseDatesFragmentMobileView, self).get(request, *args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments def css_dependencies(self): """ diff --git a/openedx/features/course_experience/views/course_home.py b/openedx/features/course_experience/views/course_home.py index 298013f3dc..b9187c13cb 100644 --- a/openedx/features/course_experience/views/course_home.py +++ b/openedx/features/course_experience/views/course_home.py @@ -63,13 +63,13 @@ class CourseHomeView(CourseTabView): @method_decorator(cache_control(no_cache=True, no_store=True, must_revalidate=True)) @method_decorator(ensure_valid_course_key) @method_decorator(add_maintenance_banner) - def get(self, request, course_id, **kwargs): + def get(self, request, course_id, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Displays the home page for the specified course. """ - return super(CourseHomeView, self).get(request, course_id, 'courseware', **kwargs) + return super(CourseHomeView, self).get(request, course_id, 'courseware', **kwargs) # lint-amnesty, pylint: disable=super-with-arguments - def render_to_fragment(self, request, course=None, tab=None, **kwargs): + def render_to_fragment(self, request, course=None, tab=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument course_id = six.text_type(course.id) if course_home_mfe_outline_tab_is_active(course.id) and not request.user.is_staff: microfrontend_url = get_microfrontend_url(course_key=course_id, view_name="home") @@ -113,7 +113,7 @@ class CourseHomeFragmentView(EdxFragmentView): return None return handouts - def render_to_fragment(self, request, course_id=None, **kwargs): + def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, too-many-statements """ Renders the course's home page as a fragment. """ diff --git a/openedx/features/course_experience/views/course_home_messages.py b/openedx/features/course_experience/views/course_home_messages.py index 5e2671ea93..3c3ec19130 100644 --- a/openedx/features/course_experience/views/course_home_messages.py +++ b/openedx/features/course_experience/views/course_home_messages.py @@ -51,7 +51,7 @@ class CourseHomeMessageFragmentView(EdxFragmentView): 'is_staff': True if the user is a staff member of the course, False otherwise } """ - def render_to_fragment(self, request, course_id, user_access, **kwargs): + def render_to_fragment(self, request, course_id, user_access, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Renders a course message fragment for the specified course. """ @@ -107,7 +107,7 @@ class CourseHomeMessageFragmentView(EdxFragmentView): return Fragment(html) -def _register_course_home_messages(request, course, user_access, course_start_data): +def _register_course_home_messages(request, course, user_access, course_start_data): # lint-amnesty, pylint: disable=unused-argument """ Register messages to be shown in the course home content page. """ @@ -209,7 +209,7 @@ def _register_course_goal_message(request, course): ).format( goal_key=goal_key, aria_label_choice=Text(_(u"Set goal to: {goal_text}")).format( - goal_text=Text(_(goal_text)) + goal_text=Text(_(goal_text)) # lint-amnesty, pylint: disable=translation-of-non-string ) ), goal_text=goal_text, diff --git a/openedx/features/course_experience/views/course_outline.py b/openedx/features/course_experience/views/course_outline.py index 8fa266117f..3b09fdd9a2 100644 --- a/openedx/features/course_experience/views/course_outline.py +++ b/openedx/features/course_experience/views/course_outline.py @@ -5,33 +5,33 @@ Views to show a course outline. import datetime import re -import six +import six # lint-amnesty, pylint: disable=unused-import from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH -from django.contrib.auth.models import User -from django.db.models import Q -from django.shortcuts import redirect +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 -from django.views.decorators.csrf import ensure_csrf_cookie +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 +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 -from openedx.core.djangoapps.content.course_overviews.models import CourseOverview +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 -from openedx.features.course_experience import RELATIVE_DATES_FLAG +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 +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 +52,7 @@ 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 + 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( diff --git a/openedx/features/course_experience/views/course_sock.py b/openedx/features/course_experience/views/course_sock.py index a095ad0481..af3221315d 100644 --- a/openedx/features/course_experience/views/course_sock.py +++ b/openedx/features/course_experience/views/course_sock.py @@ -18,7 +18,7 @@ class CourseSockFragmentView(EdxFragmentView): """ A fragment to provide extra functionality in a dropdown sock. """ - def render_to_fragment(self, request, course, **kwargs): + def render_to_fragment(self, request, course, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Render the course's sock fragment. """ @@ -27,7 +27,7 @@ class CourseSockFragmentView(EdxFragmentView): return Fragment(html) @staticmethod - def get_verification_context(request, course): + def get_verification_context(request, course): # lint-amnesty, pylint: disable=missing-function-docstring enrollment = CourseEnrollment.get_enrollment(request.user, course.id) show_course_sock = can_show_verified_upgrade(request.user, enrollment, course) if show_course_sock: diff --git a/openedx/features/course_experience/views/course_updates.py b/openedx/features/course_experience/views/course_updates.py index e6c78c4e17..7fa3acad65 100644 --- a/openedx/features/course_experience/views/course_updates.py +++ b/openedx/features/course_experience/views/course_updates.py @@ -25,13 +25,13 @@ class CourseUpdatesView(CourseTabView): """ @method_decorator(login_required) @method_decorator(cache_control(no_cache=True, no_store=True, must_revalidate=True)) - def get(self, request, course_id, **kwargs): + def get(self, request, course_id, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Displays the home page for the specified course. """ - return super(CourseUpdatesView, self).get(request, course_id, 'courseware', **kwargs) + return super(CourseUpdatesView, self).get(request, course_id, 'courseware', **kwargs) # lint-amnesty, pylint: disable=super-with-arguments - def render_to_fragment(self, request, course=None, tab=None, **kwargs): + def render_to_fragment(self, request, course=None, tab=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument course_id = six.text_type(course.id) updates_fragment_view = CourseUpdatesFragmentView() return updates_fragment_view.render_to_fragment(request, course_id=course_id, **kwargs) @@ -42,7 +42,7 @@ class CourseUpdatesFragmentView(EdxFragmentView): A fragment to render the updates page for a course. """ - def render_to_fragment(self, request, course_id=None, **kwargs): + def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Renders the course's home page as a fragment. """ @@ -69,11 +69,11 @@ class CourseUpdatesFragmentView(EdxFragmentView): return Fragment(html) @classmethod - def has_updates(self, request, course): + def has_updates(self, request, course): # lint-amnesty, pylint: disable=bad-classmethod-argument return len(get_ordered_updates(request, course)) > 0 @classmethod - def get_plain_html_updates(self, request, course): + def get_plain_html_updates(self, request, course): # lint-amnesty, pylint: disable=bad-classmethod-argument """ Returns any course updates in an html chunk. Used for older implementations and a few tests that store diff --git a/openedx/features/course_experience/views/latest_update.py b/openedx/features/course_experience/views/latest_update.py index 0fe5c3ce72..1da34faff6 100644 --- a/openedx/features/course_experience/views/latest_update.py +++ b/openedx/features/course_experience/views/latest_update.py @@ -22,7 +22,7 @@ class LatestUpdateFragmentView(EdxFragmentView): A fragment that displays the latest course update. """ - def render_to_fragment(self, request, course_id=None, **kwargs): + def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Renders the latest update message fragment for the specified course. diff --git a/openedx/features/course_experience/views/welcome_message.py b/openedx/features/course_experience/views/welcome_message.py index aad304201c..7ba05e0a36 100644 --- a/openedx/features/course_experience/views/welcome_message.py +++ b/openedx/features/course_experience/views/welcome_message.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=cyclic-import View logic for handling course welcome messages. """ @@ -23,7 +23,7 @@ class WelcomeMessageFragmentView(EdxFragmentView): A fragment that displays a course's welcome message. """ - def render_to_fragment(self, request, course_id=None, **kwargs): + def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ """ Renders the welcome message fragment for the specified course.