Skip to content

Commit dc9b9b8

Browse files
committed
Fix lint errors
1 parent 8b097fd commit dc9b9b8

13 files changed

Lines changed: 24 additions & 26 deletions

File tree

course/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ def check_and_tag_retaking(sender, instance, created, **kwargs): # pylint: disab
337337
course_instance=instance.course_instance,
338338
)
339339

340+
340341
post_save.connect(create_enrollment_code, sender=Enrollment)
341342
post_save.connect(create_anon_id, sender=Enrollment)
342343
post_save.connect(pseudonymize, sender=Enrollment)

course/templatetags/course.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from typing import Any, Dict, List, Optional, Union
2-
import re
32

43
from django import template
54
from django.db import models
65
from django.utils.safestring import mark_safe
7-
from django.utils.html import strip_tags
86
from django.utils.translation import get_language
97

108
from course.models import CourseInstance, UserTagging

edit_course/operations/configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def lobject_class(config: dict) -> Type[LearningObject]:
241241
return CourseChapter
242242

243243

244-
def update_learning_objects( # pylint: disable=too-many-locals # noqa: MC0001
244+
def update_learning_objects( # pylint: disable=too-many-locals too-many-branches too-many-statements # noqa: MC0001
245245
category_map: Dict[str, LearningObjectCategory],
246246
configs: Dict[str, Dict[str, Any]],
247247
learning_objects: Dict[str, LearningObject],

exercise/api/csv/submission_sheet.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import json
2-
31
from collections import OrderedDict
42
from typing import Any, Dict, Iterable, List, Set, Tuple
53

64
from rest_framework.request import Request
75
from rest_framework.reverse import reverse
86

97
from ...models import BaseExercise, Submission
10-
from course.models import SubmissionTag
118

129

1310
def filter_best_submissions(
@@ -44,7 +41,7 @@ def filter_best_submissions(
4441
filtered.append(submissions[i])
4542
return filtered
4643

47-
def submissions_sheet( # pylint: disable=too-many-locals # noqa: MC0001
44+
def submissions_sheet( # pylint: disable=too-many-locals too-many-branches # noqa: MC0001
4845
request: Request,
4946
submissions: Iterable[Submission],
5047
revealed_ids: Set[int],

exercise/api/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def submit(self, request, *args, **kwargs):
336336
url_name='zip',
337337
methods=['get'],
338338
)
339-
def zip(self, request, exercise_id, *args, **kwargs): # pylint: disable=too-many-locals # noqa: MC0001
339+
def zip(self, request, exercise_id, *args, **kwargs): # pylint: disable=too-many-locals too-many-statements # noqa: MC0001
340340
if not self.instance.is_course_staff(request.user):
341341
return Response(
342342
'Only course staff can download submissions via this API',
@@ -656,7 +656,7 @@ def manage_tag(self, request, *args, **kwargs):
656656
SubmissionTagging.objects.create(submission=self.submission, tag=tag)
657657
return Response({'detail': 'Tag added successfully'}, status=status.HTTP_201_CREATED)
658658

659-
elif request.method == 'DELETE':
659+
if request.method == 'DELETE':
660660
try:
661661
# Get the tagging object
662662
tagging = SubmissionTagging.objects.get(submission=self.submission, tag=tag)

exercise/async_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
logger = logging.getLogger('aplus.exercise')
1717

1818

19-
def _post_async_submission(request, exercise, submission, errors=None):
19+
def _post_async_submission(request, exercise, submission, errors=None): # pylint: disable=too-many-branches
2020
"""
2121
Creates or grades a submission.
2222
@@ -52,7 +52,7 @@ def _post_async_submission(request, exercise, submission, errors=None):
5252
}
5353

5454
# Grade the submission.
55-
try:
55+
try: # pylint: disable=too-many-nested-blocks
5656
submission.set_points(form.cleaned_data["points"],
5757
form.cleaned_data["max_points"])
5858
submission.feedback = form.cleaned_data["feedback"]

exercise/cache/points.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ def post_build(self, precreated: ProxyManager):
647647
submission.feedback_revealed = True
648648

649649
# pylint: disable-next=too-many-locals
650-
def _generate_data( # noqa: MC0001
650+
def _generate_data( # pylint: disable=too-many-branches too-many-statements # noqa: MC0001
651651
self,
652652
precreated: ProxyManager,
653653
prefetched_data: ExercisePoints.DBCLS,

exercise/exercise_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,8 @@ def check_submission_allowed(self, profile, request=None):
898898
alerts[key] = [str(msg) for msg in alerts[key]]
899899
return success, alerts, students
900900

901-
def _check_submission_allowed(self, profile, request=None): # pylint: disable=too-many-locals # noqa: MC0001
901+
# pylint: disable-next=too-many-locals too-many-branches too-many-statements
902+
def _check_submission_allowed(self, profile, request=None): # noqa: MC0001
902903
students = [profile]
903904
alerts = {
904905
'error_messages' : [],

exercise/management/commands/export_submissions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def parse_comma_list_file(self, file_path):
110110
except OSError as e:
111111
raise CommandError(f'Error in reading the file "{file_path}".') from e
112112

113-
def handle(self, *args, **options): # pylint: disable=too-many-locals # noqa: MC0001
113+
# pylint: disable-next=too-many-locals too-many-branches too-many-statements
114+
def handle(self, *args, **options): # noqa: MC0001
114115
course_instance_ids = options['course_instance_id']
115116

116117
exercise_file_path = options['exercise_output_file']

exercise/management/commands/list_exercises_services.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def add_arguments(self, parser):
2525
help="Limit results to courses, which are currently visible "
2626
"to students")
2727

28-
def handle(self, *args, **options): # pylint: disable=too-many-locals # noqa: MC0001
28+
# pylint: disable-next=too-many-locals too-many-branches too-many-statements
29+
def handle(self, *args, **options): # noqa: MC0001
2930
services = {}
3031
content_types = {}
3132

0 commit comments

Comments
 (0)