From 939e361a84a0528181ccc6637aceeeffe2379e48 Mon Sep 17 00:00:00 2001 From: michaelroytman Date: Fri, 18 Oct 2024 17:26:22 -0400 Subject: [PATCH] style: fix pylint errors This commit fixes new pylint errors related to the upgrade from Pylint version 3.2.7 to 3.3.1. This commit fixes these errors by adding disable directives to legacy code. This commit also refactors log statements to be lazy. --- edx_exams/apps/api/v1/tests/test_views.py | 1 + edx_exams/apps/core/models.py | 8 ++++---- edx_exams/apps/lti/tests/test_views.py | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/edx_exams/apps/api/v1/tests/test_views.py b/edx_exams/apps/api/v1/tests/test_views.py index 462dceb2..76a5405b 100644 --- a/edx_exams/apps/api/v1/tests/test_views.py +++ b/edx_exams/apps/api/v1/tests/test_views.py @@ -1789,6 +1789,7 @@ def setUp(self): course_id=self.course_id, ) + # pylint: disable=too-many-positional-arguments def request_api(self, method, user, course_id, data=None, allowance_id=None): """ Helper function to make API request diff --git a/edx_exams/apps/core/models.py b/edx_exams/apps/core/models.py index 6c25079d..94f92b44 100644 --- a/edx_exams/apps/core/models.py +++ b/edx_exams/apps/core/models.py @@ -380,16 +380,16 @@ def create_or_update(cls, course_id, provider, escalation_email): # and duplicates made with the new provider. if provider != existing_provider: count = cls._sync_exams_with_new_provider(existing_config.course_id, provider) - log.info(f'Updated course exam configuration course_id={course_id} ' - + f'to provider={provider_name} and recreated {count} exams') + log.info('Updated course exam configuration course_id=%s to provider=%s and recreated %d exams', + course_id, provider_name, count) else: CourseExamConfiguration.objects.create( course_id=course_id, escalation_email=escalation_email, provider=provider, ) - log.info(f'Created course exam configuration course_id={course_id}, provider={provider_name}, ' - + f'escalation_email={escalation_email}') + log.info('Created course exam configuration course_id=%s, provider=%s, escalation_email=%s', + course_id, provider_name, escalation_email) @classmethod def update_course_config(cls, existing_config, new_provider, escalation_email): diff --git a/edx_exams/apps/lti/tests/test_views.py b/edx_exams/apps/lti/tests/test_views.py index 4f97d52d..87917273 100644 --- a/edx_exams/apps/lti/tests/test_views.py +++ b/edx_exams/apps/lti/tests/test_views.py @@ -158,6 +158,7 @@ def make_post_request(self, request_body, token): @patch.object(Lti1p3ApiAuthentication, 'authenticate', return_value=(AnonymousUser(), None)) @patch('edx_exams.apps.lti.views.LtiProctoringAcsPermissions.has_permission') @patch('edx_exams.apps.lti.views.get_attempt_for_user_with_attempt_number_and_resource_id') + # pylint: disable=too-many-positional-arguments def test_acs_attempt_status(self, attempt_status, expected_response_status, @@ -210,6 +211,7 @@ def test_acs_no_attempt_found(self, @patch.object(Lti1p3ApiAuthentication, 'authenticate', return_value=(AnonymousUser(), None)) @patch('edx_exams.apps.lti.views.LtiProctoringAcsPermissions.has_permission') @patch('edx_exams.apps.lti.views.get_attempt_for_user_with_attempt_number_and_resource_id') + # pylint: disable=too-many-positional-arguments def test_acs_base_parameter_missing_errors(self, acs_parameter, acs_sub_parameter, @@ -317,6 +319,7 @@ def test_acs_invalid_action(self, @patch.object(Lti1p3ApiAuthentication, 'authenticate', return_value=(AnonymousUser(), None)) @patch('edx_exams.apps.lti.views.LtiProctoringAcsPermissions.has_permission') @patch('edx_exams.apps.lti.views.get_attempt_for_user_with_attempt_number_and_resource_id') + # pylint: disable=too-many-positional-arguments def test_acs_terminate(self, reason_code, incident_severity,