From f54fe787c6fcd50839b41703cb04572391d68d85 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 3 Aug 2015 16:59:57 -0400 Subject: [PATCH] Remove needless 'disable=no-member' pragmas --- .../contentstore/tests/test_contentstore.py | 4 +- .../contentstore/tests/test_import.py | 1 - .../tests/test_users_default_role.py | 14 ++--- cms/djangoapps/contentstore/tests/utils.py | 1 - cms/djangoapps/contentstore/utils.py | 1 - .../contentstore/views/certificates.py | 2 +- cms/djangoapps/contentstore/views/course.py | 2 +- .../views/tests/test_certificates.py | 1 - .../views/tests/test_group_configurations.py | 3 - .../views/tests/test_import_export.py | 2 - cms/lib/xblock/test/test_authoring_mixin.py | 2 +- common/djangoapps/enrollment/data.py | 6 +- common/djangoapps/enrollment/serializers.py | 2 +- .../tests/test_transfer_students.py | 4 +- common/djangoapps/student/models.py | 2 +- common/djangoapps/student/tests/tests.py | 2 +- .../tests/test_pipeline_integration.py | 8 +-- .../third_party_auth/tests/test_provider.py | 2 - .../djangoapps/track/tests/test_contexts.py | 2 +- common/djangoapps/util/file.py | 2 +- .../xmodule/xmodule/assetstore/__init__.py | 4 +- common/lib/xmodule/xmodule/capa_base.py | 2 - common/lib/xmodule/xmodule/capa_module.py | 2 +- .../xmodule/xmodule/library_content_module.py | 1 - .../xmodule/xmodule/library_root_xblock.py | 2 +- .../xmodule/modulestore/split_mongo/split.py | 2 - .../tests/test_mixed_modulestore.py | 3 +- .../xmodule/modulestore/tests/test_mongo.py | 1 - .../xmodule/modulestore/xml_importer.py | 2 +- .../xmodule/xmodule/partitions/partitions.py | 4 -- .../partitions/tests/test_partitions.py | 56 +++++++++---------- .../lib/xmodule/xmodule/tests/test_fields.py | 2 +- .../xmodule/tests/test_split_test_module.py | 4 +- common/lib/xmodule/xmodule/vertical_block.py | 6 +- .../xmodule/video_module/transcripts_utils.py | 2 - common/lib/xmodule/xmodule/xml_module.py | 4 +- .../tests/studio/test_import_export.py | 3 - lms/djangoapps/bulk_email/tests/test_tasks.py | 2 +- lms/djangoapps/certificates/api.py | 1 - .../course_structure_api/v0/serializers.py | 1 - lms/djangoapps/courseware/tabs.py | 2 +- .../tests/test_credit_requirements.py | 6 +- .../courseware/tests/test_entrance_exam.py | 2 +- .../courseware/tests/test_group_access.py | 2 - .../tests/test_submitting_problems.py | 2 +- lms/djangoapps/courseware/tests/test_views.py | 12 ++-- lms/djangoapps/courseware/testutils.py | 4 +- lms/djangoapps/courseware/views.py | 4 +- .../instructor/tests/test_enrollment.py | 3 - lms/djangoapps/instructor_task/subtasks.py | 2 +- .../instructor_task/tests/test_api.py | 2 +- .../instructor_task/tests/test_integration.py | 2 +- lms/djangoapps/lms_xblock/runtime.py | 1 - .../lti_provider/tests/test_outcomes.py | 3 - .../mobile_api/course_info/tests.py | 2 +- .../social_facebook/groups/tests.py | 10 ++-- .../social_facebook/preferences/tests.py | 1 - lms/djangoapps/mobile_api/users/tests.py | 40 ++++++------- .../mobile_api/video_outlines/tests.py | 1 - lms/djangoapps/shoppingcart/models.py | 16 +++--- lms/djangoapps/shoppingcart/reports.py | 2 +- .../shoppingcart/tests/test_models.py | 2 +- .../shoppingcart/tests/test_views.py | 14 ++--- lms/djangoapps/teams/tests/test_views.py | 1 - lms/djangoapps/teams/views.py | 2 +- .../verify_student/tests/test_views.py | 2 +- lms/lib/xblock/test/test_mixin.py | 4 +- .../tests/test_partition_scheme.py | 2 +- .../user_api/accounts/tests/test_views.py | 1 - .../user_api/preferences/tests/test_api.py | 4 +- .../djangoapps/user_api/tests/test_views.py | 2 +- openedx/core/djangoapps/util/testing.py | 6 +- openedx/core/lib/api/view_utils.py | 4 +- 73 files changed, 144 insertions(+), 186 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index da44b9df14..ea6854ebd6 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -1077,13 +1077,13 @@ class ContentStoreTest(ContentStoreTestCase): # test that a user gets his enrollment and its 'student' role as default on creating a course self.assertTrue(CourseEnrollment.is_enrolled(self.user, course_id)) - self.assertTrue(self.user.roles.filter(name="Student", course_id=course_id)) # pylint: disable=no-member + self.assertTrue(self.user.roles.filter(name="Student", course_id=course_id)) delete_course_and_groups(course_id, self.user.id) # check that user's enrollment for this course is not deleted self.assertTrue(CourseEnrollment.is_enrolled(self.user, course_id)) # check that user has form role "Student" for this course even after deleting it - self.assertTrue(self.user.roles.filter(name="Student", course_id=course_id)) # pylint: disable=no-member + self.assertTrue(self.user.roles.filter(name="Student", course_id=course_id)) def test_course_access_groups_on_delete(self): """ diff --git a/cms/djangoapps/contentstore/tests/test_import.py b/cms/djangoapps/contentstore/tests/test_import.py index c35405e189..b48a80cf51 100644 --- a/cms/djangoapps/contentstore/tests/test_import.py +++ b/cms/djangoapps/contentstore/tests/test_import.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# pylint: disable=no-member # pylint: disable=protected-access """ Tests for import_course_from_xml using the mongo modulestore. diff --git a/cms/djangoapps/contentstore/tests/test_users_default_role.py b/cms/djangoapps/contentstore/tests/test_users_default_role.py index c4a1bed05f..326b7cf155 100644 --- a/cms/djangoapps/contentstore/tests/test_users_default_role.py +++ b/cms/djangoapps/contentstore/tests/test_users_default_role.py @@ -20,7 +20,7 @@ class TestUsersDefaultRole(ModuleStoreTestCase): """ super(TestUsersDefaultRole, self).setUp() # create and log in a staff user. - self.user = UserFactory(is_staff=True) # pylint: disable=no-member + self.user = UserFactory(is_staff=True) self.client = AjaxEnabledTestClient() self.client.login(username=self.user.username, password='test') @@ -59,7 +59,7 @@ class TestUsersDefaultRole(ModuleStoreTestCase): self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course_key)) # check that user has his default "Student" forum role for this course - self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) # pylint: disable=no-member + self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) delete_course_and_groups(self.course_key, self.user.id) @@ -67,7 +67,7 @@ class TestUsersDefaultRole(ModuleStoreTestCase): self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course_key)) # check that user has forum role for this course even after deleting it - self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) # pylint: disable=no-member + self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) def test_user_role_on_course_recreate(self): """ @@ -76,7 +76,7 @@ class TestUsersDefaultRole(ModuleStoreTestCase): """ # check that user has enrollment and his default "Student" forum role for this course self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course_key)) - self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) # pylint: disable=no-member + self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) # delete this course and recreate this course with same user delete_course_and_groups(self.course_key, self.user.id) @@ -87,7 +87,7 @@ class TestUsersDefaultRole(ModuleStoreTestCase): self.assertTrue(CourseEnrollment.is_enrolled(self.user, self.course_key)) # check that user has his default "Student" forum role for this course - self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) # pylint: disable=no-member + self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key)) def test_user_role_on_course_recreate_with_change_name_case(self): """ @@ -106,10 +106,10 @@ class TestUsersDefaultRole(ModuleStoreTestCase): # check that user has his default "Student" forum role again for this course (with changed name case) self.assertTrue( - self.user.roles.filter(name="Student", course_id=new_course_key) # pylint: disable=no-member + self.user.roles.filter(name="Student", course_id=new_course_key) ) # Disabled due to case-sensitive test db (sqlite3) # # check that there user has only one "Student" forum role (with new updated course_id) - # self.assertEqual(self.user.roles.filter(name='Student').count(), 1) # pylint: disable=no-member + # self.assertEqual(self.user.roles.filter(name='Student').count(), 1) # self.assertEqual(self.user.roles.filter(name='Student')[0].course_id, new_course_location.course_key) diff --git a/cms/djangoapps/contentstore/tests/utils.py b/cms/djangoapps/contentstore/tests/utils.py index 4c9cd57841..7f0546f166 100644 --- a/cms/djangoapps/contentstore/tests/utils.py +++ b/cms/djangoapps/contentstore/tests/utils.py @@ -1,4 +1,3 @@ -# pylint: disable=no-member ''' Utilities for contentstore tests ''' diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index b65f973da2..9534f34d28 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -1,7 +1,6 @@ """ Common utility functions useful throughout the contentstore """ -# pylint: disable=no-member import logging from opaque_keys import InvalidKeyError diff --git a/cms/djangoapps/contentstore/views/certificates.py b/cms/djangoapps/contentstore/views/certificates.py index b07c762ef8..deaa47decb 100644 --- a/cms/djangoapps/contentstore/views/certificates.py +++ b/cms/djangoapps/contentstore/views/certificates.py @@ -396,7 +396,7 @@ def certificates_list_handler(request, course_key_string): response["Location"] = reverse_course_url( 'certificates.certificates_detail_handler', course.id, - kwargs={'certificate_id': new_certificate.id} # pylint: disable=no-member + kwargs={'certificate_id': new_certificate.id} ) store.update_item(course, request.user.id) CertificateManager.track_event('created', { diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 995ff8bf50..5c230c13d7 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -1459,7 +1459,7 @@ def group_configurations_list_handler(request, course_key_string): response["Location"] = reverse_course_url( 'group_configurations_detail_handler', course.id, - kwargs={'group_configuration_id': new_configuration.id} # pylint: disable=no-member + kwargs={'group_configuration_id': new_configuration.id} ) store.update_item(course, request.user.id) return response diff --git a/cms/djangoapps/contentstore/views/tests/test_certificates.py b/cms/djangoapps/contentstore/views/tests/test_certificates.py index 72f80e3f61..feffbbe071 100644 --- a/cms/djangoapps/contentstore/views/tests/test_certificates.py +++ b/cms/djangoapps/contentstore/views/tests/test_certificates.py @@ -194,7 +194,6 @@ class CertificatesBaseTestCase(object): self.assertTrue('must have name of the certificate' in context.exception) -# pylint: disable=no-member @override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED) class CertificatesListHandlerTestCase(EventTestMixin, CourseTestCase, CertificatesBaseTestCase, HelperMethods): """ diff --git a/cms/djangoapps/contentstore/views/tests/test_group_configurations.py b/cms/djangoapps/contentstore/views/tests/test_group_configurations.py index 73b3735389..f6ea5f21a9 100644 --- a/cms/djangoapps/contentstore/views/tests/test_group_configurations.py +++ b/cms/djangoapps/contentstore/views/tests/test_group_configurations.py @@ -203,7 +203,6 @@ class GroupConfigurationsBaseTestCase(object): self.assertIn("error", content) -# pylint: disable=no-member class GroupConfigurationsListHandlerTestCase(CourseTestCase, GroupConfigurationsBaseTestCase, HelperMethods): """ Test cases for group_configurations_list_handler. @@ -296,7 +295,6 @@ class GroupConfigurationsListHandlerTestCase(CourseTestCase, GroupConfigurations self.assertEqual(len(self.course.user_partitions), 0) -# pylint: disable=no-member class GroupConfigurationsDetailHandlerTestCase(CourseTestCase, GroupConfigurationsBaseTestCase, HelperMethods): """ Test cases for group_configurations_detail_handler. @@ -588,7 +586,6 @@ class GroupConfigurationsDetailHandlerTestCase(CourseTestCase, GroupConfiguratio self.assertEqual(user_partititons[0].name, 'Name 0') -# pylint: disable=no-member class GroupConfigurationsUsageInfoTestCase(CourseTestCase, HelperMethods): """ Tests for usage information of configurations and content groups. diff --git a/cms/djangoapps/contentstore/views/tests/test_import_export.py b/cms/djangoapps/contentstore/views/tests/test_import_export.py index f251d0a295..41e4681643 100644 --- a/cms/djangoapps/contentstore/views/tests/test_import_export.py +++ b/cms/djangoapps/contentstore/views/tests/test_import_export.py @@ -439,14 +439,12 @@ class ExportTestCase(CourseTestCase): root_dir = path(tempfile.mkdtemp()) try: export_library_to_xml(self.store, contentstore(), lib_key, root_dir, name) - # pylint: disable=no-member lib_xml = lxml.etree.XML(open(root_dir / name / LIBRARY_ROOT).read()) self.assertEqual(lib_xml.get('org'), lib_key.org) self.assertEqual(lib_xml.get('library'), lib_key.library) block = lib_xml.find('video') self.assertIsNotNone(block) self.assertEqual(block.get('url_name'), video_block.url_name) - # pylint: disable=no-member video_xml = lxml.etree.XML(open(root_dir / name / 'video' / video_block.url_name + '.xml').read()) self.assertEqual(video_xml.tag, 'video') self.assertEqual(video_xml.get('youtube_id_1_0'), youtube_id) diff --git a/cms/lib/xblock/test/test_authoring_mixin.py b/cms/lib/xblock/test/test_authoring_mixin.py index 3103eebc7c..26c41dc480 100644 --- a/cms/lib/xblock/test/test_authoring_mixin.py +++ b/cms/lib/xblock/test/test_authoring_mixin.py @@ -68,7 +68,7 @@ class AuthoringMixinTestCase(ModuleStoreTestCase): ids within the content partition. """ item = self.store.get_item(item_location) - item.group_access[self.content_partition.id] = group_ids # pylint: disable=no-member + item.group_access[self.content_partition.id] = group_ids self.store.update_item(item, self.user.id) def verify_visibility_view_contains(self, item_location, substrings): diff --git a/common/djangoapps/enrollment/data.py b/common/djangoapps/enrollment/data.py index 81d896d038..33f78e3e4a 100644 --- a/common/djangoapps/enrollment/data.py +++ b/common/djangoapps/enrollment/data.py @@ -37,7 +37,7 @@ def get_course_enrollments(user_id): qset = CourseEnrollment.objects.filter( user__username=user_id, is_active=True ).order_by('created') - return CourseEnrollmentSerializer(qset).data # pylint: disable=no-member + return CourseEnrollmentSerializer(qset).data def get_course_enrollment(username, course_id): @@ -58,7 +58,7 @@ def get_course_enrollment(username, course_id): enrollment = CourseEnrollment.objects.get( user__username=username, course_id=course_key ) - return CourseEnrollmentSerializer(enrollment).data # pylint: disable=no-member + return CourseEnrollmentSerializer(enrollment).data except CourseEnrollment.DoesNotExist: return None @@ -211,7 +211,7 @@ def _get_user(user_id): def _update_enrollment(enrollment, is_active=None, mode=None): enrollment.update_enrollment(is_active=is_active, mode=mode) enrollment.save() - return CourseEnrollmentSerializer(enrollment).data # pylint: disable=no-member + return CourseEnrollmentSerializer(enrollment).data def _invalid_attribute(attributes): diff --git a/common/djangoapps/enrollment/serializers.py b/common/djangoapps/enrollment/serializers.py index cf24a97b96..ca5c4bfd93 100644 --- a/common/djangoapps/enrollment/serializers.py +++ b/common/djangoapps/enrollment/serializers.py @@ -45,7 +45,7 @@ class CourseField(serializers.RelatedField): include_expired=kwargs.get('include_expired', False), only_selectable=False ) - ).data # pylint: disable=no-member + ).data return { 'course_id': unicode(course.id), diff --git a/common/djangoapps/student/management/tests/test_transfer_students.py b/common/djangoapps/student/management/tests/test_transfer_students.py index e13b1ca72a..62d2527d3b 100644 --- a/common/djangoapps/student/management/tests/test_transfer_students.py +++ b/common/djangoapps/student/management/tests/test_transfer_students.py @@ -44,8 +44,8 @@ class TestTransferStudents(ModuleStoreTestCase): def test_transfer_students(self): """ Verify the transfer student command works as intended. """ student = UserFactory.create() - student.set_password(self.PASSWORD) # pylint: disable=no-member - student.save() # pylint: disable=no-member + student.set_password(self.PASSWORD) + student.save() mode = 'verified' # Original Course original_course_location = locator.CourseLocator('Org0', 'Course0', 'Run0') diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index ff9a863c33..b48f283075 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -336,7 +336,7 @@ class UserProfile(models.Model): return default_requires_consent if date is None: date = datetime.now(UTC) - return date.year - year_of_birth <= age_limit # pylint: disable=maybe-no-member + return date.year - year_of_birth <= age_limit @receiver(pre_save, sender=UserProfile) diff --git a/common/djangoapps/student/tests/tests.py b/common/djangoapps/student/tests/tests.py index 42842cab37..e4ffb58121 100644 --- a/common/djangoapps/student/tests/tests.py +++ b/common/djangoapps/student/tests/tests.py @@ -558,7 +558,7 @@ class UserSettingsEventTestMixin(EventTestMixin): kwargs['truncated'] = [] self.assert_event_emitted( USER_SETTINGS_CHANGED_EVENT_NAME, - table=self.table, # pylint: disable=no-member + table=self.table, user_id=self.user.id, **kwargs ) diff --git a/common/djangoapps/third_party_auth/tests/test_pipeline_integration.py b/common/djangoapps/third_party_auth/tests/test_pipeline_integration.py index 66294a5cae..a43071cb7a 100644 --- a/common/djangoapps/third_party_auth/tests/test_pipeline_integration.py +++ b/common/djangoapps/third_party_auth/tests/test_pipeline_integration.py @@ -107,13 +107,13 @@ class GetProviderUserStatesTestCase(testutil.TestCase, test.TestCase): self.assertTrue(google_state.has_account) self.assertEqual(google_provider.provider_id, google_state.provider.provider_id) # Also check the row ID. Note this 'id' changes whenever the configuration does: - self.assertEqual(google_provider.id, google_state.provider.id) # pylint: disable=no-member + self.assertEqual(google_provider.id, google_state.provider.id) self.assertEqual(self.user, google_state.user) self.assertEqual(user_social_auth_google.id, google_state.association_id) self.assertTrue(linkedin_state.has_account) self.assertEqual(linkedin_provider.provider_id, linkedin_state.provider.provider_id) - self.assertEqual(linkedin_provider.id, linkedin_state.provider.id) # pylint: disable=no-member + self.assertEqual(linkedin_provider.id, linkedin_state.provider.id) self.assertEqual(self.user, linkedin_state.user) self.assertEqual(user_social_auth_linkedin.id, linkedin_state.association_id) @@ -134,12 +134,12 @@ class GetProviderUserStatesTestCase(testutil.TestCase, test.TestCase): self.assertFalse(google_state.has_account) self.assertEqual(google_provider.provider_id, google_state.provider.provider_id) # Also check the row ID. Note this 'id' changes whenever the configuration does: - self.assertEqual(google_provider.id, google_state.provider.id) # pylint: disable=no-member + self.assertEqual(google_provider.id, google_state.provider.id) self.assertEqual(self.user, google_state.user) self.assertFalse(linkedin_state.has_account) self.assertEqual(linkedin_provider.provider_id, linkedin_state.provider.provider_id) - self.assertEqual(linkedin_provider.id, linkedin_state.provider.id) # pylint: disable=no-member + self.assertEqual(linkedin_provider.id, linkedin_state.provider.id) self.assertEqual(self.user, linkedin_state.user) diff --git a/common/djangoapps/third_party_auth/tests/test_provider.py b/common/djangoapps/third_party_auth/tests/test_provider.py index bc3f71660a..06a09b7b4f 100644 --- a/common/djangoapps/third_party_auth/tests/test_provider.py +++ b/common/djangoapps/third_party_auth/tests/test_provider.py @@ -12,7 +12,6 @@ class RegistryTest(testutil.TestCase): def test_configure_once_adds_gettable_providers(self): facebook_provider = self.configure_facebook_provider(enabled=True) - # pylint: disable=no-member self.assertEqual(facebook_provider.id, provider.Registry.get(facebook_provider.provider_id).id) def test_no_providers_by_default(self): @@ -55,7 +54,6 @@ class RegistryTest(testutil.TestCase): def test_get_returns_enabled_provider(self): google_provider = self.configure_google_provider(enabled=True) - # pylint: disable=no-member self.assertEqual(google_provider.id, provider.Registry.get(google_provider.provider_id).id) def test_get_returns_none_if_provider_not_enabled(self): diff --git a/common/djangoapps/track/tests/test_contexts.py b/common/djangoapps/track/tests/test_contexts.py index 0ade3544b5..49e4e4fc50 100644 --- a/common/djangoapps/track/tests/test_contexts.py +++ b/common/djangoapps/track/tests/test_contexts.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring,maybe-no-member +# pylint: disable=missing-docstring from unittest import TestCase diff --git a/common/djangoapps/util/file.py b/common/djangoapps/util/file.py index 668ed59fcf..46b2663c35 100644 --- a/common/djangoapps/util/file.py +++ b/common/djangoapps/util/file.py @@ -121,7 +121,7 @@ def course_and_time_based_filename_generator(course_id, base_name): return u"{course_prefix}_{base_name}_{timestamp_str}".format( course_prefix=course_filename_prefix_generator(course_id), base_name=get_valid_filename(base_name), - timestamp_str=datetime.now(UTC).strftime("%Y-%m-%d-%H%M%S") # pylint: disable=maybe-no-member + timestamp_str=datetime.now(UTC).strftime("%Y-%m-%d-%H%M%S") ) diff --git a/common/lib/xmodule/xmodule/assetstore/__init__.py b/common/lib/xmodule/xmodule/assetstore/__init__.py index dd1e0acd63..3960ea265a 100644 --- a/common/lib/xmodule/xmodule/assetstore/__init__.py +++ b/common/lib/xmodule/xmodule/assetstore/__init__.py @@ -16,8 +16,8 @@ new_contract('CourseKey', CourseKey) new_contract('datetime', datetime) new_contract('basestring', basestring) new_contract('long', long) -new_contract('AssetElement', lambda x: isinstance(x, etree._Element) and x.tag == "asset") # pylint: disable=protected-access, no-member -new_contract('AssetsElement', lambda x: isinstance(x, etree._Element) and x.tag == "assets") # pylint: disable=protected-access, no-member +new_contract('AssetElement', lambda x: isinstance(x, etree._Element) and x.tag == "asset") # pylint: disable=protected-access +new_contract('AssetsElement', lambda x: isinstance(x, etree._Element) and x.tag == "assets") # pylint: disable=protected-access class AssetMetadata(object): diff --git a/common/lib/xmodule/xmodule/capa_base.py b/common/lib/xmodule/xmodule/capa_base.py index 604325fc21..f863d436ee 100644 --- a/common/lib/xmodule/xmodule/capa_base.py +++ b/common/lib/xmodule/xmodule/capa_base.py @@ -1049,8 +1049,6 @@ class CapaMixin(CapaFields): # Wait time between resets: check if is too soon for submission. if self.last_submission_time is not None and self.submission_wait_seconds != 0: - # pylint: disable=maybe-no-member - # pylint is unable to verify that .total_seconds() exists if (current_time - self.last_submission_time).total_seconds() < self.submission_wait_seconds: remaining_secs = int(self.submission_wait_seconds - (current_time - self.last_submission_time).total_seconds()) msg = _(u'You must wait at least {wait_secs} between submissions. {remaining_secs} remaining.').format( diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 26ac4a4d17..e27b704e40 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -185,7 +185,7 @@ class CapaDescriptor(CapaFields, RawDescriptor): @property def problem_types(self): """ Low-level problem type introspection for content libraries filtering by problem type """ - tree = etree.XML(self.data) # pylint: disable=no-member + tree = etree.XML(self.data) registered_tags = responsetypes.registry.registered_tags() return set([node.tag for node in tree.iter() if node.tag in registered_tags]) diff --git a/common/lib/xmodule/xmodule/library_content_module.py b/common/lib/xmodule/xmodule/library_content_module.py index cea8dd55b7..6ced0eca83 100644 --- a/common/lib/xmodule/xmodule/library_content_module.py +++ b/common/lib/xmodule/xmodule/library_content_module.py @@ -377,7 +377,6 @@ class LibraryContentDescriptor(LibraryContentFields, MakoModuleDescriptor, XmlDe # exactly the same children-- someone may be duplicating an out of date block, after all. user_id = self.get_user_id() user_perms = self.runtime.service(self, 'studio_user_permissions') - # pylint: disable=no-member if not self.tools: raise RuntimeError("Library tools unavailable, duplication will not be sane!") self.tools.update_children(self, user_id, user_perms, version=self.source_library_version) diff --git a/common/lib/xmodule/xmodule/library_root_xblock.py b/common/lib/xmodule/xmodule/library_root_xblock.py index 2b6f642bf0..a91e11a827 100644 --- a/common/lib/xmodule/xmodule/library_root_xblock.py +++ b/common/lib/xmodule/xmodule/library_root_xblock.py @@ -78,7 +78,7 @@ class LibraryRoot(XBlock): force_render = context.get('force_render', None) - for child_key in children_to_show: # pylint: disable=E1101 + for child_key in children_to_show: # Children must have a separate context from the library itself. Make a copy. child_context = context.copy() child_context['show_preview'] = self.show_children_previews diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py index 3a829212c0..6b5164efb9 100644 --- a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py +++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py @@ -2282,8 +2282,6 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase): Returns the new set of BlockKeys that are the new descendants of the block with key 'block_key' """ - # pylint: disable=no-member - # ^-- Until pylint gets namedtuple support, it will give warnings about BlockKey attributes new_blocks = set() new_children = list() # ordered list of the new children of new_parent_block_key diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py index 0c67cedc6d..ac5895cb1b 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py @@ -1,4 +1,3 @@ -# pylint: disable=no-member """ Unit tests for the Mixed Modulestore, with DDT for the various stores (Split, Draft, XML) """ @@ -283,7 +282,7 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest): # and then to the root UsageKey self.course_locations = { course_id: course_key.make_usage_key('course', course_key.run) - for course_id, course_key in self.course_locations.iteritems() # pylint: disable=maybe-no-member + for course_id, course_key in self.course_locations.iteritems() } mongo_course_key = self.course_locations[self.MONGO_COURSEID].course_key diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py index 523286eb8f..b672b3cc68 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py @@ -1,7 +1,6 @@ """ Unit tests for the Mongo modulestore """ -# pylint: disable=no-member # pylint: disable=protected-access # pylint: disable=no-name-in-module # pylint: disable=bad-continuation diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py index 9aa0e08432..9510bbeea9 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -270,7 +270,7 @@ class ImportManager(object): all_assets = [] try: - xml_data = etree.parse(asset_xml_file).getroot() # pylint: disable=no-member + xml_data = etree.parse(asset_xml_file).getroot() assert xml_data.tag == AssetMetadata.ALL_ASSETS_XML_TAG for asset in xml_data.iterchildren(): if asset.tag == AssetMetadata.ASSET_XML_TAG: diff --git a/common/lib/xmodule/xmodule/partitions/partitions.py b/common/lib/xmodule/xmodule/partitions/partitions.py index 79425b9505..cd7307077c 100644 --- a/common/lib/xmodule/xmodule/partitions/partitions.py +++ b/common/lib/xmodule/xmodule/partitions/partitions.py @@ -49,7 +49,6 @@ class Group(namedtuple("Group", "id name")): Returns: a dictionary with keys for the properties of the group. """ - # pylint: disable=no-member return { "id": self.id, "name": self.name, @@ -133,7 +132,6 @@ class UserPartition(namedtuple("UserPartition", "id name description groups sche Returns: a dictionary with keys for the properties of the partition. """ - # pylint: disable=no-member return { "id": self.id, "name": self.name, @@ -187,8 +185,6 @@ class UserPartition(namedtuple("UserPartition", "id name description groups sche """ Returns the group with the specified id. Raises NoSuchUserPartitionGroupError if not found. """ - # pylint: disable=no-member - for group in self.groups: if group.id == group_id: return group diff --git a/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py b/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py index 474b9eac69..66d69f9fbc 100644 --- a/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py +++ b/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py @@ -20,14 +20,14 @@ class TestGroup(TestCase): test_id = 10 name = "Grendel" group = Group(test_id, name) - self.assertEqual(group.id, test_id) # pylint: disable=no-member + self.assertEqual(group.id, test_id) self.assertEqual(group.name, name) def test_string_id(self): test_id = "10" name = "Grendel" group = Group(test_id, name) - self.assertEqual(group.id, 10) # pylint: disable=no-member + self.assertEqual(group.id, 10) def test_to_json(self): test_id = 10 @@ -50,7 +50,7 @@ class TestGroup(TestCase): "version": Group.VERSION } group = Group.from_json(jsonified) - self.assertEqual(group.id, test_id) # pylint: disable=no-member + self.assertEqual(group.id, test_id) self.assertEqual(group.name, name) def test_from_json_broken(self): @@ -151,17 +151,17 @@ class TestUserPartition(PartitionTestCase): user_partition = UserPartition( self.TEST_ID, self.TEST_NAME, self.TEST_DESCRIPTION, self.TEST_GROUPS, MockUserPartitionScheme() ) - self.assertEqual(user_partition.id, self.TEST_ID) # pylint: disable=no-member + self.assertEqual(user_partition.id, self.TEST_ID) self.assertEqual(user_partition.name, self.TEST_NAME) - self.assertEqual(user_partition.description, self.TEST_DESCRIPTION) # pylint: disable=no-member - self.assertEqual(user_partition.groups, self.TEST_GROUPS) # pylint: disable=no-member - self.assertEquals(user_partition.scheme.name, self.TEST_SCHEME_NAME) # pylint: disable=no-member + self.assertEqual(user_partition.description, self.TEST_DESCRIPTION) + self.assertEqual(user_partition.groups, self.TEST_GROUPS) + self.assertEquals(user_partition.scheme.name, self.TEST_SCHEME_NAME) def test_string_id(self): user_partition = UserPartition( "70", self.TEST_NAME, self.TEST_DESCRIPTION, self.TEST_GROUPS ) - self.assertEqual(user_partition.id, 70) # pylint: disable=no-member + self.assertEqual(user_partition.id, 70) def test_to_json(self): jsonified = self.user_partition.to_json() @@ -185,10 +185,10 @@ class TestUserPartition(PartitionTestCase): "scheme": "mock", } user_partition = UserPartition.from_json(jsonified) - self.assertEqual(user_partition.id, self.TEST_ID) # pylint: disable=no-member - self.assertEqual(user_partition.name, self.TEST_NAME) # pylint: disable=no-member - self.assertEqual(user_partition.description, self.TEST_DESCRIPTION) # pylint: disable=no-member - for act_group in user_partition.groups: # pylint: disable=no-member + self.assertEqual(user_partition.id, self.TEST_ID) + self.assertEqual(user_partition.name, self.TEST_NAME) + self.assertEqual(user_partition.description, self.TEST_DESCRIPTION) + for act_group in user_partition.groups: self.assertIn(act_group.id, [0, 1]) exp_group = self.TEST_GROUPS[act_group.id] self.assertEqual(exp_group.id, act_group.id) @@ -204,7 +204,7 @@ class TestUserPartition(PartitionTestCase): "version": 1, } user_partition = UserPartition.from_json(jsonified) - self.assertEqual(user_partition.scheme.name, "random") # pylint: disable=no-member + self.assertEqual(user_partition.scheme.name, "random") def test_from_json_broken(self): # Missing field @@ -274,11 +274,11 @@ class TestUserPartition(PartitionTestCase): the lookup fails. """ self.assertEqual( - self.user_partition.get_group(self.TEST_GROUPS[0].id), # pylint: disable=no-member + self.user_partition.get_group(self.TEST_GROUPS[0].id), self.TEST_GROUPS[0] ) self.assertEqual( - self.user_partition.get_group(self.TEST_GROUPS[1].id), # pylint: disable=no-member + self.user_partition.get_group(self.TEST_GROUPS[1].id), self.TEST_GROUPS[1] ) with self.assertRaises(NoSuchUserPartitionGroupError): @@ -326,22 +326,22 @@ class TestPartitionService(PartitionTestCase): def test_get_user_group_id_for_partition(self): # assign the first group to be returned - user_partition_id = self.user_partition.id # pylint: disable=no-member - groups = self.user_partition.groups # pylint: disable=no-member - self.user_partition.scheme.current_group = groups[0] # pylint: disable=no-member + user_partition_id = self.user_partition.id + groups = self.user_partition.groups + self.user_partition.scheme.current_group = groups[0] # get a group assigned to the user group1_id = self.partition_service.get_user_group_id_for_partition(user_partition_id) - self.assertEqual(group1_id, groups[0].id) # pylint: disable=no-member + self.assertEqual(group1_id, groups[0].id) # switch to the second group and verify that it is returned for the user - self.user_partition.scheme.current_group = groups[1] # pylint: disable=no-member + self.user_partition.scheme.current_group = groups[1] group2_id = self.partition_service.get_user_group_id_for_partition(user_partition_id) - self.assertEqual(group2_id, groups[1].id) # pylint: disable=no-member + self.assertEqual(group2_id, groups[1].id) def test_caching(self): username = "psvc_cache_user" - user_partition_id = self.user_partition.id # pylint: disable=no-member + user_partition_id = self.user_partition.id shared_cache = {} # Two StaticPartitionService objects that share the same cache: @@ -356,7 +356,7 @@ class TestPartitionService(PartitionTestCase): # Set the group we expect users to be placed into first_group = self.user_partition.groups[0] - self.user_partition.scheme.current_group = first_group # pylint: disable=no-member + self.user_partition.scheme.current_group = first_group # Make sure our partition services all return the right thing, but skip # ps_shared_cache_2 so we can see if its cache got updated anyway. @@ -396,14 +396,14 @@ class TestPartitionService(PartitionTestCase): """ Test that a partition group is assigned to a user. """ - groups = self.user_partition.groups # pylint: disable=no-member + groups = self.user_partition.groups # assign first group and verify that it is returned for the user - self.user_partition.scheme.current_group = groups[0] # pylint: disable=no-member + self.user_partition.scheme.current_group = groups[0] group1 = self.partition_service.get_group(self.user_partition) - self.assertEqual(group1, groups[0]) # pylint: disable=no-member + self.assertEqual(group1, groups[0]) # switch to the second group and verify that it is returned for the user - self.user_partition.scheme.current_group = groups[1] # pylint: disable=no-member + self.user_partition.scheme.current_group = groups[1] group2 = self.partition_service.get_group(self.user_partition) - self.assertEqual(group2, groups[1]) # pylint: disable=no-member + self.assertEqual(group2, groups[1]) diff --git a/common/lib/xmodule/xmodule/tests/test_fields.py b/common/lib/xmodule/xmodule/tests/test_fields.py index 4971b8a8c3..95a6fb1b5d 100644 --- a/common/lib/xmodule/xmodule/tests/test_fields.py +++ b/common/lib/xmodule/xmodule/tests/test_fields.py @@ -95,7 +95,7 @@ class DateTest(unittest.TestCase): now = datetime.datetime.now(UTC()) delta = now - datetime.datetime.fromtimestamp(0, UTC()) self.assertEqual( - DateTest.date.from_json(delta.total_seconds() * 1000), # pylint: disable=maybe-no-member + DateTest.date.from_json(delta.total_seconds() * 1000), now ) yesterday = datetime.datetime.now(UTC()) - datetime.timedelta(days=-1) diff --git a/common/lib/xmodule/xmodule/tests/test_split_test_module.py b/common/lib/xmodule/xmodule/tests/test_split_test_module.py index 36fd68e750..b9adbb2ea5 100644 --- a/common/lib/xmodule/xmodule/tests/test_split_test_module.py +++ b/common/lib/xmodule/xmodule/tests/test_split_test_module.py @@ -113,13 +113,13 @@ class SplitTestModuleLMSTest(SplitTestModuleTest): @ddt.data((0, 'split_test_cond0'), (1, 'split_test_cond1')) @ddt.unpack def test_child(self, user_tag, child_url_name): - self.user_partition.scheme.current_group = self.user_partition.groups[user_tag] # pylint: disable=no-member + self.user_partition.scheme.current_group = self.user_partition.groups[user_tag] self.assertEquals(self.split_test_module.child_descriptor.url_name, child_url_name) @ddt.data((0, 'HTML FOR GROUP 0'), (1, 'HTML FOR GROUP 1')) @ddt.unpack def test_get_html(self, user_tag, child_content): - self.user_partition.scheme.current_group = self.user_partition.groups[user_tag] # pylint: disable=no-member + self.user_partition.scheme.current_group = self.user_partition.groups[user_tag] self.assertIn( child_content, self.module_system.render(self.split_test_module, STUDENT_VIEW).content diff --git a/common/lib/xmodule/xmodule/vertical_block.py b/common/lib/xmodule/xmodule/vertical_block.py index 62af97c66c..0a01de6ac2 100644 --- a/common/lib/xmodule/xmodule/vertical_block.py +++ b/common/lib/xmodule/xmodule/vertical_block.py @@ -77,7 +77,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse Returns the progress on this block and all children. """ # TODO: Cache progress or children array? - children = self.get_children() # pylint: disable=no-member + children = self.get_children() progresses = [child.get_progress() for child in children] progress = reduce(Progress.add_counts, progresses, None) return progress @@ -86,7 +86,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse """ Returns the highest priority icon class. """ - child_classes = set(child.get_icon_class() for child in self.get_children()) # pylint: disable=no-member + child_classes = set(child.get_icon_class() for child in self.get_children()) new_class = 'other' for higher_class in CLASS_PRIORITY: if higher_class in child_classes: @@ -109,7 +109,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse def definition_to_xml(self, resource_fs): xml_object = etree.Element('vertical') # pylint: disable=no-member - for child in self.get_children(): # pylint: disable=no-member + for child in self.get_children(): self.runtime.add_block_as_child_node(child, xml_object) return xml_object diff --git a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py index 53b15a49a5..cee5d1c7e9 100644 --- a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py +++ b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py @@ -99,7 +99,6 @@ def youtube_video_transcript_name(youtube_text_api): Get the transcript name from available transcripts of video with respect to language from youtube server """ - # pylint: disable=no-member utf8_parser = etree.XMLParser(encoding='utf-8') transcripts_param = {'type': 'list', 'v': youtube_text_api['params']['v']} @@ -109,7 +108,6 @@ def youtube_video_transcript_name(youtube_text_api): # http://video.google.com/timedtext?type=list&v={VideoId} youtube_response = requests.get('http://' + youtube_text_api['url'], params=transcripts_param) if youtube_response.status_code == 200 and youtube_response.text: - # pylint: disable=no-member youtube_data = etree.fromstring(youtube_response.content, parser=utf8_parser) # iterate all transcripts information from youtube server for element in youtube_data: diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py index 1d788b6b3e..8be8f48143 100644 --- a/common/lib/xmodule/xmodule/xml_module.py +++ b/common/lib/xmodule/xmodule/xml_module.py @@ -184,7 +184,7 @@ class XmlParserMixin(object): Returns an lxml Element """ - return etree.parse(file_object, parser=EDX_XML_PARSER).getroot() # pylint: disable=no-member + return etree.parse(file_object, parser=EDX_XML_PARSER).getroot() @classmethod def load_file(cls, filepath, fs, def_id): # pylint: disable=invalid-name @@ -499,7 +499,7 @@ class XmlDescriptor(XmlParserMixin, XModuleDescriptor): # pylint: disable=abstr # a) define from_xml themselves # b) call super(..).from_xml(..) return super(XmlDescriptor, cls).parse_xml( - etree.fromstring(xml_data), # pylint: disable=no-member + etree.fromstring(xml_data), system, None, # This is ignored by XmlParserMixin id_generator, diff --git a/common/test/acceptance/tests/studio/test_import_export.py b/common/test/acceptance/tests/studio/test_import_export.py index 0a8337b2b1..7fa9fa445a 100644 --- a/common/test/acceptance/tests/studio/test_import_export.py +++ b/common/test/acceptance/tests/studio/test_import_export.py @@ -14,7 +14,6 @@ from ...pages.studio.container import ContainerPage from ...pages.studio.overview import CourseOutlinePage -# pylint: disable=no-member class ExportTestMixin(object): """ Tests to run both for course and library export pages. @@ -76,7 +75,6 @@ class TestLibraryExport(ExportTestMixin, StudioLibraryTest): self.assertEqual(self.export_page.header_text, 'Library Export') -# pylint: disable=no-member class BadExportMixin(object): """ Test mixin for bad exports. @@ -157,7 +155,6 @@ class TestCourseBadExport(BadExportMixin, StudioCourseTest): ) -# pylint: disable=no-member class ImportTestMixin(object): """ Tests to run for both course and library import pages. diff --git a/lms/djangoapps/bulk_email/tests/test_tasks.py b/lms/djangoapps/bulk_email/tests/test_tasks.py index 33f1c5009d..12442d3200 100644 --- a/lms/djangoapps/bulk_email/tests/test_tasks.py +++ b/lms/djangoapps/bulk_email/tests/test_tasks.py @@ -134,7 +134,7 @@ class TestBulkEmailInstructorTask(InstructorTaskCourseTestCase): with self.assertRaises(ValueError): with patch('bulk_email.tasks.update_subtask_status', dummy_update_subtask_status): - send_bulk_course_email(task_entry.id, {}) # pylint: disable=no-member + send_bulk_course_email(task_entry.id, {}) def _create_students(self, num_students): """Create students for testing""" diff --git a/lms/djangoapps/certificates/api.py b/lms/djangoapps/certificates/api.py index f8142c62c4..25a152a9e5 100644 --- a/lms/djangoapps/certificates/api.py +++ b/lms/djangoapps/certificates/api.py @@ -274,7 +274,6 @@ def example_certificates_status(course_key): return ExampleCertificateSet.latest_status(course_key) -# pylint: disable=no-member def get_certificate_url(user_id, course_id): """ :return certificate url diff --git a/lms/djangoapps/course_structure_api/v0/serializers.py b/lms/djangoapps/course_structure_api/v0/serializers.py index 0ff6b8f1d3..ad95b8e985 100644 --- a/lms/djangoapps/course_structure_api/v0/serializers.py +++ b/lms/djangoapps/course_structure_api/v0/serializers.py @@ -33,7 +33,6 @@ class CourseSerializer(serializers.Serializer): def get_uri(self, course): """ Builds course detail uri """ - # pylint: disable=no-member request = self.context['request'] return request.build_absolute_uri(reverse('course_structure_api:v0:detail', kwargs={'course_id': course.id})) diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index a3f54c614a..89cc13ca68 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -64,7 +64,7 @@ class SyllabusTab(EnrolledTab): is_default = False @classmethod - def is_enabled(cls, course, user=None): # pylint: disable=unused-argument + def is_enabled(cls, course, user=None): if not super(SyllabusTab, cls).is_enabled(course, user=user): return False return getattr(course, 'syllabus_present', False) diff --git a/lms/djangoapps/courseware/tests/test_credit_requirements.py b/lms/djangoapps/courseware/tests/test_credit_requirements.py index 6727be5740..7130f95b8d 100644 --- a/lms/djangoapps/courseware/tests/test_credit_requirements.py +++ b/lms/djangoapps/courseware/tests/test_credit_requirements.py @@ -37,11 +37,11 @@ class ProgressPageCreditRequirementsTest(ModuleStoreTestCase): # Create a course and configure it as a credit course self.course = CourseFactory.create() - CreditCourse.objects.create(course_key=self.course.id, enabled=True) # pylint: disable=no-member + CreditCourse.objects.create(course_key=self.course.id, enabled=True) # Configure credit requirements (passing grade and in-course reverification) credit_api.set_credit_requirements( - self.course.id, # pylint: disable=no-member + self.course.id, [ { "namespace": "grade", @@ -71,7 +71,7 @@ class ProgressPageCreditRequirementsTest(ModuleStoreTestCase): # Enroll the user in the course as "verified" self.enrollment = CourseEnrollmentFactory( user=self.user, - course_id=self.course.id, # pylint: disable=no-member + course_id=self.course.id, mode="verified" ) diff --git a/lms/djangoapps/courseware/tests/test_entrance_exam.py b/lms/djangoapps/courseware/tests/test_entrance_exam.py index 46dbe5413d..43ec7f7406 100644 --- a/lms/djangoapps/courseware/tests/test_entrance_exam.py +++ b/lms/djangoapps/courseware/tests/test_entrance_exam.py @@ -550,7 +550,7 @@ def answer_entrance_exam_problem(course, request, problem, user=None): if not user: user = request.user - # pylint: disable=maybe-no-member,no-member + # pylint: disable=maybe-no-member grade_dict = {'value': 1, 'max_value': 1, 'user_id': user.id} field_data_cache = FieldDataCache.cache_for_descriptor_descendents( course.id, diff --git a/lms/djangoapps/courseware/tests/test_group_access.py b/lms/djangoapps/courseware/tests/test_group_access.py index 4fbd8cd281..ff86612ed9 100644 --- a/lms/djangoapps/courseware/tests/test_group_access.py +++ b/lms/djangoapps/courseware/tests/test_group_access.py @@ -58,8 +58,6 @@ class GroupAccessTestCase(ModuleStoreTestCase): Tests to ensure that has_access() correctly enforces the visibility restrictions specified in the `group_access` field of XBlocks. """ - # pylint: disable=no-member - def set_user_group(self, user, partition, group): """ Internal DRY / shorthand. diff --git a/lms/djangoapps/courseware/tests/test_submitting_problems.py b/lms/djangoapps/courseware/tests/test_submitting_problems.py index 5bb72b3a1e..2b45be59c1 100644 --- a/lms/djangoapps/courseware/tests/test_submitting_problems.py +++ b/lms/djangoapps/courseware/tests/test_submitting_problems.py @@ -1254,7 +1254,7 @@ class TestConditionalContent(TestSubmittingProblems): UserCourseTagFactory( user=self.student_user, course_id=self.course.id, - key='xblock.partition_service.partition_{0}'.format(self.partition.id), # pylint: disable=no-member + key='xblock.partition_service.partition_{0}'.format(self.partition.id), value=str(user_partition_group) ) diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index 4ece972ea6..31e05c4e0d 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -179,7 +179,7 @@ class ViewsTestCase(ModuleStoreTestCase): def setUp(self): super(ViewsTestCase, self).setUp() self.course = CourseFactory.create() - self.chapter = ItemFactory.create(category='chapter', parent_location=self.course.location) # pylint: disable=no-member + self.chapter = ItemFactory.create(category='chapter', parent_location=self.course.location) self.section = ItemFactory.create(category='sequential', parent_location=self.chapter.location, due=datetime(2013, 9, 18, 11, 30, 00)) self.vertical = ItemFactory.create(category='vertical', parent_location=self.section.location) self.component = ItemFactory.create(category='problem', parent_location=self.vertical.location) @@ -584,12 +584,12 @@ class BaseDueDateTests(ModuleStoreTestCase): :param course_kwargs: All kwargs are passed to through to the :class:`CourseFactory` """ course = CourseFactory.create(**course_kwargs) - chapter = ItemFactory.create(category='chapter', parent_location=course.location) # pylint: disable=no-member + chapter = ItemFactory.create(category='chapter', parent_location=course.location) section = ItemFactory.create(category='sequential', parent_location=chapter.location, due=datetime(2013, 9, 18, 11, 30, 00)) vertical = ItemFactory.create(category='vertical', parent_location=section.location) ItemFactory.create(category='problem', parent_location=vertical.location) - course = modulestore().get_course(course.id) # pylint: disable=no-member + course = modulestore().get_course(course.id) self.assertIsNotNone(course.get_children()[0].get_children()[0].due) CourseEnrollmentFactory(user=self.user, course_id=course.id) return course @@ -704,7 +704,7 @@ class StartDateTests(ModuleStoreTestCase): :param course_kwargs: All kwargs are passed to through to the :class:`CourseFactory` """ course = CourseFactory.create(start=datetime(2013, 9, 16, 7, 17, 28)) - course = modulestore().get_course(course.id) # pylint: disable=no-member + course = modulestore().get_course(course.id) return course def get_about_text(self, course_key): @@ -758,10 +758,10 @@ class ProgressPageTests(ModuleStoreTestCase): start=datetime(2013, 9, 16, 7, 17, 28), grade_cutoffs={u'çü†øƒƒ': 0.75, 'Pass': 0.5}, ) - self.course = modulestore().get_course(course.id) # pylint: disable=no-member + self.course = modulestore().get_course(course.id) CourseEnrollmentFactory(user=self.user, course_id=self.course.id) - self.chapter = ItemFactory.create(category='chapter', parent_location=self.course.location) # pylint: disable=no-member + self.chapter = ItemFactory.create(category='chapter', parent_location=self.course.location) self.section = ItemFactory.create(category='sequential', parent_location=self.chapter.location) self.vertical = ItemFactory.create(category='vertical', parent_location=self.section.location) diff --git a/lms/djangoapps/courseware/testutils.py b/lms/djangoapps/courseware/testutils.py index 42f8fc65b3..40aae1c188 100644 --- a/lms/djangoapps/courseware/testutils.py +++ b/lms/djangoapps/courseware/testutils.py @@ -166,12 +166,12 @@ class RenderXBlockTestMixin(object): self.setup_course() self.setup_user(admin=False, enroll=True, login=True) self.html_block.start = datetime.max - modulestore().update_item(self.html_block, self.user.id) # pylint: disable=no-member + modulestore().update_item(self.html_block, self.user.id) self.verify_response(expected_response_code=404) def test_fail_block_nonvisible(self): self.setup_course() self.setup_user(admin=False, enroll=True, login=True) self.html_block.visible_to_staff_only = True - modulestore().update_item(self.html_block, self.user.id) # pylint: disable=no-member + modulestore().update_item(self.html_block, self.user.id) self.verify_response(expected_response_code=404) diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index ba2673c3a9..a77e9b0062 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -1447,8 +1447,8 @@ def _track_successful_certificate_generation(user_id, course_id): # pylint: dis """ if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'): - event_name = 'edx.bi.user.certificate.generate' # pylint: disable=no-member - tracking_context = tracker.get_tracker().resolve_context() # pylint: disable=no-member + event_name = 'edx.bi.user.certificate.generate' + tracking_context = tracker.get_tracker().resolve_context() analytics.track( user_id, diff --git a/lms/djangoapps/instructor/tests/test_enrollment.py b/lms/djangoapps/instructor/tests/test_enrollment.py index 5298a9e8be..1a6e3d268e 100644 --- a/lms/djangoapps/instructor/tests/test_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_enrollment.py @@ -311,7 +311,6 @@ class TestInstructorEnrollmentStudentModule(ModuleStoreTestCase): self.course_key = self.course.location.course_key self.parent = ItemFactory( category="library_content", - # pylint: disable=no-member user_id=self.user.id, parent=self.course, publish_item=True, @@ -319,7 +318,6 @@ class TestInstructorEnrollmentStudentModule(ModuleStoreTestCase): ) self.child = ItemFactory( category="html", - # pylint: disable=no-member user_id=self.user.id, parent=self.parent, publish_item=True, @@ -327,7 +325,6 @@ class TestInstructorEnrollmentStudentModule(ModuleStoreTestCase): ) self.unrelated = ItemFactory( category="html", - # pylint: disable=no-member user_id=self.user.id, parent=self.course, publish_item=True, diff --git a/lms/djangoapps/instructor_task/subtasks.py b/lms/djangoapps/instructor_task/subtasks.py index 7401e06f7d..2cafad3a77 100644 --- a/lms/djangoapps/instructor_task/subtasks.py +++ b/lms/djangoapps/instructor_task/subtasks.py @@ -316,7 +316,7 @@ def queue_subtasks_for_query( entry.id, total_num_subtasks, total_num_items, - ) # pylint: disable=no-member + ) progress = initialize_subtask_info(entry, action_name, total_num_items, subtask_id_list) # Construct a generator that will return the recipients to use for each subtask. diff --git a/lms/djangoapps/instructor_task/tests/test_api.py b/lms/djangoapps/instructor_task/tests/test_api.py index 6b281d6aa4..3145272484 100644 --- a/lms/djangoapps/instructor_task/tests/test_api.py +++ b/lms/djangoapps/instructor_task/tests/test_api.py @@ -188,7 +188,7 @@ class InstructorTaskCourseSubmitTest(TestReportMixin, InstructorTaskCourseTestCa `AlreadyRunningError`. """ instructor_task = api_call() - instructor_task = InstructorTask.objects.get(id=instructor_task.id) # pylint: disable=no-member + instructor_task = InstructorTask.objects.get(id=instructor_task.id) instructor_task.task_state = PROGRESS instructor_task.save() with self.assertRaises(AlreadyRunningError): diff --git a/lms/djangoapps/instructor_task/tests/test_integration.py b/lms/djangoapps/instructor_task/tests/test_integration.py index dcc316bc2f..ba31910828 100644 --- a/lms/djangoapps/instructor_task/tests/test_integration.py +++ b/lms/djangoapps/instructor_task/tests/test_integration.py @@ -506,7 +506,7 @@ class TestGradeReportConditionalContent(TestReportMixin, TestConditionalContent, """Return a dict having single key with value equals to students group in partition""" group_config_hdr_tpl = 'Experiment Group ({})' return { - group_config_hdr_tpl.format(self.partition.name): self.partition.scheme.get_group_for_user( # pylint: disable=E1101 + group_config_hdr_tpl.format(self.partition.name): self.partition.scheme.get_group_for_user( self.course.id, user, self.partition, track_function=None ).name } diff --git a/lms/djangoapps/lms_xblock/runtime.py b/lms/djangoapps/lms_xblock/runtime.py index 64fd643e62..d480c07182 100644 --- a/lms/djangoapps/lms_xblock/runtime.py +++ b/lms/djangoapps/lms_xblock/runtime.py @@ -75,7 +75,6 @@ class LmsHandlerUrls(object): a course_id """ # pylint: disable=unused-argument - # pylint: disable=no-member def handler_url(self, block, handler_name, suffix='', query='', thirdparty=False): """See :method:`xblock.runtime:Runtime.handler_url`""" view_name = 'xblock_handler' diff --git a/lms/djangoapps/lti_provider/tests/test_outcomes.py b/lms/djangoapps/lti_provider/tests/test_outcomes.py index 3e645885c9..981a56a704 100644 --- a/lms/djangoapps/lti_provider/tests/test_outcomes.py +++ b/lms/djangoapps/lti_provider/tests/test_outcomes.py @@ -285,7 +285,6 @@ class XmlHandlingTest(TestCase): @patch('uuid.uuid4', return_value='random_uuid') def test_replace_result_message_uuid(self, _uuid_mock): # Pylint doesn't recognize members in the LXML module - # pylint: disable=no-member xml = outcomes.generate_replace_result_xml(self.result_id, self.score) tree = etree.fromstring(xml) message_id = tree.xpath( @@ -296,7 +295,6 @@ class XmlHandlingTest(TestCase): self.assertEqual(message_id[0].text, 'random_uuid') def test_replace_result_sourced_id(self): - # pylint: disable=no-member xml = outcomes.generate_replace_result_xml(self.result_id, self.score) tree = etree.fromstring(xml) sourced_id = tree.xpath( @@ -308,7 +306,6 @@ class XmlHandlingTest(TestCase): self.assertEqual(sourced_id[0].text, 'result_id') def test_replace_result_score(self): - # pylint: disable=no-member xml = outcomes.generate_replace_result_xml(self.result_id, self.score) tree = etree.fromstring(xml) xml_score = tree.xpath( diff --git a/lms/djangoapps/mobile_api/course_info/tests.py b/lms/djangoapps/mobile_api/course_info/tests.py index fe2a490cf7..471b3ede27 100644 --- a/lms/djangoapps/mobile_api/course_info/tests.py +++ b/lms/djangoapps/mobile_api/course_info/tests.py @@ -76,7 +76,7 @@ class TestUpdates(MobileAPITestCase, MobileAuthTestMixin, MobileCourseAccessTest # verify content and sort order of updates (most recent first) for num in range(1, num_updates + 1): - update_data = response.data[num_updates - num] # pylint: disable=maybe-no-member + update_data = response.data[num_updates - num] self.assertEquals(num, update_data['id']) self.assertEquals("Date" + str(num), update_data['date']) self.assertIn("Update" + str(num), update_data['content']) diff --git a/lms/djangoapps/mobile_api/social_facebook/groups/tests.py b/lms/djangoapps/mobile_api/social_facebook/groups/tests.py index 31aa354166..869946b7b2 100644 --- a/lms/djangoapps/mobile_api/social_facebook/groups/tests.py +++ b/lms/djangoapps/mobile_api/social_facebook/groups/tests.py @@ -108,7 +108,7 @@ class TestGroups(SocialFacebookTestCase): status=status_code ) response = self.delete_group(response.data['id']) # pylint: disable=E1101 - self.assertTrue(response.status_code, status_code) # pylint: disable=E1101 + self.assertTrue(response.status_code, status_code) @httpretty.activate def test_delete(self): @@ -153,7 +153,7 @@ class TestGroups(SocialFacebookTestCase): self.set_facebook_interceptor_for_members({'success': 'True'}, status_code, group_id, member_id) response = self.invite_to_group(group_id, member_id) self.assertEqual(response.status_code, status_code) - self.assertTrue('success' in response.data[member_id]) # pylint: disable=E1103 + self.assertTrue('success' in response.data[member_id]) @httpretty.activate def test_invite_multiple_members_successfully(self): @@ -166,7 +166,7 @@ class TestGroups(SocialFacebookTestCase): response = self.invite_to_group(group_id, member_ids) self.assertEqual(response.status_code, status_code) for member_id in member_ids.split(','): - self.assertTrue('success' in response.data[member_id]) # pylint: disable=E1103 + self.assertTrue('success' in response.data[member_id]) @httpretty.activate def test_invite_single_member_unsuccessfully(self): @@ -180,7 +180,7 @@ class TestGroups(SocialFacebookTestCase): ) response = self.invite_to_group(group_id, member_id) self.assertEqual(response.status_code, 200) - self.assertTrue('error message' in response.data[member_id]) # pylint: disable=E1103 + self.assertTrue('error message' in response.data[member_id]) @httpretty.activate def test_invite_multiple_members_unsuccessfully(self): @@ -196,4 +196,4 @@ class TestGroups(SocialFacebookTestCase): response = self.invite_to_group(group_id, member_ids) self.assertEqual(response.status_code, 200) for member_id in member_ids.split(','): - self.assertTrue('error message' in response.data[member_id]) # pylint: disable=E1103 + self.assertTrue('error message' in response.data[member_id]) diff --git a/lms/djangoapps/mobile_api/social_facebook/preferences/tests.py b/lms/djangoapps/mobile_api/social_facebook/preferences/tests.py index 94865e28c0..19850b40f7 100644 --- a/lms/djangoapps/mobile_api/social_facebook/preferences/tests.py +++ b/lms/djangoapps/mobile_api/social_facebook/preferences/tests.py @@ -1,4 +1,3 @@ -# pylint: disable=no-member """ Tests for users sharing preferences """ diff --git a/lms/djangoapps/mobile_api/users/tests.py b/lms/djangoapps/mobile_api/users/tests.py index 90f72a2f3f..45fd9801ba 100644 --- a/lms/djangoapps/mobile_api/users/tests.py +++ b/lms/djangoapps/mobile_api/users/tests.py @@ -101,7 +101,7 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin): response = self.api_response() for course_index in range(num_courses): self.assertEqual( - response.data[course_index]['course']['id'], # pylint: disable=no-member + response.data[course_index]['course']['id'], unicode(courses[num_courses - course_index - 1].id) ) @@ -138,7 +138,7 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin): # Verify courses have the correct response through error code. Last enrolled course is first course in response response = self.api_response() for course_index in range(len(courses)): - result = response.data[course_index]['course']['courseware_access'] # pylint: disable=no-member + result = response.data[course_index]['course']['courseware_access'] self.assertEqual(result['error_code'], expected_error_codes[::-1][course_index]) if result['error_code'] is not None: @@ -162,14 +162,14 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin): self.enroll(course.id) response = self.api_response() - self.assertEqual(response.data[0]['course']['start_type'], expected_type) # pylint: disable=no-member - self.assertEqual(response.data[0]['course']['start_display'], expected_display) # pylint: disable=no-member + self.assertEqual(response.data[0]['course']['start_type'], expected_type) + self.assertEqual(response.data[0]['course']['start_display'], expected_display) def test_no_certificate(self): self.login_and_enroll() response = self.api_response() - certificate_data = response.data[0]['certificate'] # pylint: disable=no-member + certificate_data = response.data[0]['certificate'] self.assertDictEqual(certificate_data, {}) def test_certificate(self): @@ -185,14 +185,14 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin): ) response = self.api_response() - certificate_data = response.data[0]['certificate'] # pylint: disable=no-member + certificate_data = response.data[0]['certificate'] self.assertEquals(certificate_data['url'], certificate_url) def test_no_facebook_url(self): self.login_and_enroll() response = self.api_response() - course_data = response.data[0]['course'] # pylint: disable=no-member + course_data = response.data[0]['course'] self.assertIsNone(course_data['social_urls']['facebook']) def test_facebook_url(self): @@ -202,7 +202,7 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin): self.store.update_item(self.course, self.user.id) response = self.api_response() - course_data = response.data[0]['course'] # pylint: disable=no-member + course_data = response.data[0]['course'] self.assertEquals(course_data['social_urls']['facebook'], self.course.facebook_url) @@ -249,11 +249,11 @@ class TestCourseStatusGET(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mobi response = self.api_response() self.assertEqual( - response.data["last_visited_module_id"], # pylint: disable=no-member + response.data["last_visited_module_id"], unicode(self.sub_section.location) ) self.assertEqual( - response.data["last_visited_module_path"], # pylint: disable=no-member + response.data["last_visited_module_path"], [unicode(module.location) for module in [self.sub_section, self.section, self.course]] ) @@ -270,7 +270,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mo self.login_and_enroll() response = self.api_response(data={"last_visited_module_id": unicode(self.other_unit.location)}) self.assertEqual( - response.data["last_visited_module_id"], # pylint: disable=no-member + response.data["last_visited_module_id"], unicode(self.other_sub_section.location) ) @@ -278,7 +278,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mo self.login_and_enroll() response = self.api_response(data={"last_visited_module_id": "abc"}, expected_response_code=400) self.assertEqual( - response.data, # pylint: disable=no-member + response.data, errors.ERROR_INVALID_MODULE_ID ) @@ -287,7 +287,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mo non_existent_key = self.course.id.make_usage_key('video', 'non-existent') response = self.api_response(data={"last_visited_module_id": non_existent_key}, expected_response_code=400) self.assertEqual( - response.data, # pylint: disable=no-member + response.data, errors.ERROR_INVALID_MODULE_ID ) @@ -297,12 +297,12 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mo response = self.api_response( data={ "last_visited_module_id": unicode(self.other_unit.location), - "modification_date": past_date.isoformat() # pylint: disable=maybe-no-member + "modification_date": past_date.isoformat() }, expected_response_code=400 ) self.assertEqual( - response.data, # pylint: disable=no-member + response.data, errors.ERROR_INVALID_MODIFICATION_DATE ) @@ -324,7 +324,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mo } ) self.assertEqual( - response.data["last_visited_module_id"], # pylint: disable=no-member + response.data["last_visited_module_id"], unicode(expected_subsection.location) ) @@ -347,7 +347,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mo } ) self.assertEqual( - response.data["last_visited_module_id"], # pylint: disable=no-member + response.data["last_visited_module_id"], unicode(self.other_sub_section.location) ) @@ -355,7 +355,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, Mo self.login_and_enroll() response = self.api_response(data={"modification_date": "abc"}, expected_response_code=400) self.assertEqual( - response.data, # pylint: disable=no-member + response.data, errors.ERROR_INVALID_MODIFICATION_DATE ) @@ -367,7 +367,7 @@ class TestCourseEnrollmentSerializer(MobileAPITestCase): def test_success(self): self.login_and_enroll() - serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data # pylint: disable=no-member + serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data self.assertEqual(serialized['course']['video_outline'], None) self.assertEqual(serialized['course']['name'], self.course.display_name) self.assertEqual(serialized['course']['number'], self.course.id.course) @@ -380,6 +380,6 @@ class TestCourseEnrollmentSerializer(MobileAPITestCase): self.course.display_organization = "overridden_org" self.store.update_item(self.course, self.user.id) - serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data # pylint: disable=no-member + serialized = CourseEnrollmentSerializer(CourseEnrollment.enrollments_for_user(self.user)[0]).data self.assertEqual(serialized['course']['number'], self.course.display_coursenumber) self.assertEqual(serialized['course']['org'], self.course.display_organization) diff --git a/lms/djangoapps/mobile_api/video_outlines/tests.py b/lms/djangoapps/mobile_api/video_outlines/tests.py index f83e0711a1..f25424155e 100644 --- a/lms/djangoapps/mobile_api/video_outlines/tests.py +++ b/lms/djangoapps/mobile_api/video_outlines/tests.py @@ -2,7 +2,6 @@ """ Tests for video outline API """ -# pylint: disable=no-member import ddt import itertools from uuid import uuid4 diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index 15e54fc641..e2ba3f5e27 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -848,7 +848,7 @@ class Invoice(TimeStampedModel): """ returns the invoice total amount generated by course. """ - result = cls.objects.filter(course_id=course_key, is_valid=True).aggregate(total=Sum('total_amount')) # pylint: disable=no-member + result = cls.objects.filter(course_id=course_key, is_valid=True).aggregate(total=Sum('total_amount')) total = result.get('total', 0) return total if total else 0 @@ -1021,7 +1021,7 @@ class InvoiceTransaction(TimeStampedModel): """ result = cls.objects.filter(amount__gt=0, invoice__course_id=course_key, status='completed').aggregate( total=Sum('amount') - ) # pylint: disable=no-member + ) total = result.get('total', 0) return total if total else 0 @@ -1475,7 +1475,7 @@ class PaidCourseRegistration(OrderItem): total_cost = 0 result = cls.objects.filter(course_id=course_key, status=status).aggregate( total=Sum('unit_cost', field='qty * unit_cost') - ) # pylint: disable=no-member + ) if result['total'] is not None: total_cost = result['total'] @@ -1603,7 +1603,7 @@ class PaidCourseRegistration(OrderItem): sku = data['sku'] if self.course_id != CourseKeyField.Empty: data['name'] = unicode(self.course_id) - data['category'] = unicode(self.course_id.org) # pylint: disable=no-member + data['category'] = unicode(self.course_id.org) if self.mode: data['sku'] = sku + u'.' + unicode(self.mode) return data @@ -1649,7 +1649,7 @@ class CourseRegCodeItem(OrderItem): total_cost = 0 result = cls.objects.filter(course_id=course_key, status=status).aggregate( total=Sum('unit_cost', field='qty * unit_cost') - ) # pylint: disable=no-member + ) if result['total'] is not None: total_cost = result['total'] @@ -1761,7 +1761,7 @@ class CourseRegCodeItem(OrderItem): sku = data['sku'] if self.course_id != CourseKeyField.Empty: data['name'] = unicode(self.course_id) - data['category'] = unicode(self.course_id.org) # pylint: disable=no-member + data['category'] = unicode(self.course_id.org) if self.mode: data['sku'] = sku + u'.' + unicode(self.mode) return data @@ -2001,7 +2001,7 @@ class CertificateItem(OrderItem): sku = data['sku'] if self.course_id != CourseKeyField.Empty: data['name'] = unicode(self.course_id) - data['category'] = unicode(self.course_id.org) # pylint: disable=no-member + data['category'] = unicode(self.course_id.org) if self.mode: data['sku'] = sku + u'.' + unicode(self.mode) return data @@ -2169,7 +2169,7 @@ class Donation(OrderItem): data = super(Donation, self).analytics_data() if self.course_id != CourseKeyField.Empty: data['name'] = unicode(self.course_id) - data['category'] = unicode(self.course_id.org) # pylint: disable=no-member + data['category'] = unicode(self.course_id.org) else: data['name'] = settings.PLATFORM_NAME data['category'] = settings.PLATFORM_NAME diff --git a/lms/djangoapps/shoppingcart/reports.py b/lms/djangoapps/shoppingcart/reports.py index fd69b3b700..997997a37c 100644 --- a/lms/djangoapps/shoppingcart/reports.py +++ b/lms/djangoapps/shoppingcart/reports.py @@ -118,7 +118,7 @@ class ItemizedPurchaseReport(Report): for item in query: yield [ item.fulfilled_time, - item.order_id, # pylint: disable=no-member + item.order_id, item.status, item.qty, item.unit_cost, diff --git a/lms/djangoapps/shoppingcart/tests/test_models.py b/lms/djangoapps/shoppingcart/tests/test_models.py index 7ebb6aa9fa..85ab705717 100644 --- a/lms/djangoapps/shoppingcart/tests/test_models.py +++ b/lms/djangoapps/shoppingcart/tests/test_models.py @@ -707,7 +707,7 @@ class PaidCourseRegistrationTest(ModuleStoreTestCase): test_redemption = RegistrationCodeRedemption.registration_code_used_for_enrollment(enrollment) - self.assertIn(test_redemption.id, ids) # pylint: disable=no-member + self.assertIn(test_redemption.id, ids) def test_add_with_default_mode(self): """ diff --git a/lms/djangoapps/shoppingcart/tests/test_views.py b/lms/djangoapps/shoppingcart/tests/test_views.py index 96eaa975b2..484d3fd4e9 100644 --- a/lms/djangoapps/shoppingcart/tests/test_views.py +++ b/lms/djangoapps/shoppingcart/tests/test_views.py @@ -509,7 +509,7 @@ class ShoppingCartViewsTests(ModuleStoreTestCase): item = self.cart.orderitem_set.all().select_subclasses()[1] self.assertEquals(item.unit_cost, self.get_discount(self.testing_cost)) - def test_soft_delete_coupon(self): # pylint: disable=no-member + def test_soft_delete_coupon(self): self.add_coupon(self.course_key, True, self.coupon_code) coupon = Coupon(code='TestCode', description='testing', course_id=self.course_key, percentage_discount=12, created_by=self.user, is_active=True) @@ -520,25 +520,25 @@ class ShoppingCartViewsTests(ModuleStoreTestCase): get_coupon = Coupon.objects.get(id=1) request = HttpRequest() request.user = admin - setattr(request, 'session', 'session') # pylint: disable=no-member - messages = FallbackStorage(request) # pylint: disable=no-member - setattr(request, '_messages', messages) # pylint: disable=no-member + setattr(request, 'session', 'session') + messages = FallbackStorage(request) + setattr(request, '_messages', messages) coupon_admin = SoftDeleteCouponAdmin(Coupon, AdminSite()) test_query_set = coupon_admin.queryset(request) test_actions = coupon_admin.get_actions(request) self.assertIn('really_delete_selected', test_actions['really_delete_selected']) self.assertEqual(get_coupon.is_active, True) - coupon_admin.really_delete_selected(request, test_query_set) # pylint: disable=no-member + coupon_admin.really_delete_selected(request, test_query_set) for coupon in test_query_set: self.assertEqual(coupon.is_active, False) - coupon_admin.delete_model(request, get_coupon) # pylint: disable=no-member + coupon_admin.delete_model(request, get_coupon) self.assertEqual(get_coupon.is_active, False) coupon = Coupon(code='TestCode123', description='testing123', course_id=self.course_key, percentage_discount=22, created_by=self.user, is_active=True) coupon.save() test_query_set = coupon_admin.queryset(request) - coupon_admin.really_delete_selected(request, test_query_set) # pylint: disable=no-member + coupon_admin.really_delete_selected(request, test_query_set) for coupon in test_query_set: self.assertEqual(coupon.is_active, False) diff --git a/lms/djangoapps/teams/tests/test_views.py b/lms/djangoapps/teams/tests/test_views.py index 85db7abf48..6a5355eda4 100644 --- a/lms/djangoapps/teams/tests/test_views.py +++ b/lms/djangoapps/teams/tests/test_views.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- """Tests for the teams API at the HTTP request level.""" -# pylint: disable=maybe-no-member import json import ddt diff --git a/lms/djangoapps/teams/views.py b/lms/djangoapps/teams/views.py index 1cd0edec7b..dea9eaaebe 100644 --- a/lms/djangoapps/teams/views.py +++ b/lms/djangoapps/teams/views.py @@ -575,7 +575,7 @@ class TopicListView(GenericAPIView): page = self.paginate_queryset(topics) serializer = self.pagination_serializer_class(page, context={'course_id': course_id, 'sort_order': ordering}) - return Response(serializer.data) # pylint: disable=maybe-no-member + return Response(serializer.data) def get_ordered_topics(course_module, ordering): diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index cf8635b8f4..e96ad28349 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -1953,7 +1953,7 @@ class TestInCourseReverifyView(ModuleStoreTestCase): # verify that Google Analytics event fires after successfully # submitting the photo verification self.mock_tracker.track.assert_called_once_with( # pylint: disable=no-member - self.user.id, # pylint: disable=no-member + self.user.id, 'edx.bi.reverify.started', { 'category': "verification", diff --git a/lms/lib/xblock/test/test_mixin.py b/lms/lib/xblock/test/test_mixin.py index a519181249..9a5cbc327b 100644 --- a/lms/lib/xblock/test/test_mixin.py +++ b/lms/lib/xblock/test/test_mixin.py @@ -29,8 +29,8 @@ class LmsXBlockMixinTestCase(ModuleStoreTestCase): Group(1, 'beta') ] ) - self.group1 = self.user_partition.groups[0] # pylint: disable=no-member - self.group2 = self.user_partition.groups[1] # pylint: disable=no-member + self.group1 = self.user_partition.groups[0] + self.group2 = self.user_partition.groups[1] self.course = CourseFactory.create(user_partitions=[self.user_partition]) section = ItemFactory.create(parent=self.course, category='chapter', display_name='Test Section') subsection = ItemFactory.create(parent=section, category='sequential', display_name='Test Subsection') diff --git a/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py b/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py index 3faaa0de2f..55f558780d 100644 --- a/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py +++ b/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py @@ -361,7 +361,7 @@ class TestMasqueradedGroup(StaffMasqueradeTestCase): # Now setup the masquerade for the test user setup_masquerade(request, self.test_user, True) - scheme = self.user_partition.scheme # pylint: disable=no-member + scheme = self.user_partition.scheme self.assertEqual( scheme.get_group_for_user(self.course.id, self.test_user, self.user_partition), group diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py index fd3c9aaeae..fbc32382c7 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py @@ -609,7 +609,6 @@ class TestAccountAPI(UserAPITestCase): """ self.client.login(username=self.user.username, password=self.test_password) response = self.send_get(self.client) - # pylint: disable=no-member self.assertEqual( response.data["profile_image"], { diff --git a/openedx/core/djangoapps/user_api/preferences/tests/test_api.py b/openedx/core/djangoapps/user_api/preferences/tests/test_api.py index 3791bc33c4..bef0e79a67 100644 --- a/openedx/core/djangoapps/user_api/preferences/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/preferences/tests/test_api.py @@ -324,7 +324,7 @@ class UpdateEmailOptInTests(ModuleStoreTestCase): # Set year of birth user = User.objects.get(username=self.USERNAME) profile = UserProfile.objects.get(user=user) - year_of_birth = datetime.datetime.now().year - age # pylint: disable=maybe-no-member + year_of_birth = datetime.datetime.now().year - age profile.year_of_birth = year_of_birth profile.save() @@ -374,7 +374,7 @@ class UpdateEmailOptInTests(ModuleStoreTestCase): # Set year of birth user = User.objects.get(username=self.USERNAME) profile = UserProfile.objects.get(user=user) - year_of_birth = datetime.datetime.now(UTC).year - age # pylint: disable=maybe-no-member + year_of_birth = datetime.datetime.now(UTC).year - age profile.year_of_birth = year_of_birth profile.save() diff --git a/openedx/core/djangoapps/user_api/tests/test_views.py b/openedx/core/djangoapps/user_api/tests/test_views.py index c857588fcd..79e8918340 100644 --- a/openedx/core/djangoapps/user_api/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/tests/test_views.py @@ -1016,7 +1016,7 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, ApiTestCase): ) def test_register_form_year_of_birth(self): - this_year = datetime.datetime.now(UTC).year # pylint: disable=maybe-no-member + this_year = datetime.datetime.now(UTC).year year_options = ( [{"value": "", "name": "--", "default": True}] + [ {"value": unicode(year), "name": unicode(year)} diff --git a/openedx/core/djangoapps/util/testing.py b/openedx/core/djangoapps/util/testing.py index 21c1a209c2..9fcf5b1a3a 100644 --- a/openedx/core/djangoapps/util/testing.py +++ b/openedx/core/djangoapps/util/testing.py @@ -168,13 +168,13 @@ class TestConditionalContent(ModuleStoreTestCase): UserCourseTagFactory( user=self.student_a, course_id=self.course.id, - key='xblock.partition_service.partition_{0}'.format(self.partition.id), # pylint: disable=no-member + key='xblock.partition_service.partition_{0}'.format(self.partition.id), value=str(self.user_partition_group_a) ) UserCourseTagFactory( user=self.student_b, course_id=self.course.id, - key='xblock.partition_service.partition_{0}'.format(self.partition.id), # pylint: disable=no-member + key='xblock.partition_service.partition_{0}'.format(self.partition.id), value=str(self.user_partition_group_b) ) @@ -192,7 +192,7 @@ class TestConditionalContent(ModuleStoreTestCase): parent_location=problem_vertical.location, category='split_test', display_name='Split Test', - user_partition_id=self.partition.id, # pylint: disable=no-member + user_partition_id=self.partition.id, group_id_to_child={str(index): url for index, url in enumerate([vertical_a_url, vertical_b_url])} ) self.vertical_a = ItemFactory.create( diff --git a/openedx/core/lib/api/view_utils.py b/openedx/core/lib/api/view_utils.py index 79cd31492a..2a4aa6d372 100644 --- a/openedx/core/lib/api/view_utils.py +++ b/openedx/core/lib/api/view_utils.py @@ -134,8 +134,8 @@ def view_auth_classes(is_user=False): def add_serializer_errors(serializer, data, field_errors): """Adds errors from serializer validation to field_errors. data is the original data to deserialize.""" - if not serializer.is_valid(): # pylint: disable=maybe-no-member - errors = serializer.errors # pylint: disable=maybe-no-member + if not serializer.is_valid(): + errors = serializer.errors for key, error in errors.iteritems(): field_errors[key] = { 'developer_message': u"Value '{field_value}' is not valid for field '{field_name}': {error}".format(