Skip to content

Commit

Permalink
Merge pull request #1249 from openedx/repo-tools/upgrade-python-requi…
Browse files Browse the repository at this point in the history
…rements-528e672

chore: Upgrade Python requirements.
  • Loading branch information
feanil authored Nov 25, 2024
2 parents 528e672 + 05c6183 commit 73c7f55
Show file tree
Hide file tree
Showing 26 changed files with 252 additions and 310 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.11", "3.12"]
python-version: ["3.11", "3.12"]
node-version: ["20"]
toxenv:
[
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
run: tox

- name: Run Coverage
if: matrix.python-version == '3.8' && matrix.toxenv == 'django42-drflatest'
if: matrix.python-version == '3.12' && matrix.toxenv == 'django42-drflatest'
uses: codecov/codecov-action@v4
with:
flags: unittests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/migrations-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.8", "3.11", "3.12" ]
python-version: ["3.11", "3.12"]

steps:
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""

# Be sure to update the version number in edx_proctoring/package.json
__version__ = '5.0.0'
__version__ = '5.0.1'
6 changes: 5 additions & 1 deletion edx_proctoring/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def get_proctoring_settings_by_exam_id(exam_id):
return proctoring_settings_data


# pylint: disable=too-many-positional-arguments
def create_exam(course_id, content_id, exam_name, time_limit_mins, due_date=None,
is_proctored=True, is_practice_exam=False, external_id=None, is_active=True, hide_after_due=False,
backend=None):
Expand Down Expand Up @@ -365,6 +366,7 @@ def _get_review_policy_by_exam_id(exam_id):
return None


# pylint: disable=too-many-positional-arguments
def update_exam(exam_id, exam_name=None, time_limit_mins=None, due_date=constants.MINIMUM_TIME,
is_proctored=None, is_practice_exam=None, external_id=None, is_active=None,
hide_after_due=None, backend=None):
Expand Down Expand Up @@ -920,6 +922,7 @@ def _create_and_decline_attempt(exam_id, user_id):
)


# pylint: disable=too-many-positional-arguments
def _register_proctored_exam_attempt(user_id, exam_id, exam, attempt_code, review_policy, verified_name=None):
"""
Call the proctoring backend to register the exam attempt. If there are exceptions
Expand Down Expand Up @@ -1390,7 +1393,7 @@ def _is_attempt_resumable(attempt_obj, to_status):
return attempt_obj.is_resumable


# pylint: disable=inconsistent-return-statements
# pylint: disable=inconsistent-return-statements,too-many-positional-arguments
def update_attempt_status(attempt_id, to_status,
raise_if_not_found=True, cascade_effects=True, timeout_timestamp=None,
update_attributable_to=None):
Expand Down Expand Up @@ -1669,6 +1672,7 @@ def update_attempt_status(attempt_id, to_status,
if email:
try:
email.send()
# pylint: disable=broad-exception-caught
except Exception as err:
log.exception(
('Exception occurred while trying to send proctoring attempt '
Expand Down
2 changes: 1 addition & 1 deletion edx_proctoring/backends/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def get_attempt(self, attempt):
"""
return attempt

