Skip to content

Commit

Permalink
style: fix pylint errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MichaelRoytman committed Oct 18, 2024
1 parent de21193 commit 939e361
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions edx_exams/apps/api/v1/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions edx_exams/apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions edx_exams/apps/lti/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 939e361

Please sign in to comment.