From 07599e930c3d5db39948ecf050001ef0d95ac2d5 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Tue, 2 Feb 2021 11:37:56 +0500 Subject: [PATCH] BOM-2284 Apply pylint-amnesty. --- .../commands/mailchimp_sync_announcements.py | 2 +- lms/djangoapps/mobile_api/__init__.py | 2 +- lms/djangoapps/mobile_api/course_info/tests.py | 2 +- lms/djangoapps/mobile_api/course_info/views.py | 4 ++-- lms/djangoapps/mobile_api/decorators.py | 2 +- lms/djangoapps/mobile_api/models.py | 4 ++-- lms/djangoapps/mobile_api/tests/test_decorator.py | 2 +- lms/djangoapps/mobile_api/tests/test_middleware.py | 2 +- .../mobile_api/tests/test_mobile_platform.py | 6 +++--- lms/djangoapps/mobile_api/testutils.py | 4 ++-- lms/djangoapps/mobile_api/users/serializers.py | 4 ++-- lms/djangoapps/mobile_api/users/tests.py | 10 +++++----- lms/djangoapps/mobile_api/users/views.py | 12 ++++++------ lms/djangoapps/monitoring/__init__.py | 2 +- 14 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lms/djangoapps/mailing/management/commands/mailchimp_sync_announcements.py b/lms/djangoapps/mailing/management/commands/mailchimp_sync_announcements.py index b1691e2885..0469874cc9 100644 --- a/lms/djangoapps/mailing/management/commands/mailchimp_sync_announcements.py +++ b/lms/djangoapps/mailing/management/commands/mailchimp_sync_announcements.py @@ -5,7 +5,7 @@ Synchronizes the announcement list with all active students. import logging -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core.management.base import BaseCommand from .mailchimp_sync_course import connect_mailchimp, get_cleaned, get_subscribed, get_unsubscribed, subscribe_with_data diff --git a/lms/djangoapps/mobile_api/__init__.py b/lms/djangoapps/mobile_api/__init__.py index 0cb2d33a89..d419cba73a 100644 --- a/lms/djangoapps/mobile_api/__init__.py +++ b/lms/djangoapps/mobile_api/__init__.py @@ -1,3 +1,3 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured Mobile API """ diff --git a/lms/djangoapps/mobile_api/course_info/tests.py b/lms/djangoapps/mobile_api/course_info/tests.py index c378f1aa84..6055f324ad 100644 --- a/lms/djangoapps/mobile_api/course_info/tests.py +++ b/lms/djangoapps/mobile_api/course_info/tests.py @@ -24,7 +24,7 @@ class TestUpdates(MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTest REVERSE_INFO = {'name': 'course-updates-list', 'params': ['course_id', 'api_version']} def verify_success(self, response): - super(TestUpdates, self).verify_success(response) + super(TestUpdates, self).verify_success(response) # lint-amnesty, pylint: disable=super-with-arguments self.assertEqual(response.data, []) @ddt.data( diff --git a/lms/djangoapps/mobile_api/course_info/views.py b/lms/djangoapps/mobile_api/course_info/views.py index 835099a75d..175889515c 100644 --- a/lms/djangoapps/mobile_api/course_info/views.py +++ b/lms/djangoapps/mobile_api/course_info/views.py @@ -37,7 +37,7 @@ class CourseUpdatesList(generics.ListAPIView): """ @mobile_course_access() - def list(self, request, course, *args, **kwargs): + def list(self, request, course, *args, **kwargs): # lint-amnesty, pylint: disable=arguments-differ course_updates_module = get_course_info_section_module(request, request.user, course, 'updates') update_items = get_course_update_items(course_updates_module) @@ -72,7 +72,7 @@ class CourseHandoutsList(generics.ListAPIView): """ @mobile_course_access() - def list(self, request, course, *args, **kwargs): + def list(self, request, course, *args, **kwargs): # lint-amnesty, pylint: disable=arguments-differ course_handouts_module = get_course_info_section_module(request, request.user, course, 'handouts') if course_handouts_module: if course_handouts_module.data == "
    ": diff --git a/lms/djangoapps/mobile_api/decorators.py b/lms/djangoapps/mobile_api/decorators.py index a3b1a95281..7ebdce4f05 100644 --- a/lms/djangoapps/mobile_api/decorators.py +++ b/lms/djangoapps/mobile_api/decorators.py @@ -49,7 +49,7 @@ def mobile_course_access(depth=0): if error.access_error is not None: return Response(data=error.access_error.to_json(), status=status.HTTP_404_NOT_FOUND) # Raise a 404 if the user does not have course access - raise Http404 + raise Http404 # lint-amnesty, pylint: disable=raise-missing-from return func(self, request, course=course, *args, **kwargs) return _wrapper diff --git a/lms/djangoapps/mobile_api/models.py b/lms/djangoapps/mobile_api/models.py index 8fe88fc9d1..4e423cc0db 100644 --- a/lms/djangoapps/mobile_api/models.py +++ b/lms/djangoapps/mobile_api/models.py @@ -85,10 +85,10 @@ class AppVersionConfig(models.Model): if utils.parsed_version(config.version) >= parsed_version: return config.expire_at - def save(self, *args, **kwargs): + def save(self, *args, **kwargs): # lint-amnesty, pylint: disable=signature-differs """ parses version into major, minor and patch versions before saving """ self.major_version, self.minor_version, self.patch_version = utils.parsed_version(self.version) - super(AppVersionConfig, self).save(*args, **kwargs) + super(AppVersionConfig, self).save(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments class IgnoreMobileAvailableFlagConfig(ConfigurationModel): diff --git a/lms/djangoapps/mobile_api/tests/test_decorator.py b/lms/djangoapps/mobile_api/tests/test_decorator.py index fb2c5cf3c6..40d6b0ca6d 100644 --- a/lms/djangoapps/mobile_api/tests/test_decorator.py +++ b/lms/djangoapps/mobile_api/tests/test_decorator.py @@ -23,7 +23,7 @@ class TestMobileAPIDecorators(TestCase): """ Test docstring of decorated function. """ - pass + pass # lint-amnesty, pylint: disable=unnecessary-pass self.assertIn("Test docstring of decorated function.", decorated_func.__doc__) self.assertEqual(decorated_func.__name__, "decorated_func") diff --git a/lms/djangoapps/mobile_api/tests/test_middleware.py b/lms/djangoapps/mobile_api/tests/test_middleware.py index 3cdd98bbe0..a88c7ba666 100644 --- a/lms/djangoapps/mobile_api/tests/test_middleware.py +++ b/lms/djangoapps/mobile_api/tests/test_middleware.py @@ -25,7 +25,7 @@ class TestAppVersionUpgradeMiddleware(CacheIsolationTestCase): ENABLED_CACHES = ['default'] def setUp(self): - super(TestAppVersionUpgradeMiddleware, self).setUp() + super(TestAppVersionUpgradeMiddleware, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.middleware = AppVersionUpgrade() self.set_app_version_config() diff --git a/lms/djangoapps/mobile_api/tests/test_mobile_platform.py b/lms/djangoapps/mobile_api/tests/test_mobile_platform.py index 63364e8ff6..2028c95c94 100644 --- a/lms/djangoapps/mobile_api/tests/test_mobile_platform.py +++ b/lms/djangoapps/mobile_api/tests/test_mobile_platform.py @@ -24,9 +24,9 @@ class TestMobilePlatform(TestCase): ("edX/org.test-domain.mobile (0.1.5; OS Version 9.2 (Build 13C75))", "iOS", "0.1.5"), ("Dalvik/2.1.0 (Linux; U; Android 5.1; Nexus 5 Build/LMY47I) edX/org.edx.mobile/1.1.1", "Android", "1.1.1"), ("Dalvik/2.1.0 (Linux; U; Android 5.1; Nexus 5 Build/LMY47I) edX/org.edx.mobile/3.3.3.X", "Android", "3.3.3.X"), - ("Dalvik/2.1.0 (Linux; U; Android 9; MI 6 MIUI/V11.0.3.0.PCAMIXM) edX/org.edx.mobile/2.17.1", "Android", "2.17.1"), - ("Dalvik/2.1.0 (Linux; U; Android 9; JKM-AL00a Build/HUAWEIJKM-AL00a) edX/org.edx.mobile/2.8.1", "Android", "2.8.1"), - ("Dalvik/2.1.0 (Linux; U; Android 8.1.0; CPH1803 Build/OPM1.171019.026) edX/org.edx.mobile/2.18.1", "Android", "2.18.1"), + ("Dalvik/2.1.0 (Linux; U; Android 9; MI 6 MIUI/V11.0.3.0.PCAMIXM) edX/org.edx.mobile/2.17.1", "Android", "2.17.1"), # lint-amnesty, pylint: disable=line-too-long + ("Dalvik/2.1.0 (Linux; U; Android 9; JKM-AL00a Build/HUAWEIJKM-AL00a) edX/org.edx.mobile/2.8.1", "Android", "2.8.1"), # lint-amnesty, pylint: disable=line-too-long + ("Dalvik/2.1.0 (Linux; U; Android 8.1.0; CPH1803 Build/OPM1.171019.026) edX/org.edx.mobile/2.18.1", "Android", "2.18.1"), # lint-amnesty, pylint: disable=line-too-long ) @ddt.unpack def test_platform_instance(self, user_agent, platform_name, version): diff --git a/lms/djangoapps/mobile_api/testutils.py b/lms/djangoapps/mobile_api/testutils.py index f344e5b3a2..820672d1df 100644 --- a/lms/djangoapps/mobile_api/testutils.py +++ b/lms/djangoapps/mobile_api/testutils.py @@ -43,7 +43,7 @@ class MobileAPITestCase(ModuleStoreTestCase, APITestCase): They may also override any of the methods defined in this class to control the behavior of the TestMixins. """ def setUp(self): - super(MobileAPITestCase, self).setUp() + super(MobileAPITestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create( mobile_available=True, static_asset_path="needed_for_split", @@ -57,7 +57,7 @@ class MobileAPITestCase(ModuleStoreTestCase, APITestCase): IgnoreMobileAvailableFlagConfig(enabled=False).save() def tearDown(self): - super(MobileAPITestCase, self).tearDown() + super(MobileAPITestCase, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments self.logout() def login(self): diff --git a/lms/djangoapps/mobile_api/users/serializers.py b/lms/djangoapps/mobile_api/users/serializers.py index 8b351b1ee0..b774379975 100644 --- a/lms/djangoapps/mobile_api/users/serializers.py +++ b/lms/djangoapps/mobile_api/users/serializers.py @@ -14,11 +14,11 @@ from common.djangoapps.student.models import CourseEnrollment, User from common.djangoapps.util.course import get_encoded_course_sharing_utm_params, get_link_for_about_page -class CourseOverviewField(serializers.RelatedField): +class CourseOverviewField(serializers.RelatedField): # lint-amnesty, pylint: disable=abstract-method """ Custom field to wrap a CourseOverview object. Read-only. """ - def to_representation(self, course_overview): + def to_representation(self, course_overview): # lint-amnesty, pylint: disable=arguments-differ course_id = six.text_type(course_overview.id) request = self.context.get('request') api_version = self.context.get('api_version') diff --git a/lms/djangoapps/mobile_api/users/tests.py b/lms/djangoapps/mobile_api/users/tests.py index 5430aa1ef5..b7a9073de2 100644 --- a/lms/djangoapps/mobile_api/users/tests.py +++ b/lms/djangoapps/mobile_api/users/tests.py @@ -118,13 +118,13 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest @patch.dict(settings.FEATURES, {"ENABLE_DISCUSSION_SERVICE": True}) def setUp(self): - super(TestUserEnrollmentApi, self).setUp() + super(TestUserEnrollmentApi, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments def verify_success(self, response): """ Verifies user course enrollment response for success """ - super(TestUserEnrollmentApi, self).verify_success(response) + super(TestUserEnrollmentApi, self).verify_success(response) # lint-amnesty, pylint: disable=super-with-arguments courses = response.data self.assertEqual(len(courses), 1) @@ -299,7 +299,7 @@ class TestUserEnrollmentApi(UrlResetMixin, MobileAPITestCase, MobileAuthUserTest self.create_enrollment(expired) return self.api_response(api_version=api_version).data - def _assert_enrollment_results(self, api_version, courses, num_courses_returned, gating_enabled=True): + def _assert_enrollment_results(self, api_version, courses, num_courses_returned, gating_enabled=True): # lint-amnesty, pylint: disable=missing-function-docstring self.assertEqual(len(courses), num_courses_returned) if api_version == API_V05: @@ -425,7 +425,7 @@ class CourseStatusAPITestCase(MobileAPITestCase): """ Creates a basic course structure for our course """ - super(CourseStatusAPITestCase, self).setUp() + super(CourseStatusAPITestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.section = ItemFactory.create( parent=self.course, @@ -591,7 +591,7 @@ class TestCourseEnrollmentSerializer(MobileAPITestCase, MilestonesTestCaseMixin) ENABLED_SIGNALS = ['course_published'] def setUp(self): - super(TestCourseEnrollmentSerializer, self).setUp() + super(TestCourseEnrollmentSerializer, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.login_and_enroll() self.request = RequestFactory().get('/') self.request.user = self.user diff --git a/lms/djangoapps/mobile_api/users/views.py b/lms/djangoapps/mobile_api/users/views.py index 96bea4ec66..7fec2ebc19 100644 --- a/lms/djangoapps/mobile_api/users/views.py +++ b/lms/djangoapps/mobile_api/users/views.py @@ -16,7 +16,7 @@ from rest_framework.decorators import api_view from rest_framework.response import Response from xblock.fields import Scope from xblock.runtime import KeyValueStore -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from lms.djangoapps.courseware.access import is_mobile_available_for_user from lms.djangoapps.courseware.courses import get_current_child @@ -26,7 +26,7 @@ from lms.djangoapps.courseware.views.index import save_positions_recursively_up from lms.djangoapps.courseware.access_utils import ACCESS_GRANTED from lms.djangoapps.mobile_api.utils import API_V05, API_V1 from openedx.features.course_duration_limits.access import check_course_expired -from common.djangoapps.student.models import CourseEnrollment, User +from common.djangoapps.student.models import CourseEnrollment, User # lint-amnesty, pylint: disable=reimported from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError @@ -72,7 +72,7 @@ class UserDetail(generics.RetrieveAPIView): lookup_field = 'username' def get_serializer_context(self): - context = super(UserDetail, self).get_serializer_context() + context = super(UserDetail, self).get_serializer_context() # lint-amnesty, pylint: disable=super-with-arguments context['api_version'] = self.kwargs.get('api_version') return context @@ -188,7 +188,7 @@ class UserCourseStatus(views.APIView): return self._get_course_info(request, course) @mobile_course_access(depth=2) - def get(self, request, course, *args, **kwargs): + def get(self, request, course, *args, **kwargs): # lint-amnesty, pylint: disable=unused-argument """ Get the ID of the module that the specified user last visited in the specified course. """ @@ -207,7 +207,7 @@ class UserCourseStatus(views.APIView): return user_course_status @mobile_course_access(depth=2) - def patch(self, request, course, *args, **kwargs): + def patch(self, request, course, *args, **kwargs): # lint-amnesty, pylint: disable=unused-argument """ Update the ID of the module that the specified user last visited in the specified course. """ @@ -312,7 +312,7 @@ class UserCourseEnrollmentsList(generics.ListAPIView): return check_org is None or (check_org.lower() == course_org.lower()) def get_serializer_context(self): - context = super(UserCourseEnrollmentsList, self).get_serializer_context() + context = super(UserCourseEnrollmentsList, self).get_serializer_context() # lint-amnesty, pylint: disable=super-with-arguments context['api_version'] = self.kwargs.get('api_version') return context diff --git a/lms/djangoapps/monitoring/__init__.py b/lms/djangoapps/monitoring/__init__.py index 89f1b2b547..f9e3afe6f7 100644 --- a/lms/djangoapps/monitoring/__init__.py +++ b/lms/djangoapps/monitoring/__init__.py @@ -1,3 +1,3 @@ -""" +""" # lint-amnesty, pylint: disable=django-not-configured LMS specific monitoring helpers. """