# pylint: disable=unused-argument
# pylint: disable=unused-argument,too-many-positional-arguments
def get_instructor_url(
self, course_id, user, exam_id=None, attempt_id=None,
show_configuration_dashboard=False, encrypted_video_review_url=None
Expand Down
3 changes: 2 additions & 1 deletion edx_proctoring/backends/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
except Exception as exc: # pylint: disable=broad-exception-caught
if response:
if hasattr(exc, 'response') and exc.response is not None:
content = exc.response.content
Expand All @@ -289,6 +289,7 @@ def on_exam_saved(self, exam):
data = {}
return data.get('id')

# pylint: disable=too-many-positional-arguments
def get_instructor_url(
self, course_id, user, exam_id=None, attempt_id=None,
show_configuration_dashboard=False, encrypted_video_review_url=None
Expand Down
4 changes: 3 additions & 1 deletion edx_proctoring/backends/software_secure.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class SoftwareSecureBackendProvider(ProctoringBackendProvider):
verbose_name = 'RPNow'
passing_statuses = SoftwareSecureReviewStatus.passing_statuses

# pylint: disable=too-many-positional-arguments
def __init__(self, organization, exam_sponsor, exam_register_endpoint,
secret_key_id, secret_key, crypto_key, software_download_url,
video_review_aes_key=None, send_email=False, **kwargs):
Expand Down Expand Up @@ -391,6 +392,7 @@ def get_video_review_aes_key(self):
"""
return self.video_review_aes_key

# pylint: disable=too-many-positional-arguments
def get_instructor_url(
self, course_id, user, exam_id=None, attempt_id=None,
show_configuration_dashboard=False, encrypted_video_review_url=None
Expand All @@ -409,7 +411,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:
except Exception as err: # pylint: disable=broad-exception-caught
log.exception(
'Could not decrypt video url for attempt_id=%(attempt_id)s '
'due to the following error: %(error_string)s',
Expand Down
1 change: 1 addition & 0 deletions edx_proctoring/backends/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def on_exam_saved(self, exam):
self.last_exam = exam
return exam.get('external_id', None) or 'externalid'

# pylint: disable=too-many-positional-arguments
def get_instructor_url(
self, course_id, user, exam_id=None, attempt_id=None,
show_configuration_dashboard=False, encrypted_video_review_url=None
Expand Down
1 change: 1 addition & 0 deletions edx_proctoring/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ class Meta:
verbose_name = 'proctored exam attempt'

@classmethod
# pylint: disable=too-many-positional-arguments
def create_exam_attempt(cls, exam_id, user_id, attempt_code,
taking_as_proctored, is_sample_attempt, external_id,
review_policy_id=None, status=None, time_remaining_seconds=None):
Expand Down
1 change: 0 additions & 1 deletion edx_proctoring/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ def is_in_reviewer_group(user, attempt):
return user.groups.filter(name=backend_group).exists()


# pylint: disable-next=unsupported-binary-operation
rules.add_perm('edx_proctoring.can_review_attempt', is_in_reviewer_group | rules.is_staff)
2 changes: 2 additions & 0 deletions edx_proctoring/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2636,6 +2636,7 @@ def test_requirement_status_order(self):
(None, False, 2, 1, 1, 0),
)
@ddt.unpack
# pylint: disable=too-many-positional-arguments
def test_are_prerequisite_satisifed(self, content_id,
expected_are_prerequisites_satisifed,
expected_len_satisfied_prerequisites,
Expand Down Expand Up @@ -2667,6 +2668,7 @@ def test_are_prerequisite_satisifed(self, content_id,
(None, False, 2, 0, 1, 1),
)
@ddt.unpack
# pylint: disable=too-many-positional-arguments
def test_declined_prerequisites(self, content_id,
expected_are_prerequisites_satisifed,
expected_len_satisfied_prerequisites,
Expand Down
7 changes: 6 additions & 1 deletion edx_proctoring/tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_credit_state(self, user_id, course_key, return_course_info=False): # py
"""
return self.status

# pylint: disable=unused-argument
# pylint: disable=unused-argument,too-many-positional-arguments
def set_credit_requirement_status(self, user_id, course_key_or_id, req_namespace,
req_name, status="satisfied", reason=None):
"""
Expand Down Expand Up @@ -148,6 +148,7 @@ def is_course_staff(self, user, course_id):
"""
return self.is_user_course_staff

# pylint: disable=too-many-positional-arguments
def send_support_notification(self, course_id, exam_name, student_username, review_status, review_url):
"""
Mocked implementation of send_support_notification
Expand Down Expand Up @@ -244,6 +245,7 @@ def __init__(self, rejected_exam_overrides_grade=True):
self.overrides = {}
self.rejected_exam_overrides_grade = rejected_exam_overrides_grade

# pylint: disable=too-many-positional-arguments
def init_grade(self, user_id, course_key_or_id, usage_key_or_id, earned_all, earned_graded):
"""Initialize a grade in MockGradesService for testing. Actual GradesService does not have this method."""
key = (user_id, course_key_or_id, usage_key_or_id)
Expand All @@ -268,6 +270,7 @@ def get_subsection_grade_override(self, user_id, course_key_or_id, usage_key_or_
key = (user_id, course_key_or_id, usage_key_or_id)
return self.overrides.get(key)

# pylint: disable=too-many-positional-arguments
def override_subsection_grade(self, user_id, course_key_or_id, usage_key_or_id, earned_all=None,
earned_graded=None, overrider=None, comment=None):
"""Sets grade override earned points for key (user_id + course_key + subsection)"""
Expand Down Expand Up @@ -387,6 +390,7 @@ def get_user_course_outline(self, course_key, user, at_time):

class MockVerifiedName:
"""Mock VerifiedName object"""
# pylint: disable=too-many-positional-arguments
def __init__(
self, user, verified_name, profile_name, verification_attempt_id=None,
proctored_exam_attempt_id=None, status=None,
Expand All @@ -408,6 +412,7 @@ def get_verified_name(self, user, is_verified=False, statuses_to_exclude=None):
""" Return mock VerifiedName """
return self.verified_name

# pylint: disable=too-many-positional-arguments
def create_verified_name(
self, user, verified_name, profile_name, verification_attempt_id=None,
proctored_exam_attempt_id=None, status=None,
Expand Down
1 change: 1 addition & 0 deletions edx_proctoring/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,7 @@ def test_staff_only_allowed(self):
(VerificientOnboardingProfileStatus.expired, ProctoredExamStudentAttemptStatus.expired)
)
@ddt.unpack
# pylint: disable=too-many-positional-arguments
def test_instructor_onboarding_with_api_endpoint(self, api_status, attempt_status, mocked_onboarding_api,
mocked_switch_is_active, mock_logger):
mocked_switch_is_active.return_value = True
Expand Down
1 change: 1 addition & 0 deletions edx_proctoring/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def _create_disabled_exam(self):
is_active=False
)

# pylint: disable=too-many-positional-arguments
def _create_exam_attempt(
self, exam_id, status=ProctoredExamStudentAttemptStatus.created, is_practice_exam=False,
time_remaining_seconds=None, ready_to_resume=False, resumed=False
Expand Down
4 changes: 2 additions & 2 deletions edx_proctoring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def get(self, request, exam_id=None, course_id=None, content_id=None):
course_id=course_id,
active_only=True
)
return Response(data)
return Response(data) # pylint: disable=possibly-used-before-assignment


class RegisterProctoredExamsView(ProctoredAPIView):
Expand Down Expand Up @@ -1411,7 +1411,7 @@ def put(self, request, attempt_id):
elif action == 'mark_ready_to_resume':
exam_attempt_id = mark_exam_attempt_as_ready_to_resume(attempt_id)

data = {"exam_attempt_id": exam_attempt_id}
data = {"exam_attempt_id": exam_attempt_id} # pylint: disable=possibly-used-before-assignment
return Response(data)

@method_decorator(require_course_or_global_staff)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edx/edx-proctoring",
"//": "Note that the version format is slightly different than that of the Python version when using prereleases.",
"version": "5.0.0",
"version": "5.0.1",
"main": "edx_proctoring/static/index.js",
"scripts": {
"test": "gulp test"
Expand Down
7 changes: 4 additions & 3 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# SERIOUSLY.
#
# ------------------------------
# Generated by edx-lint version: 5.3.0
# Generated by edx-lint version: 5.4.1
# ------------------------------
[MASTER]
ignore = migrations
Expand Down Expand Up @@ -259,6 +259,7 @@ enable =
useless-suppression,
disable =
bad-indentation,
broad-exception-raised,
consider-using-f-string,
duplicate-code,
file-ignored,
Expand Down Expand Up @@ -383,6 +384,6 @@ ext-import-graph =
int-import-graph =

[EXCEPTIONS]
overgeneral-exceptions = Exception
overgeneral-exceptions = builtins.Exception

# 66a80a29c927e6656f947afa98e8a5ee9306d889
# 35ad72eb2d70bd89672c701e858623248c41c419
Loading

0 comments on commit 73c7f55

Please sign in to comment.