From a18d3261e1816c59a103d63c7fc23ab1bdb05bb2 Mon Sep 17 00:00:00 2001 From: Alie Langston Date: Thu, 3 Oct 2024 09:36:14 -0400 Subject: [PATCH] fix: update tests and lint --- edx_proctoring/api.py | 2 +- edx_proctoring/backends/rest.py | 2 +- edx_proctoring/backends/software_secure.py | 2 +- edx_proctoring/rules.py | 2 +- edx_proctoring/views.py | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/edx_proctoring/api.py b/edx_proctoring/api.py index 1b1cca6a91..117b725576 100644 --- a/edx_proctoring/api.py +++ b/edx_proctoring/api.py @@ -1669,7 +1669,7 @@ def update_attempt_status(attempt_id, to_status, if email: try: email.send() - except Exception as err: # pylint: disable=broad-except + except Exception as err: log.exception( ('Exception occurred while trying to send proctoring attempt ' 'status email for user_id=%(user_id)s in course_id=%(course_id)s -- %(err)s'), diff --git a/edx_proctoring/backends/rest.py b/edx_proctoring/backends/rest.py index ae6ceae7bf..963fc1d46a 100644 --- a/edx_proctoring/backends/rest.py +++ b/edx_proctoring/backends/rest.py @@ -274,7 +274,7 @@ def on_exam_saved(self, exam): try: response = self.session.post(url, json=exam) data = response.json() - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: if response: if hasattr(exc, 'response') and exc.response is not None: content = exc.response.content diff --git a/edx_proctoring/backends/software_secure.py b/edx_proctoring/backends/software_secure.py index 68b0f16897..3c1f2b81a8 100644 --- a/edx_proctoring/backends/software_secure.py +++ b/edx_proctoring/backends/software_secure.py @@ -409,7 +409,7 @@ def get_instructor_url( # reformat video url as per MST-871 findings reformatted_url = decrypted_video_url.replace('DirectLink-Generic', 'DirectLink-HTML5') return reformatted_url - except Exception as err: # pylint: disable=broad-except + except Exception as err: log.exception( 'Could not decrypt video url for attempt_id=%(attempt_id)s ' 'due to the following error: %(error_string)s', diff --git a/edx_proctoring/rules.py b/edx_proctoring/rules.py index 0ebde0d0e7..81a084fe57 100644 --- a/edx_proctoring/rules.py +++ b/edx_proctoring/rules.py @@ -12,5 +12,5 @@ def is_in_reviewer_group(user, attempt): return user.groups.filter(name=backend_group).exists() -# pylint: disable=unsupported-binary-operation +# pylint: disable-next=unsupported-binary-operation rules.add_perm('edx_proctoring.can_review_attempt', is_in_reviewer_group | rules.is_staff) diff --git a/edx_proctoring/views.py b/edx_proctoring/views.py index c955dae7ed..db3d628b0d 100644 --- a/edx_proctoring/views.py +++ b/edx_proctoring/views.py @@ -640,7 +640,7 @@ class StudentOnboardingStatusView(ProctoredAPIView): * 'onboarding_past_due': Whether the onboarding exam is past due. All onboarding exams in the course must be past due in order for onboarding_past_due to be true. """ - def get(self, request): + def get(self, request): # pylint: disable=too-many-statements """ HTTP GET handler. Returns the learner's onboarding status. """ @@ -679,7 +679,7 @@ def get(self, request): onboarding_exams = list(ProctoredExam.get_practice_proctored_exams_for_course(course_id).order_by('-created')) provider = None try: - provider = get_backend_provider(name=onboarding_exams[0].backend) + provider = get_backend_provider(name=onboarding_exams[0].backend) if onboarding_exams else None except NotImplementedError: logging.exception( 'No proctoring backend configured for backend=%(backend)s', @@ -860,7 +860,7 @@ def get(self, request, course_id): .order_by('-created').first()) provider = None try: - provider = get_backend_provider(name=onboarding_exam.backend) + provider = get_backend_provider(name=onboarding_exam.backend) if onboarding_exam else None except NotImplementedError: logging.exception( 'No proctoring backend configured for backend=%(backend)s',