From 3ff3eee2f2e059ac0ce599594478648bad5c545e Mon Sep 17 00:00:00 2001 From: Jeremy Bowman Date: Mon, 20 Aug 2018 12:02:26 -0400 Subject: [PATCH] TE-2689 Remove useless pylint suppressions part 4 --- common/djangoapps/third_party_auth/admin.py | 2 +- .../third_party_auth/api/tests/test_views.py | 1 - .../third_party_auth/tests/specs/test_azuread.py | 1 - .../third_party_auth/tests/specs/test_google.py | 4 ++-- .../third_party_auth/tests/test_admin.py | 1 - .../third_party_auth/tests/test_pipeline.py | 5 ----- .../tests/test_pipeline_integration.py | 1 - .../djangoapps/third_party_auth/tests/testutil.py | 2 +- common/test/acceptance/pages/lms/courseware.py | 14 +++++++------- .../acceptance/pages/lms/instructor_dashboard.py | 4 ++-- common/test/acceptance/pages/studio/container.py | 2 -- common/test/acceptance/pages/studio/overview.py | 4 ++-- common/test/acceptance/tests/discussion/helpers.py | 4 ++-- .../acceptance/tests/discussion/test_discussion.py | 2 +- .../acceptance/tests/lms/test_account_settings.py | 1 - common/test/acceptance/tests/lms/test_bookmarks.py | 2 +- .../acceptance/tests/lms/test_learner_profile.py | 2 +- .../acceptance/tests/lms/test_lms_user_preview.py | 2 +- .../acceptance/tests/lms/test_progress_page.py | 2 +- common/test/acceptance/tests/lms/test_teams.py | 2 -- .../acceptance/tests/studio/test_studio_general.py | 2 +- .../acceptance/tests/video/test_video_module.py | 2 +- common/test/utils.py | 2 +- openedx/core/djangolib/tests/test_markup.py | 2 +- openedx/core/lib/api/tests/test_authentication.py | 10 +++++----- openedx/core/lib/api/view_utils.py | 2 +- openedx/core/lib/django_courseware_routers.py | 2 +- openedx/core/lib/gating/api.py | 2 +- openedx/core/lib/gating/tests/test_api.py | 2 +- openedx/core/lib/tests/test_token_utils.py | 2 +- openedx/core/lib/xblock_utils/__init__.py | 2 +- .../tests/test_course_bookmarks.py | 2 -- .../course_experience/tests/views/helpers.py | 2 +- .../tests/views/test_course_home.py | 2 -- .../tests/views/test_course_outline.py | 2 +- .../tests/views/test_course_updates.py | 2 -- openedx/features/enterprise_support/api.py | 2 +- openedx/features/enterprise_support/apps.py | 2 +- openedx/features/enterprise_support/signals.py | 2 +- .../enterprise_support/tests/mixins/enterprise.py | 4 ++-- .../tests/views/test_learner_profile.py | 2 +- openedx/tests/xblock_integration/test_done.py | 1 - .../xblock_integration/test_external_xblocks.py | 2 +- pavelib/paver_tests/test_servers.py | 1 - scripts/thresholds.sh | 2 +- 45 files changed, 47 insertions(+), 69 deletions(-) diff --git a/common/djangoapps/third_party_auth/admin.py b/common/djangoapps/third_party_auth/admin.py index 703196e19e..4387a26c3c 100644 --- a/common/djangoapps/third_party_auth/admin.py +++ b/common/djangoapps/third_party_auth/admin.py @@ -167,7 +167,7 @@ class SAMLProviderDataAdmin(admin.ModelAdmin): def get_readonly_fields(self, request, obj=None): if obj: # editing an existing object - return [field.name for field in self.model._meta.get_fields()] # pylint: disable=protected-access + return [field.name for field in self.model._meta.get_fields()] return self.readonly_fields diff --git a/common/djangoapps/third_party_auth/api/tests/test_views.py b/common/djangoapps/third_party_auth/api/tests/test_views.py index 6dd5367eaa..2fac4d2a5c 100644 --- a/common/djangoapps/third_party_auth/api/tests/test_views.py +++ b/common/djangoapps/third_party_auth/api/tests/test_views.py @@ -1,4 +1,3 @@ -# pylint: disable=no-member """ Tests for the Third Party Auth REST API """ diff --git a/common/djangoapps/third_party_auth/tests/specs/test_azuread.py b/common/djangoapps/third_party_auth/tests/specs/test_azuread.py index 56bcfc2e03..1cf21d5a8e 100644 --- a/common/djangoapps/third_party_auth/tests/specs/test_azuread.py +++ b/common/djangoapps/third_party_auth/tests/specs/test_azuread.py @@ -3,7 +3,6 @@ from third_party_auth.tests.specs import base -# pylint: disable=test-inherits-tests class AzureADOauth2IntegrationTest(base.Oauth2IntegrationTest): """Integration tests for Azure Active Directory / Microsoft Account provider.""" diff --git a/common/djangoapps/third_party_auth/tests/specs/test_google.py b/common/djangoapps/third_party_auth/tests/specs/test_google.py index 00a4e4cb7b..d3dd6eeb7b 100644 --- a/common/djangoapps/third_party_auth/tests/specs/test_google.py +++ b/common/djangoapps/third_party_auth/tests/specs/test_google.py @@ -77,7 +77,7 @@ class GoogleOauth2IntegrationTest(base.Oauth2IntegrationTest): response = self.client.get(response['Location']) self.assertEqual(response.status_code, 200) self.assertIn('action="/misc/my-custom-registration-form" method="post"', response.content) - data_decoded = base64.b64decode(response.context['data']) # pylint: disable=no-member + data_decoded = base64.b64decode(response.context['data']) data_parsed = json.loads(data_decoded) # The user's details get passed to the custom page as a base64 encoded query parameter: self.assertEqual(data_parsed, { @@ -95,7 +95,7 @@ class GoogleOauth2IntegrationTest(base.Oauth2IntegrationTest): # Check the hash that is used to confirm the user's data in the GET parameter is correct secret_key = settings.THIRD_PARTY_AUTH_CUSTOM_AUTH_FORMS['custom1']['secret_key'] hmac_expected = hmac.new(secret_key, msg=data_decoded, digestmod=hashlib.sha256).digest() - self.assertEqual(base64.b64decode(response.context['hmac']), hmac_expected) # pylint: disable=no-member + self.assertEqual(base64.b64decode(response.context['hmac']), hmac_expected) # Now our custom registration form creates or logs in the user: email, password = data_parsed['user_details']['email'], 'random_password' diff --git a/common/djangoapps/third_party_auth/tests/test_admin.py b/common/djangoapps/third_party_auth/tests/test_admin.py index 32fe1377c8..0bc674328e 100644 --- a/common/djangoapps/third_party_auth/tests/test_admin.py +++ b/common/djangoapps/third_party_auth/tests/test_admin.py @@ -58,7 +58,6 @@ class Oauth2ProviderConfigAdminTest(testutil.TestCase): # Edit the provider via the admin edit link admin = OAuth2ProviderConfigAdmin(provider1, AdminSite()) - # pylint: disable=protected-access update_url = reverse('admin:{}_{}_add'.format(admin.model._meta.app_label, admin.model._meta.model_name)) update_url += "?source={}".format(provider1.pk) diff --git a/common/djangoapps/third_party_auth/tests/test_pipeline.py b/common/djangoapps/third_party_auth/tests/test_pipeline.py index 55ea8788e6..b4f700275b 100644 --- a/common/djangoapps/third_party_auth/tests/test_pipeline.py +++ b/common/djangoapps/third_party_auth/tests/test_pipeline.py @@ -1,16 +1,11 @@ """Unit tests for third_party_auth/pipeline.py.""" -import random import unittest from third_party_auth import pipeline from third_party_auth.tests import testutil -# Allow tests access to protected methods (or module-protected methods) under test. -# pylint: disable=protected-access - - @unittest.skipUnless(testutil.AUTH_FEATURE_ENABLED, testutil.AUTH_FEATURES_KEY + ' not enabled') class ProviderUserStateTestCase(testutil.TestCase): """Tests ProviderUserState behavior.""" 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 510d0c8f90..6e4bd350e2 100644 --- a/common/djangoapps/third_party_auth/tests/test_pipeline_integration.py +++ b/common/djangoapps/third_party_auth/tests/test_pipeline_integration.py @@ -345,7 +345,6 @@ class UserDetailsForceSyncTestCase(testutil.TestCase, test.TestCase): def setUp(self): super(UserDetailsForceSyncTestCase, self).setUp() - # pylint: disable=attribute-defined-outside-init self.user = UserFactory.create() self.old_email = self.user.email self.old_username = self.user.username diff --git a/common/djangoapps/third_party_auth/tests/testutil.py b/common/djangoapps/third_party_auth/tests/testutil.py index 6d963757a2..cff85e6add 100644 --- a/common/djangoapps/third_party_auth/tests/testutil.py +++ b/common/djangoapps/third_party_auth/tests/testutil.py @@ -59,7 +59,7 @@ class ThirdPartyAuthTestMixin(object): # Django's FileSystemStorage will rename files if they already exist. # This storage backend overwrites files instead, which makes it easier # to make assertions about filenames. - icon_image_field = OAuth2ProviderConfig._meta.get_field('icon_image') # pylint: disable=protected-access + icon_image_field = OAuth2ProviderConfig._meta.get_field('icon_image') patch = mock.patch.object(icon_image_field, 'storage', OverwriteStorage()) patch.start() self.addCleanup(patch.stop) diff --git a/common/test/acceptance/pages/lms/courseware.py b/common/test/acceptance/pages/lms/courseware.py index 6dabe9f2e5..cd1e71e781 100644 --- a/common/test/acceptance/pages/lms/courseware.py +++ b/common/test/acceptance/pages/lms/courseware.py @@ -155,27 +155,27 @@ class CoursewarePage(CoursePage, CompletionOnViewMixin): return int(tab_id.split('_')[1]) @property - def _active_sequence_tab(self): # pylint: disable=missing-docstring + def _active_sequence_tab(self): return self.q(css='#sequence-list .nav-item.active') @property - def is_next_button_enabled(self): # pylint: disable=missing-docstring + def is_next_button_enabled(self): return not self.q(css='.sequence-nav > .sequence-nav-button.button-next.disabled').is_present() @property - def is_previous_button_enabled(self): # pylint: disable=missing-docstring + def is_previous_button_enabled(self): return not self.q(css='.sequence-nav > .sequence-nav-button.button-previous.disabled').is_present() - def click_next_button_on_top(self): # pylint: disable=missing-docstring + def click_next_button_on_top(self): self._click_navigation_button('sequence-nav', 'button-next') - def click_next_button_on_bottom(self): # pylint: disable=missing-docstring + def click_next_button_on_bottom(self): self._click_navigation_button('sequence-bottom', 'button-next') - def click_previous_button_on_top(self): # pylint: disable=missing-docstring + def click_previous_button_on_top(self): self._click_navigation_button('sequence-nav', 'button-previous') - def click_previous_button_on_bottom(self): # pylint: disable=missing-docstring + def click_previous_button_on_bottom(self): self._click_navigation_button('sequence-bottom', 'button-previous') def _click_navigation_button(self, top_or_bottom_class, next_or_previous_class): diff --git a/common/test/acceptance/pages/lms/instructor_dashboard.py b/common/test/acceptance/pages/lms/instructor_dashboard.py index 91e7ef30ce..295e097f05 100644 --- a/common/test/acceptance/pages/lms/instructor_dashboard.py +++ b/common/test/acceptance/pages/lms/instructor_dashboard.py @@ -1480,7 +1480,7 @@ class CertificatesPage(PageObject): return self.get_selector('#btn-start-generating-certificates') @property - def generate_certificates_disabled_button(self): # pylint: disable=invalid-name + def generate_certificates_disabled_button(self): """ Returns the disabled state of button """ @@ -1529,7 +1529,7 @@ class CertificatesPage(PageObject): return self.get_selector('div.certificate-invalidation-container table tr:last-child td') @property - def certificate_invalidation_message(self): # pylint: disable=invalid-name + def certificate_invalidation_message(self): """ Returns the message (error/success) in "Certificate Invalidation" section. """ diff --git a/common/test/acceptance/pages/studio/container.py b/common/test/acceptance/pages/studio/container.py index ed99fe4f9d..663b637e51 100644 --- a/common/test/acceptance/pages/studio/container.py +++ b/common/test/acceptance/pages/studio/container.py @@ -488,7 +488,6 @@ class XBlockWrapper(PageObject): return self._validation_paragraph('error').present @property - # pylint: disable=invalid-name def has_validation_not_configured_warning(self): """ Is a validation "not configured" message shown? """ return self._validation_paragraph('not-configured').present @@ -508,7 +507,6 @@ class XBlockWrapper(PageObject): return self.q(css=self._bounded_selector('{} .xblock-message-item.error'.format(self.VALIDATION_SELECTOR))).text @property - # pylint: disable=invalid-name def validation_not_configured_warning_text(self): """ Get the text of the validation "not configured" message. """ return self._validation_paragraph('not-configured').text[0] diff --git a/common/test/acceptance/pages/studio/overview.py b/common/test/acceptance/pages/studio/overview.py index 911a81dc45..dbad6c97d1 100644 --- a/common/test/acceptance/pages/studio/overview.py +++ b/common/test/acceptance/pages/studio/overview.py @@ -38,7 +38,7 @@ class CourseOutlineItem(object): # Check for the existence of a locator so that errors when navigating to the course outline page don't show up # as errors in the repr method instead. try: - return "{}(, {!r})".format(self.__class__.__name__, self.locator) # pylint: disable=no-member + return "{}(, {!r})".format(self.__class__.__name__, self.locator) except AttributeError: return "{}()".format(self.__class__.__name__) @@ -1179,7 +1179,7 @@ class SubsectionOutlineModal(CourseOutlineModal): return self.find_css('input[name=content-visibility]:checked').first.attrs('value')[0] @is_explicitly_locked.setter - def is_explicitly_locked(self, value): # pylint: disable=arguments-differ + def is_explicitly_locked(self, value): """ Override - sets visibility to staff_only if True, else 'visible'. diff --git a/common/test/acceptance/tests/discussion/helpers.py b/common/test/acceptance/tests/discussion/helpers.py index 59cd1fc782..677592e7b3 100644 --- a/common/test/acceptance/tests/discussion/helpers.py +++ b/common/test/acceptance/tests/discussion/helpers.py @@ -43,8 +43,8 @@ class BaseDiscussionMixin(object): """ Set up multiple threads on the page by passing 'thread_count'. """ - self.thread_ids = [] # pylint: disable=attribute-defined-outside-init - threads = [] # pylint: disable=attribute-defined-outside-init + self.thread_ids = [] + threads = [] for i in range(thread_count): thread_id = "test_thread_{}_{}".format(i, uuid4().hex) thread_body = "Dummy long text body." * 50 diff --git a/common/test/acceptance/tests/discussion/test_discussion.py b/common/test/acceptance/tests/discussion/test_discussion.py index ed0dd9469d..4816d37d7d 100644 --- a/common/test/acceptance/tests/discussion/test_discussion.py +++ b/common/test/acceptance/tests/discussion/test_discussion.py @@ -414,7 +414,7 @@ class DiscussionTabSingleThreadTest(BaseDiscussionTestCase, DiscussionResponsePa Response(id="response1"), [Comment(id="comment1")]) thread_fixture.push() - self.setup_thread_page(thread.get("id")) # pylint: disable=no-member + self.setup_thread_page(thread.get("id")) # Verify that `Add a Post` is not visible on course tab nav. self.assertFalse(self.tab_nav.has_new_post_button_visible_on_tab()) diff --git a/common/test/acceptance/tests/lms/test_account_settings.py b/common/test/acceptance/tests/lms/test_account_settings.py index b353c631fb..7e12e42caf 100644 --- a/common/test/acceptance/tests/lms/test_account_settings.py +++ b/common/test/acceptance/tests/lms/test_account_settings.py @@ -29,7 +29,6 @@ class AccountSettingsTestMixin(EventsTestMixin, AcceptanceTest): Visit the account settings page for the current user, and store the page instance as self.account_settings_page. """ - # pylint: disable=attribute-defined-outside-init self.account_settings_page = AccountSettingsPage(self.browser) self.account_settings_page.visit() self.account_settings_page.wait_for_ajax() diff --git a/common/test/acceptance/tests/lms/test_bookmarks.py b/common/test/acceptance/tests/lms/test_bookmarks.py index 1207b7c91a..7edd581917 100644 --- a/common/test/acceptance/tests/lms/test_bookmarks.py +++ b/common/test/acceptance/tests/lms/test_bookmarks.py @@ -67,7 +67,7 @@ class BookmarksTestMixin(EventsTestMixin, UniqueCourseTest): Arguments: num_chapters: number of chapters to create """ - self.course_fixture = CourseFixture( # pylint: disable=attribute-defined-outside-init + self.course_fixture = CourseFixture( self.course_info['org'], self.course_info['number'], self.course_info['run'], self.course_info['display_name'] ) diff --git a/common/test/acceptance/tests/lms/test_learner_profile.py b/common/test/acceptance/tests/lms/test_learner_profile.py index 69f45a036d..10c4ebf21c 100644 --- a/common/test/acceptance/tests/lms/test_learner_profile.py +++ b/common/test/acceptance/tests/lms/test_learner_profile.py @@ -79,7 +79,7 @@ class LearnerProfileTestMixin(EventsTestMixin): # Reset event tracking so that the tests only see events from # loading the profile page. - self.start_time = datetime.now() # pylint: disable=attribute-defined-outside-init + self.start_time = datetime.now() # Load the page profile_page.visit() diff --git a/common/test/acceptance/tests/lms/test_lms_user_preview.py b/common/test/acceptance/tests/lms/test_lms_user_preview.py index 53c86a08b8..f84daf4461 100644 --- a/common/test/acceptance/tests/lms/test_lms_user_preview.py +++ b/common/test/acceptance/tests/lms/test_lms_user_preview.py @@ -34,7 +34,7 @@ class StaffViewTest(UniqueCourseTest): self.course_info['run'], self.course_info['display_name'] ) - self.populate_course_fixture(self.course_fixture) # pylint: disable=no-member + self.populate_course_fixture(self.course_fixture) self.course_fixture.install() diff --git a/common/test/acceptance/tests/lms/test_progress_page.py b/common/test/acceptance/tests/lms/test_progress_page.py index 9d0e3ea910..cfa75723f4 100644 --- a/common/test/acceptance/tests/lms/test_progress_page.py +++ b/common/test/acceptance/tests/lms/test_progress_page.py @@ -42,7 +42,7 @@ class ProgressPageBaseTest(UniqueCourseTest): def setUp(self): super(ProgressPageBaseTest, self).setUp() self.courseware_page = CoursewarePage(self.browser, self.course_id) - self.problem_page = ProblemPage(self.browser) # pylint: disable=attribute-defined-outside-init + self.problem_page = ProblemPage(self.browser) self.progress_page = ProgressPage(self.browser, self.course_id) self.logout_page = LogoutPage(self.browser) diff --git a/common/test/acceptance/tests/lms/test_teams.py b/common/test/acceptance/tests/lms/test_teams.py index 2f1316042a..233777b820 100644 --- a/common/test/acceptance/tests/lms/test_teams.py +++ b/common/test/acceptance/tests/lms/test_teams.py @@ -921,7 +921,6 @@ class TeamFormActions(TeamsTabBase): def verify_and_navigate_to_edit_team_page(self): """Navigates to the edit team page and verifies.""" - # pylint: disable=no-member self.assertEqual(self.team_page.team_name, self.team['name']) self.assertTrue(self.team_page.edit_team_button_present) @@ -942,7 +941,6 @@ class TeamFormActions(TeamsTabBase): def verify_team_info(self, name, description, location, language): """Verify the team information on team page.""" - # pylint: disable=no-member self.assertEqual(self.team_page.team_name, name) self.assertEqual(self.team_page.team_description, description) self.assertEqual(self.team_page.team_location, location) diff --git a/common/test/acceptance/tests/studio/test_studio_general.py b/common/test/acceptance/tests/studio/test_studio_general.py index 8dfbcb4c7f..469f701f8f 100644 --- a/common/test/acceptance/tests/studio/test_studio_general.py +++ b/common/test/acceptance/tests/studio/test_studio_general.py @@ -72,7 +72,7 @@ class SignUpAndSignInTest(UniqueCourseTest): """ shard = 21 - def setUp(self): # pylint: disable=arguments-differ + def setUp(self): super(SignUpAndSignInTest, self).setUp() self.sign_up_page = SignupPage(self.browser) self.login_page = LoginPage(self.browser) diff --git a/common/test/acceptance/tests/video/test_video_module.py b/common/test/acceptance/tests/video/test_video_module.py index e04dae2581..d0bb564ed0 100644 --- a/common/test/acceptance/tests/video/test_video_module.py +++ b/common/test/acceptance/tests/video/test_video_module.py @@ -53,7 +53,7 @@ class VideoBaseTest(UniqueCourseTest): Initialization of pages and course fixture for video tests """ super(VideoBaseTest, self).setUp() - self.longMessage = True # pylint: disable=invalid-name + self.longMessage = True self.video = VideoPage(self.browser) self.tab_nav = TabNavPage(self.browser) diff --git a/common/test/utils.py b/common/test/utils.py index 0457ead3eb..d4012d8006 100644 --- a/common/test/utils.py +++ b/common/test/utils.py @@ -91,7 +91,7 @@ class MockSignalHandlerMixin(object): mock_signal.connect(mock_handler) yield self.assertTrue(mock_handler.called) - mock_args, mock_kwargs = mock_handler.call_args # pylint: disable=unpacking-non-sequence + mock_args, mock_kwargs = mock_handler.call_args if 'exclude_args' in kwargs: for key in kwargs['exclude_args']: self.assertIn(key, mock_kwargs) diff --git a/openedx/core/djangolib/tests/test_markup.py b/openedx/core/djangolib/tests/test_markup.py index b870074730..fb4e7a0633 100644 --- a/openedx/core/djangolib/tests/test_markup.py +++ b/openedx/core/djangolib/tests/test_markup.py @@ -27,7 +27,7 @@ class FormatHtmlTest(unittest.TestCase): (u"нтмℓ-єѕ¢αρє∂", u"<a>нтмℓ-єѕ¢αρє∂</a>"), ) def test_simple(self, (before, after)): - self.assertEqual(unicode(Text(_(before))), after) # pylint: disable=translation-of-non-string + self.assertEqual(unicode(Text(_(before))), after) self.assertEqual(unicode(Text(before)), after) def test_formatting(self): diff --git a/openedx/core/lib/api/tests/test_authentication.py b/openedx/core/lib/api/tests/test_authentication.py index 66c77d8ec9..5194defc20 100644 --- a/openedx/core/lib/api/tests/test_authentication.py +++ b/openedx/core/lib/api/tests/test_authentication.py @@ -38,20 +38,20 @@ factory = APIRequestFactory() # pylint: disable=invalid-name class MockView(APIView): # pylint: disable=missing-docstring permission_classes = (IsAuthenticated,) - def get(self, request): # pylint: disable=unused-argument + def get(self, _request): return HttpResponse({'a': 1, 'b': 2, 'c': 3}) - def post(self, request): # pylint: disable=unused-argument + def post(self, _request): return HttpResponse({'a': 1, 'b': 2, 'c': 3}) - def put(self, request): # pylint: disable=unused-argument + def put(self, _request): return HttpResponse({'a': 1, 'b': 2, 'c': 3}) # This is the a change we've made from the django-rest-framework-oauth version # of these tests. We're subclassing our custom OAuth2AuthenticationAllowInactiveUser # instead of OAuth2Authentication. -class OAuth2AuthenticationDebug(authentication.OAuth2AuthenticationAllowInactiveUser): # pylint: disable=missing-docstring +class OAuth2AuthenticationDebug(authentication.OAuth2AuthenticationAllowInactiveUser): allow_query_params_token = True @@ -164,7 +164,7 @@ class OAuth2Tests(TestCase): self.assertEqual(response.status_code, status_code) self.assertEqual(response_dict['error_code'], error_code) - def _create_authorization_header(self, token=None): # pylint: disable=missing-docstring + def _create_authorization_header(self, token=None): if token is None: token = self.access_token.token return "Bearer {0}".format(token) diff --git a/openedx/core/lib/api/view_utils.py b/openedx/core/lib/api/view_utils.py index 729d5eb128..8fa53c279a 100644 --- a/openedx/core/lib/api/view_utils.py +++ b/openedx/core/lib/api/view_utils.py @@ -151,7 +151,7 @@ def build_api_error(message, **kwargs): """ return { 'developer_message': message.format(**kwargs), - 'user_message': _(message).format(**kwargs), # pylint: disable=translation-of-non-string + 'user_message': _(message).format(**kwargs), } diff --git a/openedx/core/lib/django_courseware_routers.py b/openedx/core/lib/django_courseware_routers.py index 5d6ecec3de..af2770e530 100644 --- a/openedx/core/lib/django_courseware_routers.py +++ b/openedx/core/lib/django_courseware_routers.py @@ -15,7 +15,7 @@ class StudentModuleHistoryExtendedRouter(object): Return True if ``model`` is courseware.StudentModuleHistoryExtended. """ return ( - model._meta.app_label == 'coursewarehistoryextended' and # pylint: disable=protected-access + model._meta.app_label == 'coursewarehistoryextended' and model.__name__ == 'StudentModuleHistoryExtended' ) diff --git a/openedx/core/lib/gating/api.py b/openedx/core/lib/gating/api.py index 60fd130333..c4bc6ab7c5 100644 --- a/openedx/core/lib/gating/api.py +++ b/openedx/core/lib/gating/api.py @@ -91,7 +91,7 @@ def gating_enabled(default=None): otherwise the result of the decorated function """ def wrap(f): # pylint: disable=missing-docstring - def function_wrapper(course, *args): # pylint: disable=missing-docstring + def function_wrapper(course, *args): if not course.enable_subsection_gating: return default return f(course, *args) diff --git a/openedx/core/lib/gating/tests/test_api.py b/openedx/core/lib/gating/tests/test_api.py index ac80dd34c5..122f0e8202 100644 --- a/openedx/core/lib/gating/tests/test_api.py +++ b/openedx/core/lib/gating/tests/test_api.py @@ -180,7 +180,7 @@ class TestGatingApi(ModuleStoreTestCase, MilestonesTestCaseMixin): self.assertEqual(gating_api.get_gated_content(self.course, staff), []) self.assertEqual(gating_api.get_gated_content(self.course, student), [unicode(self.seq2.location)]) - milestones_api.add_user_milestone({'id': student.id}, milestone) # pylint: disable=no-member + milestones_api.add_user_milestone({'id': student.id}, milestone) self.assertEqual(gating_api.get_gated_content(self.course, student), []) diff --git a/openedx/core/lib/tests/test_token_utils.py b/openedx/core/lib/tests/test_token_utils.py index a46ebe5700..6d4460f587 100644 --- a/openedx/core/lib/tests/test_token_utils.py +++ b/openedx/core/lib/tests/test_token_utils.py @@ -40,7 +40,7 @@ class TestJwtBuilder(mixins.AccessTokenMixin, TestCase): """ Verify that token construction succeeds if the UserProfile is missing. """ - self.profile.delete() # pylint: disable=no-member + self.profile.delete() scopes = ['profile'] token = JwtBuilder(self.user).build_token(scopes, self.expires_in) diff --git a/openedx/core/lib/xblock_utils/__init__.py b/openedx/core/lib/xblock_utils/__init__.py index 9385e486d9..3c6f968c25 100644 --- a/openedx/core/lib/xblock_utils/__init__.py +++ b/openedx/core/lib/xblock_utils/__init__.py @@ -62,7 +62,7 @@ def wrap_xblock( block, view, frag, - context, # pylint: disable=unused-argument + context, usage_id_serializer, request_token, # pylint: disable=redefined-outer-name display_name_only=False, diff --git a/openedx/features/course_bookmarks/tests/test_course_bookmarks.py b/openedx/features/course_bookmarks/tests/test_course_bookmarks.py index 55ffff8fba..f7d86f59f6 100644 --- a/openedx/features/course_bookmarks/tests/test_course_bookmarks.py +++ b/openedx/features/course_bookmarks/tests/test_course_bookmarks.py @@ -22,8 +22,6 @@ class TestCourseBookmarksTool(SharedModuleStoreTestCase): """ Set up a course to be used for testing. """ - # setUpClassAndTestData() already calls setUpClass on SharedModuleStoreTestCase - # pylint: disable=super-method-not-called with super(TestCourseBookmarksTool, cls).setUpClassAndTestData(): with cls.store.default_store(ModuleStoreEnum.Type.split): cls.course = CourseFactory.create() diff --git a/openedx/features/course_experience/tests/views/helpers.py b/openedx/features/course_experience/tests/views/helpers.py index b554085159..24922add83 100644 --- a/openedx/features/course_experience/tests/views/helpers.py +++ b/openedx/features/course_experience/tests/views/helpers.py @@ -25,5 +25,5 @@ def add_course_mode(course, upgrade_deadline_expired=False): mode_slug=CourseMode.VERIFIED, mode_display_name="Verified Certificate", min_price=TEST_COURSE_PRICE, - _expiration_datetime=upgrade_exp_date, # pylint: disable=protected-access + _expiration_datetime=upgrade_exp_date, ).save() diff --git a/openedx/features/course_experience/tests/views/test_course_home.py b/openedx/features/course_experience/tests/views/test_course_home.py index 9598192f9b..ad298ca7d0 100644 --- a/openedx/features/course_experience/tests/views/test_course_home.py +++ b/openedx/features/course_experience/tests/views/test_course_home.py @@ -89,8 +89,6 @@ class CourseHomePageTestCase(SharedModuleStoreTestCase): """ Set up a course to be used for testing. """ - # setUpClassAndTestData() already calls setUpClass on SharedModuleStoreTestCase - # pylint: disable=super-method-not-called with super(CourseHomePageTestCase, cls).setUpClassAndTestData(): with cls.store.default_store(ModuleStoreEnum.Type.split): cls.course = CourseFactory.create( diff --git a/openedx/features/course_experience/tests/views/test_course_outline.py b/openedx/features/course_experience/tests/views/test_course_outline.py index b9f61b3630..23cd71339d 100644 --- a/openedx/features/course_experience/tests/views/test_course_outline.py +++ b/openedx/features/course_experience/tests/views/test_course_outline.py @@ -565,7 +565,7 @@ class TestCourseOutlineResumeCourse(SharedModuleStoreTestCase, CompletionWaffleT switches = waffle.waffle() # pylint: disable=protected-access switch_name = switches._namespaced_name(waffle.ENABLE_COMPLETION_TRACKING) - switch, _ = Switch.objects.get_or_create(name=switch_name) # pylint: disable=unpacking-non-sequence + switch, _ = Switch.objects.get_or_create(name=switch_name) self.assertEqual(switch.created, view._completion_data_collection_start()) diff --git a/openedx/features/course_experience/tests/views/test_course_updates.py b/openedx/features/course_experience/tests/views/test_course_updates.py index 30617d3a55..5891c4688f 100644 --- a/openedx/features/course_experience/tests/views/test_course_updates.py +++ b/openedx/features/course_experience/tests/views/test_course_updates.py @@ -82,8 +82,6 @@ class TestCourseUpdatesPage(SharedModuleStoreTestCase): @classmethod def setUpClass(cls): """Set up the simplest course possible.""" - # setUpClassAndTestData() already calls setUpClass on SharedModuleStoreTestCase - # pylint: disable=super-method-not-called with super(TestCourseUpdatesPage, cls).setUpClassAndTestData(): with cls.store.default_store(ModuleStoreEnum.Type.split): cls.course = CourseFactory.create() diff --git a/openedx/features/enterprise_support/api.py b/openedx/features/enterprise_support/api.py index 04ccfcb8a0..b6f1c75185 100644 --- a/openedx/features/enterprise_support/api.py +++ b/openedx/features/enterprise_support/api.py @@ -146,7 +146,7 @@ class EnterpriseApiClient(object): 'course_id': course_id, 'consent_granted': consent_granted, } - endpoint = getattr(self.client, 'enterprise-course-enrollment') # pylint: disable=literal-used-as-attribute + endpoint = getattr(self.client, 'enterprise-course-enrollment') try: endpoint.post(data=data) except (HttpClientError, HttpServerError): diff --git a/openedx/features/enterprise_support/apps.py b/openedx/features/enterprise_support/apps.py index 4236644fa5..8b59d783b6 100644 --- a/openedx/features/enterprise_support/apps.py +++ b/openedx/features/enterprise_support/apps.py @@ -12,4 +12,4 @@ class EnterpriseSupportConfig(AppConfig): def ready(self): # Import signals to activate signal handler for enterprise. - from . import signals # pylint: disable=unused-import, unused-variable + from . import signals # pylint: disable=unused-variable diff --git a/openedx/features/enterprise_support/signals.py b/openedx/features/enterprise_support/signals.py index 518ee05070..1d1e48e07f 100644 --- a/openedx/features/enterprise_support/signals.py +++ b/openedx/features/enterprise_support/signals.py @@ -7,7 +7,7 @@ from django.db.models.signals import post_save from django.contrib.auth.models import User from enterprise.models import EnterpriseCustomerUser -from email_marketing.tasks import update_user # pylint: disable=import-error +from email_marketing.tasks import update_user @receiver(post_save, sender=EnterpriseCustomerUser) diff --git a/openedx/features/enterprise_support/tests/mixins/enterprise.py b/openedx/features/enterprise_support/tests/mixins/enterprise.py index c307b8ae28..28c2deffd7 100644 --- a/openedx/features/enterprise_support/tests/mixins/enterprise.py +++ b/openedx/features/enterprise_support/tests/mixins/enterprise.py @@ -264,7 +264,7 @@ class EnterpriseTestConsentRequired(SimpleTestCase): while(response.status_code == 302 and 'grant_data_sharing_permissions' not in response.url): response = client.get(response.url) self.assertEqual(response.status_code, 302) - self.assertIn('grant_data_sharing_permissions', response.url) # pylint: disable=no-member + self.assertIn('grant_data_sharing_permissions', response.url) # Ensure that when consent is not necessary, the user continues through to the requested page. mock_consent_necessary.return_value = False @@ -273,5 +273,5 @@ class EnterpriseTestConsentRequired(SimpleTestCase): # If we were expecting a redirect, ensure it's not to the data sharing permission page if status_code == 302: - self.assertNotIn('grant_data_sharing_permissions', response.url) # pylint: disable=no-member + self.assertNotIn('grant_data_sharing_permissions', response.url) return response diff --git a/openedx/features/learner_profile/tests/views/test_learner_profile.py b/openedx/features/learner_profile/tests/views/test_learner_profile.py index 2b9b781826..cdf9cacddb 100644 --- a/openedx/features/learner_profile/tests/views/test_learner_profile.py +++ b/openedx/features/learner_profile/tests/views/test_learner_profile.py @@ -5,7 +5,7 @@ import datetime import ddt import mock -from lms.djangoapps.certificates.tests.factories import GeneratedCertificateFactory # pylint: disable=import-error +from lms.djangoapps.certificates.tests.factories import GeneratedCertificateFactory from lms.djangoapps.certificates.api import is_passing_status from lms.envs.test import CREDENTIALS_PUBLIC_SERVICE_URL from course_modes.models import CourseMode diff --git a/openedx/tests/xblock_integration/test_done.py b/openedx/tests/xblock_integration/test_done.py index 057165acd0..e6c889595d 100644 --- a/openedx/tests/xblock_integration/test_done.py +++ b/openedx/tests/xblock_integration/test_done.py @@ -54,7 +54,6 @@ class TestDone(XBlockTestCase): """ resp = self.ajax('toggle_button', block, data) self.assertEqual(resp.status_code, 200) - # pylint: disable=no-member self.assertEqual(resp.data, {"state": desired_state}) # pylint: disable=unused-argument diff --git a/openedx/tests/xblock_integration/test_external_xblocks.py b/openedx/tests/xblock_integration/test_external_xblocks.py index fd57a6dc8f..ade16d0150 100644 --- a/openedx/tests/xblock_integration/test_external_xblocks.py +++ b/openedx/tests/xblock_integration/test_external_xblocks.py @@ -35,7 +35,7 @@ class InvalidTestName(Exception): xblock_loaded = False # pylint: disable=invalid-name -for entrypoint in pkg_resources.iter_entry_points(group="xblock.test.v0"): # pylint: disable=no-member +for entrypoint in pkg_resources.iter_entry_points(group="xblock.test.v0"): plugin = entrypoint.load() classname = plugin.__name__ if classname in globals(): diff --git a/pavelib/paver_tests/test_servers.py b/pavelib/paver_tests/test_servers.py index 00d18eb26e..348c7089da 100644 --- a/pavelib/paver_tests/test_servers.py +++ b/pavelib/paver_tests/test_servers.py @@ -199,7 +199,6 @@ class TestPaverServerTasks(PaverTestCase): ] ) - # pylint: disable=too-many-statements def verify_server_task(self, task_name, options, contracts_default=False): """ Verify the output of a server task. diff --git a/scripts/thresholds.sh b/scripts/thresholds.sh index 8b03e59eaf..5d53e5f5be 100755 --- a/scripts/thresholds.sh +++ b/scripts/thresholds.sh @@ -2,6 +2,6 @@ set -e export LOWER_PYLINT_THRESHOLD=1000 -export UPPER_PYLINT_THRESHOLD=2975 +export UPPER_PYLINT_THRESHOLD=2900 export ESLINT_THRESHOLD=5590 export STYLELINT_THRESHOLD=973