BOM-2284
Apply pylint-amnesty.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""
|
||||
""" # lint-amnesty, pylint: disable=django-not-configured
|
||||
Mobile API
|
||||
"""
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 == "<ol></ol>":
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""
|
||||
""" # lint-amnesty, pylint: disable=django-not-configured
|
||||
LMS specific monitoring helpers.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user