From 0213fde9689edcefc016e2ab035a19d30b677026 Mon Sep 17 00:00:00 2001 From: "M. Zulqarnain" Date: Wed, 3 Feb 2021 18:14:35 +0500 Subject: [PATCH] BOM-2281 : Pylint amnesty for grades,gating and instructor app (#26343) * pyint amnesty for grades,gating and instructor app --- lms/djangoapps/gating/tasks.py | 2 +- lms/djangoapps/gating/tests/test_api.py | 4 +- .../gating/tests/test_integration.py | 2 +- lms/djangoapps/gating/tests/test_signals.py | 2 +- .../grades/config/tests/test_models.py | 2 +- lms/djangoapps/grades/course_data.py | 12 ++-- lms/djangoapps/grades/course_grade.py | 4 +- lms/djangoapps/grades/course_grade_factory.py | 6 +- lms/djangoapps/grades/exceptions.py | 2 +- .../management/commands/compute_grades.py | 2 +- .../tests/test_recalculate_learner_grades.py | 2 +- .../test_recalculate_subsection_grades.py | 4 +- lms/djangoapps/grades/models.py | 12 ++-- lms/djangoapps/grades/rest_api/serializers.py | 2 +- .../grades/rest_api/v1/gradebook_views.py | 8 +-- .../grades/rest_api/v1/tests/mixins.py | 4 +- .../rest_api/v1/tests/test_gradebook_views.py | 6 +- .../v1/tests/test_grading_policy_view.py | 8 +-- lms/djangoapps/grades/rest_api/v1/utils.py | 8 +-- lms/djangoapps/grades/rest_api/v1/views.py | 2 +- lms/djangoapps/grades/settings/common.py | 1 + lms/djangoapps/grades/settings/test.py | 1 + lms/djangoapps/grades/signals/handlers.py | 2 +- lms/djangoapps/grades/subsection_grade.py | 10 +-- .../grades/subsection_grade_factory.py | 2 +- lms/djangoapps/grades/tasks.py | 4 +- lms/djangoapps/grades/tests/base.py | 2 +- .../grades/tests/integration/test_access.py | 2 +- .../grades/tests/integration/test_events.py | 2 +- .../grades/tests/integration/test_problems.py | 7 +- lms/djangoapps/grades/tests/test_api.py | 4 +- .../grades/tests/test_course_data.py | 6 +- .../grades/tests/test_course_grade.py | 1 + .../grades/tests/test_course_grade_factory.py | 2 +- lms/djangoapps/grades/tests/test_models.py | 10 +-- lms/djangoapps/grades/tests/test_services.py | 6 +- lms/djangoapps/grades/tests/test_signals.py | 2 +- .../grades/tests/test_subsection_grade.py | 10 +-- lms/djangoapps/grades/tests/test_tasks.py | 14 ++-- .../grades/tests/test_transformer.py | 4 +- lms/djangoapps/grades/transformer.py | 4 +- lms/djangoapps/grades/util_services.py | 2 +- lms/djangoapps/instructor/access.py | 2 +- lms/djangoapps/instructor/enrollment.py | 6 +- lms/djangoapps/instructor/message_types.py | 14 ++-- .../instructor/tests/test_access.py | 8 +-- lms/djangoapps/instructor/tests/test_api.py | 66 +++++++++---------- .../tests/test_api_email_localization.py | 2 +- .../instructor/tests/test_certificates.py | 12 ++-- lms/djangoapps/instructor/tests/test_email.py | 8 +-- .../instructor/tests/test_enrollment.py | 16 ++--- .../instructor/tests/test_proctoring.py | 8 +-- .../instructor/tests/test_services.py | 8 +-- .../instructor/tests/test_spoc_gradebook.py | 2 +- lms/djangoapps/instructor/tests/test_tools.py | 10 +-- lms/djangoapps/instructor/tests/utils.py | 8 +-- .../tests/views/test_instructor_dashboard.py | 8 +-- lms/djangoapps/instructor/toggles.py | 2 +- lms/djangoapps/instructor/utils.py | 2 +- .../instructor/views/instructor_dashboard.py | 12 ++-- lms/djangoapps/instructor/views/tools.py | 6 +- 61 files changed, 198 insertions(+), 194 deletions(-) diff --git a/lms/djangoapps/gating/tasks.py b/lms/djangoapps/gating/tasks.py index 0fffe33745..8297ea2bed 100644 --- a/lms/djangoapps/gating/tasks.py +++ b/lms/djangoapps/gating/tasks.py @@ -7,7 +7,7 @@ import logging import six from celery import shared_task -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from edx_django_utils.monitoring import set_code_owner_attribute from opaque_keys.edx.keys import CourseKey, UsageKey diff --git a/lms/djangoapps/gating/tests/test_api.py b/lms/djangoapps/gating/tests/test_api.py index 259239368d..3e4e12f4df 100644 --- a/lms/djangoapps/gating/tests/test_api.py +++ b/lms/djangoapps/gating/tests/test_api.py @@ -25,7 +25,7 @@ class GatingTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Initial data setup """ - super(GatingTestCase, self).setUp() + super(GatingTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments # create course self.course = CourseFactory.create( @@ -65,7 +65,7 @@ class TestEvaluatePrerequisite(GatingTestCase, MilestonesTestCaseMixin): """ def setUp(self): - super(TestEvaluatePrerequisite, self).setUp() + super(TestEvaluatePrerequisite, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user_dict = {'id': self.user.id} self.prereq_milestone = None self.subsection_grade = Mock(location=self.seq1.location, percent_graded=0.5) diff --git a/lms/djangoapps/gating/tests/test_integration.py b/lms/djangoapps/gating/tests/test_integration.py index ec60d85603..91accf2e52 100644 --- a/lms/djangoapps/gating/tests/test_integration.py +++ b/lms/djangoapps/gating/tests/test_integration.py @@ -35,7 +35,7 @@ class TestGatedContent(MilestonesTestCaseMixin, SharedModuleStoreTestCase): cls.set_up_course() def setUp(self): - super(TestGatedContent, self).setUp() + super(TestGatedContent, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.setup_gating_milestone(50, 100) self.non_staff_user = UserFactory() self.staff_user = UserFactory(is_staff=True, is_superuser=True) diff --git a/lms/djangoapps/gating/tests/test_signals.py b/lms/djangoapps/gating/tests/test_signals.py index bb773a4aaf..3b112a5b05 100644 --- a/lms/djangoapps/gating/tests/test_signals.py +++ b/lms/djangoapps/gating/tests/test_signals.py @@ -18,7 +18,7 @@ class TestHandleScoreChanged(ModuleStoreTestCase): """ def setUp(self): - super(TestHandleScoreChanged, self).setUp() + super(TestHandleScoreChanged, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create(org='TestX', number='TS01', run='2016_Q1') self.user = UserFactory.create() self.subsection_grade = Mock() diff --git a/lms/djangoapps/grades/config/tests/test_models.py b/lms/djangoapps/grades/config/tests/test_models.py index f555497e67..be15809e5e 100644 --- a/lms/djangoapps/grades/config/tests/test_models.py +++ b/lms/djangoapps/grades/config/tests/test_models.py @@ -25,7 +25,7 @@ class PersistentGradesFeatureFlagTests(TestCase): """ def setUp(self): - super(PersistentGradesFeatureFlagTests, self).setUp() + super(PersistentGradesFeatureFlagTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course_id_1 = CourseLocator(org="edx", course="course", run="run") self.course_id_2 = CourseLocator(org="edx", course="course2", run="run") diff --git a/lms/djangoapps/grades/course_data.py b/lms/djangoapps/grades/course_data.py index 202c98ec0b..c79806fa78 100644 --- a/lms/djangoapps/grades/course_data.py +++ b/lms/djangoapps/grades/course_data.py @@ -35,7 +35,7 @@ class CourseData(object): self._location = None @property - def course_key(self): + def course_key(self): # lint-amnesty, pylint: disable=missing-function-docstring if not self._course_key: if self._course: self._course_key = self._course.id @@ -45,7 +45,7 @@ class CourseData(object): return self._course_key @property - def location(self): + def location(self): # lint-amnesty, pylint: disable=missing-function-docstring if not self._location: structure = self.effective_structure if structure: @@ -57,7 +57,7 @@ class CourseData(object): return self._location @property - def structure(self): + def structure(self): # lint-amnesty, pylint: disable=missing-function-docstring if self._structure is None: self._structure = get_course_blocks( self.user, @@ -79,7 +79,7 @@ class CourseData(object): return self._course @property - def grading_policy_hash(self): + def grading_policy_hash(self): # lint-amnesty, pylint: disable=missing-function-docstring structure = self.effective_structure if structure: return structure.get_transformer_block_field( @@ -97,7 +97,7 @@ class CourseData(object): return getattr(course_block, 'course_version', None) @property - def edited_on(self): + def edited_on(self): # lint-amnesty, pylint: disable=missing-function-docstring # get course block from structure only; subtree_edited_on field on modulestore's course block isn't optimized. structure = self.effective_structure if structure: @@ -110,7 +110,7 @@ class CourseData(object): """ return u'Course: course_key: {}'.format(self.course_key) - def full_string(self): + def full_string(self): # lint-amnesty, pylint: disable=missing-function-docstring if self.effective_structure: return u'Course: course_key: {}, version: {}, edited_on: {}, grading_policy: {}'.format( self.course_key, self.version, self.edited_on, self.grading_policy_hash, diff --git a/lms/djangoapps/grades/course_grade.py b/lms/djangoapps/grades/course_grade.py index eef617f162..711fb6a223 100644 --- a/lms/djangoapps/grades/course_grade.py +++ b/lms/djangoapps/grades/course_grade.py @@ -249,7 +249,7 @@ class CourseGrade(CourseGradeBase): Course Grade class when grades are updated or read from storage. """ def __init__(self, user, course_data, *args, **kwargs): - super(CourseGrade, self).__init__(user, course_data, *args, **kwargs) + super(CourseGrade, self).__init__(user, course_data, *args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self._subsection_grade_factory = SubsectionGradeFactory(user, course_data=course_data) def update(self): @@ -270,7 +270,7 @@ class CourseGrade(CourseGradeBase): return self @lazy - def attempted(self): + def attempted(self): # lint-amnesty, pylint: disable=invalid-overridden-method """ Returns whether any of the subsections in this course have been attempted by the student. diff --git a/lms/djangoapps/grades/course_grade_factory.py b/lms/djangoapps/grades/course_grade_factory.py index 87f3edc8b8..8a8af4d2d4 100644 --- a/lms/djangoapps/grades/course_grade_factory.py +++ b/lms/djangoapps/grades/course_grade_factory.py @@ -108,11 +108,11 @@ class CourseGradeFactory(object): course_data = CourseData( user=None, course=course, collected_block_structure=collected_block_structure, course_key=course_key, ) - stats_tags = [u'action:{}'.format(course_data.course_key)] + stats_tags = [u'action:{}'.format(course_data.course_key)] # lint-amnesty, pylint: disable=unused-variable for user in users: yield self._iter_grade_result(user, course_data, force_update) - def _iter_grade_result(self, user, course_data, force_update): + def _iter_grade_result(self, user, course_data, force_update): # lint-amnesty, pylint: disable=missing-function-docstring try: kwargs = { 'user': user, @@ -187,7 +187,7 @@ class CourseGradeFactory(object): should_persist = should_persist and course_grade.attempted if should_persist: - course_grade._subsection_grade_factory.bulk_create_unsaved() + course_grade._subsection_grade_factory.bulk_create_unsaved() # lint-amnesty, pylint: disable=protected-access PersistentCourseGrade.update_or_create( user_id=user.id, course_id=course_data.course_key, diff --git a/lms/djangoapps/grades/exceptions.py b/lms/djangoapps/grades/exceptions.py index f8394d8db7..d615f1f64d 100644 --- a/lms/djangoapps/grades/exceptions.py +++ b/lms/djangoapps/grades/exceptions.py @@ -8,4 +8,4 @@ class DatabaseNotReadyError(IOError): Subclass of IOError to indicate the database has not yet committed the data we're trying to find. """ - pass + pass # lint-amnesty, pylint: disable=unnecessary-pass diff --git a/lms/djangoapps/grades/management/commands/compute_grades.py b/lms/djangoapps/grades/management/commands/compute_grades.py index bcaecbffb2..75cc8826b0 100644 --- a/lms/djangoapps/grades/management/commands/compute_grades.py +++ b/lms/djangoapps/grades/management/commands/compute_grades.py @@ -104,7 +104,7 @@ class Command(BaseCommand): # This is a tuple to reduce memory consumption. # The dictionaries with their extra overhead will be created # and consumed one at a time. - for task_arg_tuple in tasks._course_task_args(course_key, **options): + for task_arg_tuple in tasks._course_task_args(course_key, **options): # lint-amnesty, pylint: disable=protected-access all_args.append(task_arg_tuple) all_args.sort(key=lambda x: hashlib.md5('{!r}'.format(x).encode('utf-8')).digest()) diff --git a/lms/djangoapps/grades/management/commands/tests/test_recalculate_learner_grades.py b/lms/djangoapps/grades/management/commands/tests/test_recalculate_learner_grades.py index fd3a60ee0b..df257a9155 100644 --- a/lms/djangoapps/grades/management/commands/tests/test_recalculate_learner_grades.py +++ b/lms/djangoapps/grades/management/commands/tests/test_recalculate_learner_grades.py @@ -22,7 +22,7 @@ class TestRecalculateLearnerGrades(HasCourseWithProblemsMixin, ModuleStoreTestCa """ def setUp(self): - super(TestRecalculateLearnerGrades, self).setUp() + super(TestRecalculateLearnerGrades, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.command = recalculate_learner_grades.Command() self.course1 = CourseFactory.create() diff --git a/lms/djangoapps/grades/management/commands/tests/test_recalculate_subsection_grades.py b/lms/djangoapps/grades/management/commands/tests/test_recalculate_subsection_grades.py index 9ff5b72f7a..c93cd4659e 100644 --- a/lms/djangoapps/grades/management/commands/tests/test_recalculate_subsection_grades.py +++ b/lms/djangoapps/grades/management/commands/tests/test_recalculate_subsection_grades.py @@ -30,7 +30,7 @@ class TestRecalculateSubsectionGrades(HasCourseWithProblemsMixin, ModuleStoreTes """ def setUp(self): - super(TestRecalculateSubsectionGrades, self).setUp() + super(TestRecalculateSubsectionGrades, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.command = recalculate_subsection_grades.Command() @patch('lms.djangoapps.grades.management.commands.recalculate_subsection_grades.Submission') @@ -63,7 +63,7 @@ class TestRecalculateSubsectionGrades(HasCourseWithProblemsMixin, ModuleStoreTes id_mock.return_value.id = "ID" self._run_command_and_check_output(task_mock, ScoreDatabaseTableEnum.courseware_student_module) - def _run_command_and_check_output(self, task_mock, score_db_table, include_anonymous_id=False): + def _run_command_and_check_output(self, task_mock, score_db_table, include_anonymous_id=False): # lint-amnesty, pylint: disable=missing-function-docstring self.command.handle(modified_start='2016-08-25 16:42', modified_end='2018-08-25 16:44') kwargs = { "user_id": "ID", diff --git a/lms/djangoapps/grades/models.py b/lms/djangoapps/grades/models.py index 3a461d5e4d..27ef33fa58 100644 --- a/lms/djangoapps/grades/models.py +++ b/lms/djangoapps/grades/models.py @@ -17,7 +17,7 @@ from hashlib import sha1 import six from django.apps import apps -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user, unused-import from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.utils.timezone import now @@ -29,7 +29,7 @@ from simple_history.models import HistoricalRecords from six.moves import map from lms.djangoapps.courseware.fields import UnsignedBigIntAutoField -from lms.djangoapps.grades import constants, events +from lms.djangoapps.grades import constants, events # lint-amnesty, pylint: disable=unused-import from openedx.core.lib.cache_utils import get_cache log = logging.getLogger(__name__) @@ -330,7 +330,7 @@ class PersistentSubsectionGrade(TimeStampedModel): """ Returns the "correct" usage key value with the run filled in. """ - if self.usage_key.run is None: + if self.usage_key.run is None: # lint-amnesty, pylint: disable=no-member # pylint: disable=unexpected-keyword-arg,no-value-for-parameter return self.usage_key.replace(course_key=self.course_id) else: @@ -600,7 +600,7 @@ class PersistentCourseGrade(TimeStampedModel): except KeyError: # user's grade is not in the prefetched dict, so # assume they have no grade - raise cls.DoesNotExist + raise cls.DoesNotExist # lint-amnesty, pylint: disable=raise-missing-from except KeyError: # grades were not prefetched for the course, so fetch it return cls.objects.get(user_id=user_id, course_id=course_id) @@ -701,7 +701,7 @@ class PersistentSubsectionGradeOverride(models.Model): } @classmethod - def get_override(cls, user_id, usage_key): + def get_override(cls, user_id, usage_key): # lint-amnesty, pylint: disable=missing-function-docstring prefetch_values = get_cache(cls._CACHE_NAMESPACE).get((user_id, str(usage_key.course_key)), None) if prefetch_values is not None: return prefetch_values.get(usage_key) @@ -716,7 +716,7 @@ class PersistentSubsectionGradeOverride(models.Model): @classmethod def update_or_create_override( - cls, requesting_user, subsection_grade_model, feature=None, action=None, **override_data + cls, requesting_user, subsection_grade_model, feature=None, action=None, **override_data # lint-amnesty, pylint: disable=unused-argument ): """ Creates or updates an override object for the given PersistentSubsectionGrade. diff --git a/lms/djangoapps/grades/rest_api/serializers.py b/lms/djangoapps/grades/rest_api/serializers.py index 1c1ad900af..63abc9b27a 100644 --- a/lms/djangoapps/grades/rest_api/serializers.py +++ b/lms/djangoapps/grades/rest_api/serializers.py @@ -26,7 +26,7 @@ class GradingPolicySerializer(serializers.Serializer): # When the grader dictionary was missing keys, DRF v2 would default to None; # DRF v3 unhelpfully raises an exception. return dict( - super(GradingPolicySerializer, self).to_representation( + super(GradingPolicySerializer, self).to_representation( # lint-amnesty, pylint: disable=super-with-arguments defaultdict(lambda: None, instance) ) ) diff --git a/lms/djangoapps/grades/rest_api/v1/gradebook_views.py b/lms/djangoapps/grades/rest_api/v1/gradebook_views.py index adf13c91b8..23c3197b38 100644 --- a/lms/djangoapps/grades/rest_api/v1/gradebook_views.py +++ b/lms/djangoapps/grades/rest_api/v1/gradebook_views.py @@ -510,7 +510,7 @@ class GradebookView(GradeViewMixin, PaginatedAPIView): @verify_course_exists @verify_writable_gradebook_enabled @course_author_access_required - def get(self, request, course_key): + def get(self, request, course_key): # lint-amnesty, pylint: disable=too-many-statements """ Returns a gradebook entry/entries (i.e. both course and subsection-level grade data) for all users enrolled in a course, or a single user enrolled in a course @@ -906,7 +906,7 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView): return override @staticmethod - def _log_update_result( + def _log_update_result( # lint-amnesty, pylint: disable=missing-function-docstring request_user, user_id, usage_id, subsection_grade_model=None, @@ -1031,7 +1031,7 @@ class SubsectionGradeView(GradeViewMixin, APIView): try: usage_key = UsageKey.from_string(subsection_id) except InvalidKeyError: - raise self.api_error( + raise self.api_error( # lint-amnesty, pylint: disable=raise-missing-from status_code=status.HTTP_404_NOT_FOUND, developer_message='Invalid UsageKey', error_code='invalid_usage_key' @@ -1047,7 +1047,7 @@ class SubsectionGradeView(GradeViewMixin, APIView): try: user_id = int(request.GET.get('user_id')) except ValueError: - raise self.api_error( + raise self.api_error( # lint-amnesty, pylint: disable=raise-missing-from status_code=status.HTTP_404_NOT_FOUND, developer_message='Invalid UserID', error_code='invalid_user_id' diff --git a/lms/djangoapps/grades/rest_api/v1/tests/mixins.py b/lms/djangoapps/grades/rest_api/v1/tests/mixins.py index f0967fa510..ed15c09191 100644 --- a/lms/djangoapps/grades/rest_api/v1/tests/mixins.py +++ b/lms/djangoapps/grades/rest_api/v1/tests/mixins.py @@ -77,7 +77,7 @@ class GradeViewTestMixin(SharedModuleStoreTestCase): created=self.date, ) - def _create_user_program_enrollments(self, *users, **kwargs): + def _create_user_program_enrollments(self, *users, **kwargs): # lint-amnesty, pylint: disable=missing-function-docstring # supply mode for enrollment. Use 'masters' to create a masters track enrollment for index, user in enumerate(users): course_enrollment = CourseEnrollmentFactory( @@ -99,7 +99,7 @@ class GradeViewTestMixin(SharedModuleStoreTestCase): ) def setUp(self): - super(GradeViewTestMixin, self).setUp() + super(GradeViewTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.password = 'test' self.global_staff = GlobalStaffFactory.create() self.student = UserFactory(password=self.password, username='student', email='student@example.com') diff --git a/lms/djangoapps/grades/rest_api/v1/tests/test_gradebook_views.py b/lms/djangoapps/grades/rest_api/v1/tests/test_gradebook_views.py index 672b66790c..db493ac9e8 100644 --- a/lms/djangoapps/grades/rest_api/v1/tests/test_gradebook_views.py +++ b/lms/djangoapps/grades/rest_api/v1/tests/test_gradebook_views.py @@ -1,4 +1,4 @@ -""" +""" # lint-amnesty, pylint: disable=cyclic-import Tests for the course grading API view """ @@ -18,7 +18,7 @@ from rest_framework.test import APITestCase from six import text_type from common.djangoapps.course_modes.models import CourseMode -from edx_toggles.toggles.testutils import override_waffle_flag +from edx_toggles.toggles.testutils import override_waffle_flag # lint-amnesty, pylint: disable=wrong-import-order from lms.djangoapps.certificates.models import CertificateStatuses, GeneratedCertificate from lms.djangoapps.courseware.tests.factories import InstructorFactory, StaffFactory from lms.djangoapps.grades.config.waffle import WRITABLE_GRADEBOOK, waffle_flags @@ -397,7 +397,7 @@ class GradebookViewTest(GradebookViewTestBase): """ Helper function to create the course gradebook API read url. """ - base_url = super(GradebookViewTest, self).get_url(course_key) + base_url = super(GradebookViewTest, self).get_url(course_key) # lint-amnesty, pylint: disable=super-with-arguments if username: return "{0}?username={1}".format(base_url, username) if user_contains: diff --git a/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py b/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py index 4e75b3cb3b..e13fef8bdc 100644 --- a/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py +++ b/lms/djangoapps/grades/rest_api/v1/tests/test_grading_policy_view.py @@ -27,7 +27,7 @@ class GradingPolicyTestMixin(object): view_name = None def setUp(self): - super(GradingPolicyTestMixin, self).setUp() + super(GradingPolicyTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.create_user_and_access_token() def create_user_and_access_token(self): @@ -36,7 +36,7 @@ class GradingPolicyTestMixin(object): self.access_token = AccessTokenFactory.create(user=self.user, application=self.oauth_client).token @classmethod - def create_course_data(cls): + def create_course_data(cls): # lint-amnesty, pylint: disable=missing-function-docstring cls.invalid_course_id = 'foo/bar/baz' cls.course = CourseFactory.create(display_name='An Introduction to API Testing', raw_grader=cls.raw_grader) cls.course_id = six.text_type(cls.course.id) @@ -188,7 +188,7 @@ class CourseGradingPolicyTests(GradingPolicyTestMixin, SharedModuleStoreTestCase """ The view should return grading policy for a course. """ - response = super(CourseGradingPolicyTests, self).test_get() + response = super(CourseGradingPolicyTests, self).test_get() # lint-amnesty, pylint: disable=super-with-arguments expected = [ { @@ -240,7 +240,7 @@ class CourseGradingPolicyMissingFieldsTests(GradingPolicyTestMixin, SharedModule """ The view should return grading policy for a course. """ - response = super(CourseGradingPolicyMissingFieldsTests, self).test_get() + response = super(CourseGradingPolicyMissingFieldsTests, self).test_get() # lint-amnesty, pylint: disable=super-with-arguments expected = [ { diff --git a/lms/djangoapps/grades/rest_api/v1/utils.py b/lms/djangoapps/grades/rest_api/v1/utils.py index bdf9bba1a1..95c6b74f02 100644 --- a/lms/djangoapps/grades/rest_api/v1/utils.py +++ b/lms/djangoapps/grades/rest_api/v1/utils.py @@ -45,7 +45,7 @@ class CourseEnrollmentPagination(CursorPagination): Return a response given serialized page data, optional status_code (defaults to 200), and kwargs. Each key-value pair of kwargs is added to the response data. """ - resp = super(CourseEnrollmentPagination, self).get_paginated_response(data) + resp = super(CourseEnrollmentPagination, self).get_paginated_response(data) # lint-amnesty, pylint: disable=super-with-arguments for (key, value) in kwargs.items(): resp.data[key] = value @@ -103,13 +103,13 @@ class GradeViewMixin(DeveloperErrorViewMixin): try: yield self._get_single_user(request, course_key) except USER_MODEL.DoesNotExist: - raise self.api_error( + raise self.api_error( # lint-amnesty, pylint: disable=raise-missing-from status_code=status.HTTP_404_NOT_FOUND, developer_message='The user matching the requested username does not exist.', error_code='user_does_not_exist' ) except CourseEnrollment.DoesNotExist: - raise self.api_error( + raise self.api_error( # lint-amnesty, pylint: disable=raise-missing-from status_code=status.HTTP_404_NOT_FOUND, developer_message='The user matching the requested username is not enrolled in this course', error_code='user_not_enrolled' @@ -181,6 +181,6 @@ class GradeViewMixin(DeveloperErrorViewMixin): """ Ensures that the user is authenticated (e.g. not an AnonymousUser). """ - super(GradeViewMixin, self).perform_authentication(request) + super(GradeViewMixin, self).perform_authentication(request) # lint-amnesty, pylint: disable=super-with-arguments if request.user.is_anonymous: raise AuthenticationFailed diff --git a/lms/djangoapps/grades/rest_api/v1/views.py b/lms/djangoapps/grades/rest_api/v1/views.py index 21dd2c0493..f865c3b3db 100644 --- a/lms/djangoapps/grades/rest_api/v1/views.py +++ b/lms/djangoapps/grades/rest_api/v1/views.py @@ -182,7 +182,7 @@ class CourseGradingPolicy(GradeViewMixin, ListAPIView): try: course_key = get_course_key(request, course_id) except InvalidKeyError: - raise self.api_error( + raise self.api_error( # lint-amnesty, pylint: disable=raise-missing-from status_code=status.HTTP_400_BAD_REQUEST, developer_message='The provided course key cannot be parsed.', error_code='invalid_course_key' diff --git a/lms/djangoapps/grades/settings/common.py b/lms/djangoapps/grades/settings/common.py index 8a22862f35..1832e79834 100644 --- a/lms/djangoapps/grades/settings/common.py +++ b/lms/djangoapps/grades/settings/common.py @@ -1,3 +1,4 @@ +# lint-amnesty, pylint: disable=missing-function-docstring, missing-module-docstring def plugin_settings(settings): # Queue to use for updating persistent grades settings.RECALCULATE_GRADES_ROUTING_KEY = settings.DEFAULT_PRIORITY_QUEUE diff --git a/lms/djangoapps/grades/settings/test.py b/lms/djangoapps/grades/settings/test.py index 7837e462fb..45cc11cf9e 100644 --- a/lms/djangoapps/grades/settings/test.py +++ b/lms/djangoapps/grades/settings/test.py @@ -1,3 +1,4 @@ +# lint-amnesty, pylint: disable=missing-module-docstring def plugin_settings(settings): settings.FEATURES['PERSISTENT_GRADES_ENABLED_FOR_ALL_TESTS'] = True settings.FEATURES['ASSUME_ZERO_GRADE_IF_ABSENT_FOR_ALL_TESTS'] = True diff --git a/lms/djangoapps/grades/signals/handlers.py b/lms/djangoapps/grades/signals/handlers.py index b56f69f911..8e860d5de3 100644 --- a/lms/djangoapps/grades/signals/handlers.py +++ b/lms/djangoapps/grades/signals/handlers.py @@ -24,7 +24,7 @@ from .. import events from ..constants import ScoreDatabaseTableEnum from ..course_grade_factory import CourseGradeFactory from ..scores import weighted_score -from lms.djangoapps.grades.tasks import ( +from lms.djangoapps.grades.tasks import ( # lint-amnesty, pylint: disable=wrong-import-order RECALCULATE_GRADE_DELAY_SECONDS, recalculate_course_and_subsection_grades_for_user, recalculate_subsection_grade_v3 diff --git a/lms/djangoapps/grades/subsection_grade.py b/lms/djangoapps/grades/subsection_grade.py index f81d7ba383..755db2f3e1 100644 --- a/lms/djangoapps/grades/subsection_grade.py +++ b/lms/djangoapps/grades/subsection_grade.py @@ -79,7 +79,7 @@ class ZeroSubsectionGrade(SubsectionGradeBase): """ def __init__(self, subsection, course_data): - super(ZeroSubsectionGrade, self).__init__(subsection) + super(ZeroSubsectionGrade, self).__init__(subsection) # lint-amnesty, pylint: disable=super-with-arguments self.course_data = course_data @property @@ -146,7 +146,7 @@ class NonZeroSubsectionGrade(six.with_metaclass(ABCMeta, SubsectionGradeBase)): """ def __init__(self, subsection, all_total, graded_total, override=None): - super(NonZeroSubsectionGrade, self).__init__(subsection) + super(NonZeroSubsectionGrade, self).__init__(subsection) # lint-amnesty, pylint: disable=super-with-arguments self.all_total = all_total self.graded_total = graded_total self.override = override @@ -160,7 +160,7 @@ class NonZeroSubsectionGrade(six.with_metaclass(ABCMeta, SubsectionGradeBase)): return compute_percent(self.graded_total.earned, self.graded_total.possible) @staticmethod - def _compute_block_score( + def _compute_block_score( # lint-amnesty, pylint: disable=missing-function-docstring block_key, course_structure, submissions_scores, @@ -244,7 +244,7 @@ class ReadSubsectionGrade(NonZeroSubsectionGrade): self.model = model self.factory = factory - super(ReadSubsectionGrade, self).__init__(subsection, all_total, graded_total, override) + super(ReadSubsectionGrade, self).__init__(subsection, all_total, graded_total, override) # lint-amnesty, pylint: disable=super-with-arguments @lazy def problem_scores(self): @@ -297,7 +297,7 @@ class CreateSubsectionGrade(NonZeroSubsectionGrade): u' and grade_total ***{}*** for subsection ***{}***' .format(all_total, graded_total, subsection.location)) - super(CreateSubsectionGrade, self).__init__(subsection, all_total, graded_total) + super(CreateSubsectionGrade, self).__init__(subsection, all_total, graded_total) # lint-amnesty, pylint: disable=super-with-arguments def update_or_create_model(self, student, score_deleted=False, force_update_subsections=False): """ diff --git a/lms/djangoapps/grades/subsection_grade_factory.py b/lms/djangoapps/grades/subsection_grade_factory.py index 70339d7293..67cee7d6f5 100644 --- a/lms/djangoapps/grades/subsection_grade_factory.py +++ b/lms/djangoapps/grades/subsection_grade_factory.py @@ -72,7 +72,7 @@ class SubsectionGradeFactory(object): ) self._unsaved_subsection_grades.clear() - def update(self, subsection, only_if_higher=None, score_deleted=False, force_update_subsections=False, persist_grade=True): + def update(self, subsection, only_if_higher=None, score_deleted=False, force_update_subsections=False, persist_grade=True): # lint-amnesty, pylint: disable=line-too-long """ Updates the SubsectionGrade object for the student and subsection. """ diff --git a/lms/djangoapps/grades/tasks.py b/lms/djangoapps/grades/tasks.py index 0a32b4e40b..cf1eb11166 100644 --- a/lms/djangoapps/grades/tasks.py +++ b/lms/djangoapps/grades/tasks.py @@ -9,7 +9,7 @@ import six from celery import shared_task from celery_utils.persist_on_failure import LoggedPersistOnFailureTask from django.conf import settings -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core.exceptions import ValidationError from django.db.utils import DatabaseError from edx_django_utils.monitoring import ( @@ -24,7 +24,7 @@ from submissions import api as sub_api from lms.djangoapps.courseware.model_data import get_score from lms.djangoapps.course_blocks.api import get_course_blocks from lms.djangoapps.grades.config.models import ComputeGradesSetting -from openedx.core.djangoapps.content.course_overviews.models import CourseOverview +from openedx.core.djangoapps.content.course_overviews.models import CourseOverview # lint-amnesty, pylint: disable=unused-import from common.djangoapps.student.models import CourseEnrollment from common.djangoapps.track.event_transaction_utils import set_event_transaction_id, set_event_transaction_type from common.djangoapps.util.date_utils import from_timestamp diff --git a/lms/djangoapps/grades/tests/base.py b/lms/djangoapps/grades/tests/base.py index 2e362b3c66..2d32bae9ba 100644 --- a/lms/djangoapps/grades/tests/base.py +++ b/lms/djangoapps/grades/tests/base.py @@ -78,7 +78,7 @@ class GradeTestBase(SharedModuleStoreTestCase): cls.store.update_item(cls.chapter_2, UserFactory().id) def setUp(self): - super(GradeTestBase, self).setUp() + super(GradeTestBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.addCleanup(set_current_request, None) self.request = get_mock_request(UserFactory()) self.client.login(username=self.request.user.username, password="test") diff --git a/lms/djangoapps/grades/tests/integration/test_access.py b/lms/djangoapps/grades/tests/integration/test_access.py index e966671a3d..e9c0619f81 100644 --- a/lms/djangoapps/grades/tests/integration/test_access.py +++ b/lms/djangoapps/grades/tests/integration/test_access.py @@ -69,7 +69,7 @@ class GradesAccessIntegrationTest(ProblemSubmissionTestMixin, SharedModuleStoreT ) def setUp(self): - super(GradesAccessIntegrationTest, self).setUp() + super(GradesAccessIntegrationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.addCleanup(set_current_request, None) self.request = get_mock_request(UserFactory()) self.student = self.request.user diff --git a/lms/djangoapps/grades/tests/integration/test_events.py b/lms/djangoapps/grades/tests/integration/test_events.py index f6f488e0e7..6256cac270 100644 --- a/lms/djangoapps/grades/tests/integration/test_events.py +++ b/lms/djangoapps/grades/tests/integration/test_events.py @@ -68,7 +68,7 @@ class GradesEventIntegrationTest(ProblemSubmissionTestMixin, SharedModuleStoreTe def setUp(self): self.reset_course() - super(GradesEventIntegrationTest, self).setUp() + super(GradesEventIntegrationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.addCleanup(set_current_request, None) self.request = get_mock_request(UserFactory()) self.student = self.request.user diff --git a/lms/djangoapps/grades/tests/integration/test_problems.py b/lms/djangoapps/grades/tests/integration/test_problems.py index 675ee26d54..ebd15cac5d 100644 --- a/lms/djangoapps/grades/tests/integration/test_problems.py +++ b/lms/djangoapps/grades/tests/integration/test_problems.py @@ -1,3 +1,4 @@ +# lint-amnesty, pylint: disable=missing-module-docstring import datetime import itertools @@ -40,7 +41,7 @@ class TestMultipleProblemTypesSubsectionScores(SharedModuleStoreTestCase): cls.seq1 = chapter1.get_children()[0] def setUp(self): - super(TestMultipleProblemTypesSubsectionScores, self).setUp() + super(TestMultipleProblemTypesSubsectionScores, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments password = u'test' self.student = UserFactory.create(is_staff=False, username=u'test_student', password=password) self.client.login(username=self.student.username, password=password) @@ -109,7 +110,7 @@ class TestVariedMetadata(ProblemSubmissionTestMixin, ModuleStoreTestCase): } def setUp(self): - super(TestVariedMetadata, self).setUp() + super(TestVariedMetadata, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create() with self.store.bulk_operations(self.course.id): self.chapter = ItemFactory.create( @@ -232,7 +233,7 @@ class TestWeightedProblems(SharedModuleStoreTestCase): ) def setUp(self): - super(TestWeightedProblems, self).setUp() + super(TestWeightedProblems, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory() self.addCleanup(set_current_request, None) self.request = get_mock_request(self.user) diff --git a/lms/djangoapps/grades/tests/test_api.py b/lms/djangoapps/grades/tests/test_api.py index 681d022e42..bb7cd86d93 100644 --- a/lms/djangoapps/grades/tests/test_api.py +++ b/lms/djangoapps/grades/tests/test_api.py @@ -41,7 +41,7 @@ class OverrideSubsectionGradeTests(ModuleStoreTestCase): cls.type_patcher.stop() def setUp(self): - super(OverrideSubsectionGradeTests, self).setUp() + super(OverrideSubsectionGradeTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create(org='edX', number='DemoX', display_name='Demo_Course', run='Spring2019') self.subsection = ItemFactory.create(parent=self.course, category="subsection", display_name="Subsection") self.grade = PersistentSubsectionGrade.update_or_create_grade( @@ -57,7 +57,7 @@ class OverrideSubsectionGradeTests(ModuleStoreTestCase): ) def tearDown(self): - super(OverrideSubsectionGradeTests, self).tearDown() + super(OverrideSubsectionGradeTests, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments PersistentSubsectionGradeOverride.objects.all().delete() # clear out all previous overrides @ddt.data(0.0, None, 3.0) diff --git a/lms/djangoapps/grades/tests/test_course_data.py b/lms/djangoapps/grades/tests/test_course_data.py index b305a6cc2f..33efefba04 100644 --- a/lms/djangoapps/grades/tests/test_course_data.py +++ b/lms/djangoapps/grades/tests/test_course_data.py @@ -22,7 +22,7 @@ class CourseDataTest(ModuleStoreTestCase): """ def setUp(self): - super(CourseDataTest, self).setUp() + super(CourseDataTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments with self.store.default_store(ModuleStoreEnum.Type.split): self.course = CourseFactory.create() # need to re-retrieve the course since the version on the original course isn't accurate. @@ -53,13 +53,13 @@ class CourseDataTest(ModuleStoreTestCase): course_data = CourseData(self.user, **kwargs) for arg in self.expected_results: # No point validating the data we used as input, and c_b_s is input-only - if arg != kwarg and arg != "collected_block_structure": + if arg != kwarg and arg != "collected_block_structure": # lint-amnesty, pylint: disable=consider-using-in expected = self.expected_results[arg] actual = getattr(course_data, arg) self.assertEqual(expected, actual) def test_properties(self): - expected_edited_on = getattr( + expected_edited_on = getattr( # lint-amnesty, pylint: disable=literal-used-as-attribute self.one_true_structure[self.one_true_structure.root_block_usage_key], 'subtree_edited_on', ) diff --git a/lms/djangoapps/grades/tests/test_course_grade.py b/lms/djangoapps/grades/tests/test_course_grade.py index 3b867ca75e..3809cf569d 100644 --- a/lms/djangoapps/grades/tests/test_course_grade.py +++ b/lms/djangoapps/grades/tests/test_course_grade.py @@ -1,3 +1,4 @@ +# lint-amnesty, pylint: disable=missing-module-docstring import ddt import six from crum import set_current_request diff --git a/lms/djangoapps/grades/tests/test_course_grade_factory.py b/lms/djangoapps/grades/tests/test_course_grade_factory.py index 2c085b35cc..d4d5ee392c 100644 --- a/lms/djangoapps/grades/tests/test_course_grade_factory.py +++ b/lms/djangoapps/grades/tests/test_course_grade_factory.py @@ -262,7 +262,7 @@ class TestGradeIteration(SharedModuleStoreTestCase): """ Create a course and a handful of users to assign grades """ - super(TestGradeIteration, self).setUp() + super(TestGradeIteration, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.students = [ UserFactory.create(username='student1'), diff --git a/lms/djangoapps/grades/tests/test_models.py b/lms/djangoapps/grades/tests/test_models.py index 44fc05ffee..d610cb3c7b 100644 --- a/lms/djangoapps/grades/tests/test_models.py +++ b/lms/djangoapps/grades/tests/test_models.py @@ -40,7 +40,7 @@ class BlockRecordListTestCase(TestCase): """ def setUp(self): - super(BlockRecordListTestCase, self).setUp() + super(BlockRecordListTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course_key = CourseLocator( org='some_org', course='some_course', @@ -70,7 +70,7 @@ class GradesModelTestCase(TestCase): Base class for common setup of grades model tests. """ def setUp(self): - super(GradesModelTestCase, self).setUp() + super(GradesModelTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course_key = CourseLocator( org='some_org', course='some_course', @@ -136,7 +136,7 @@ class VisibleBlocksTest(GradesModelTestCase): """ def setUp(self): - super(VisibleBlocksTest, self).setUp() + super(VisibleBlocksTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user_id = 12345 def _create_block_record_list(self, blocks, user_id=None): @@ -209,7 +209,7 @@ class PersistentSubsectionGradeTest(GradesModelTestCase): """ def setUp(self): - super(PersistentSubsectionGradeTest, self).setUp() + super(PersistentSubsectionGradeTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.usage_key = BlockUsageLocator( course_key=self.course_key, block_type='subsection', @@ -360,7 +360,7 @@ class PersistentCourseGradesTest(GradesModelTestCase): """ def setUp(self): - super(PersistentCourseGradesTest, self).setUp() + super(PersistentCourseGradesTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.params = { "user_id": 12345, "course_id": self.course_key, diff --git a/lms/djangoapps/grades/tests/test_services.py b/lms/djangoapps/grades/tests/test_services.py index 99c934412d..7910ec7dcb 100644 --- a/lms/djangoapps/grades/tests/test_services.py +++ b/lms/djangoapps/grades/tests/test_services.py @@ -44,7 +44,7 @@ class GradesServiceTests(ModuleStoreTestCase): """ def setUp(self): - super(GradesServiceTests, self).setUp() + super(GradesServiceTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.service = GradesService() self.course = CourseFactory.create(org='edX', number='DemoX', display_name='Demo_Course', run='Spring2019') self.subsection = ItemFactory.create(parent=self.course, category="subsection", display_name="Subsection") @@ -79,7 +79,7 @@ class GradesServiceTests(ModuleStoreTestCase): } def tearDown(self): - super(GradesServiceTests, self).tearDown() + super(GradesServiceTests, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments PersistentSubsectionGradeOverride.objects.all().delete() # clear out all previous overrides self.signal_patcher.stop() self.id_patcher.stop() @@ -252,7 +252,7 @@ class GradesServiceTests(ModuleStoreTestCase): grade=self.grade, system=GradeOverrideFeatureEnum.proctoring ) - override_id = override.id + override_id = override.id # lint-amnesty, pylint: disable=unused-variable self.service.undo_override_subsection_grade( user_id=self.user.id, course_key_or_id=self.course.id, diff --git a/lms/djangoapps/grades/tests/test_signals.py b/lms/djangoapps/grades/tests/test_signals.py index a434dc24af..76dc3dcd4f 100644 --- a/lms/djangoapps/grades/tests/test_signals.py +++ b/lms/djangoapps/grades/tests/test_signals.py @@ -103,7 +103,7 @@ class ScoreChangedSignalRelayTest(TestCase): """ Configure mocks for all the dependencies of the render method """ - super(ScoreChangedSignalRelayTest, self).setUp() + super(ScoreChangedSignalRelayTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.signal_mock = self.setup_patch( 'lms.djangoapps.grades.signals.signals.PROBLEM_WEIGHTED_SCORE_CHANGED.send', None, diff --git a/lms/djangoapps/grades/tests/test_subsection_grade.py b/lms/djangoapps/grades/tests/test_subsection_grade.py index 48b51d2619..da153a8ef5 100644 --- a/lms/djangoapps/grades/tests/test_subsection_grade.py +++ b/lms/djangoapps/grades/tests/test_subsection_grade.py @@ -12,7 +12,7 @@ from .utils import mock_get_score @ddt -class SubsectionGradeTest(GradeTestBase): +class SubsectionGradeTest(GradeTestBase): # lint-amnesty, pylint: disable=missing-class-docstring @data((50, 100, .50), (59.49, 100, .59), (59.51, 100, .60), (59.50, 100, .60), (60.5, 100, .60)) @unpack @@ -22,8 +22,8 @@ class SubsectionGradeTest(GradeTestBase): created_grade = CreateSubsectionGrade( self.sequence, self.course_structure, - self.subsection_grade_factory._submissions_scores, - self.subsection_grade_factory._csm_scores, + self.subsection_grade_factory._submissions_scores, # lint-amnesty, pylint: disable=protected-access + self.subsection_grade_factory._csm_scores, # lint-amnesty, pylint: disable=protected-access ) self.assertEqual(PersistentSubsectionGrade.objects.count(), 0) self.assertEqual(created_grade.percent_graded, expected_result) @@ -53,7 +53,7 @@ class SubsectionGradeTest(GradeTestBase): grade = CreateSubsectionGrade( self.sequence, self.course_structure, - self.subsection_grade_factory._submissions_scores, - self.subsection_grade_factory._csm_scores, + self.subsection_grade_factory._submissions_scores, # lint-amnesty, pylint: disable=protected-access + self.subsection_grade_factory._csm_scores, # lint-amnesty, pylint: disable=protected-access ) self.assertEqual(grade.percent_graded, 0.0) diff --git a/lms/djangoapps/grades/tests/test_tasks.py b/lms/djangoapps/grades/tests/test_tasks.py index 13e95d2288..6c1d0fa962 100644 --- a/lms/djangoapps/grades/tests/test_tasks.py +++ b/lms/djangoapps/grades/tests/test_tasks.py @@ -23,7 +23,7 @@ from lms.djangoapps.grades.config.models import PersistentGradesEnabledFlag from lms.djangoapps.grades.config.waffle import ENFORCE_FREEZE_GRADE_AFTER_COURSE_END, waffle_flags from lms.djangoapps.grades.constants import ScoreDatabaseTableEnum from lms.djangoapps.grades.models import PersistentCourseGrade, PersistentSubsectionGrade -from lms.djangoapps.grades.services import GradesService +from lms.djangoapps.grades.services import GradesService # lint-amnesty, pylint: disable=unused-import from lms.djangoapps.grades.signals.signals import PROBLEM_WEIGHTED_SCORE_CHANGED from lms.djangoapps.grades.tasks import ( RECALCULATE_GRADE_DELAY_SECONDS, @@ -115,7 +115,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest ENABLED_SIGNALS = ['course_published', 'pre_publish'] def setUp(self): - super(RecalculateSubsectionGradeTest, self).setUp() + super(RecalculateSubsectionGradeTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory() PersistentGradesEnabledFlag.objects.create(enabled_for_all_courses=True, enabled=True) @@ -411,7 +411,7 @@ class ComputeGradesForCourseTest(HasCourseWithProblemsMixin, ModuleStoreTestCase ENABLED_SIGNALS = ['course_published', 'pre_publish'] def setUp(self): - super(ComputeGradesForCourseTest, self).setUp() + super(ComputeGradesForCourseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.users = [UserFactory.create() for _ in range(12)] self.set_up_course() for user in self.users: @@ -452,7 +452,7 @@ class RecalculateGradesForUserTest(HasCourseWithProblemsMixin, ModuleStoreTestCa Test recalculate_course_and_subsection_grades_for_user task. """ def setUp(self): - super(RecalculateGradesForUserTest, self).setUp() + super(RecalculateGradesForUserTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory.create() self.set_up_course() CourseEnrollment.enroll(self.user, self.course.id) @@ -500,7 +500,7 @@ class FreezeGradingAfterCourseEndTest(HasCourseWithProblemsMixin, ModuleStoreTes Test enforce_freeze_grade_after_course_end waffle flag controlling grading tasks. """ def setUp(self): - super(FreezeGradingAfterCourseEndTest, self).setUp() + super(FreezeGradingAfterCourseEndTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.users = [UserFactory.create() for _ in range(12)] self.user = self.users[0] self.freeze_grade_flag = waffle_flags()[ENFORCE_FREEZE_GRADE_AFTER_COURSE_END] @@ -513,7 +513,7 @@ class FreezeGradingAfterCourseEndTest(HasCourseWithProblemsMixin, ModuleStoreTes mock_log.info.call_args_list[0][0][0] ) - def _assert_for_freeze_grade_flag( + def _assert_for_freeze_grade_flag( # lint-amnesty, pylint: disable=missing-function-docstring self, result, freeze_flag_value, @@ -637,7 +637,7 @@ class FreezeGradingAfterCourseEndTest(HasCourseWithProblemsMixin, ModuleStoreTes CourseEnrollment.enroll(user, self.course.id) with override_waffle_flag(self.freeze_grade_flag, active=freeze_flag_value): - modified_datetime = datetime.utcnow().replace(tzinfo=pytz.UTC) - timedelta(days=1) + modified_datetime = datetime.utcnow().replace(tzinfo=pytz.UTC) - timedelta(days=1) # lint-amnesty, pylint: disable=unused-variable with patch('lms.djangoapps.grades.tasks._has_db_updated_with_new_score') as mock_has_db_updated: result = recalculate_subsection_grade_v3.apply_async(kwargs=self.recalculate_subsection_grade_kwargs) self._assert_for_freeze_grade_flag( diff --git a/lms/djangoapps/grades/tests/test_transformer.py b/lms/djangoapps/grades/tests/test_transformer.py index a3c38d7e05..0345696c9e 100644 --- a/lms/djangoapps/grades/tests/test_transformer.py +++ b/lms/djangoapps/grades/tests/test_transformer.py @@ -41,7 +41,7 @@ class GradesTransformerTestCase(CourseStructureTestCase): } def setUp(self): - super(GradesTransformerTestCase, self).setUp() + super(GradesTransformerTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments password = u'test' self.student = UserFactory.create(is_staff=False, username=u'test_student', password=password) self.client.login(username=self.student.username, password=password) @@ -433,7 +433,7 @@ class MultiProblemModulestoreAccessTestCase(CourseStructureTestCase, SharedModul TRANSFORMER_CLASS_TO_TEST = GradesTransformer def setUp(self): - super(MultiProblemModulestoreAccessTestCase, self).setUp() + super(MultiProblemModulestoreAccessTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments password = u'test' self.student = UserFactory.create(is_staff=False, username=u'test_student', password=password) self.client.login(username=self.student.username, password=password) diff --git a/lms/djangoapps/grades/transformer.py b/lms/djangoapps/grades/transformer.py index ff143c35b9..e1be1cecb6 100644 --- a/lms/djangoapps/grades/transformer.py +++ b/lms/djangoapps/grades/transformer.py @@ -77,11 +77,11 @@ class GradesTransformer(BlockStructureTransformer): cls._collect_explicit_graded(block_structure) cls._collect_grading_policy_hash(block_structure) - def transform(self, block_structure, usage_context): + def transform(self, block_structure, usage_context): # lint-amnesty, pylint: disable=arguments-differ """ Perform no transformations. """ - pass + pass # lint-amnesty, pylint: disable=unnecessary-pass @classmethod def grading_policy_hash(cls, course): diff --git a/lms/djangoapps/grades/util_services.py b/lms/djangoapps/grades/util_services.py index 706fecdd52..a061f471b6 100644 --- a/lms/djangoapps/grades/util_services.py +++ b/lms/djangoapps/grades/util_services.py @@ -9,7 +9,7 @@ class GradesUtilService(object): An interface to be used by xblocks. """ def __init__(self, **kwargs): - super(GradesUtilService, self).__init__() + super(GradesUtilService, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments self.course_id = kwargs.get('course_id', None) def are_grades_frozen(self): diff --git a/lms/djangoapps/instructor/access.py b/lms/djangoapps/instructor/access.py index 5ea7bde8b6..2619b7aaf0 100644 --- a/lms/djangoapps/instructor/access.py +++ b/lms/djangoapps/instructor/access.py @@ -72,7 +72,7 @@ def _change_access(course, user, level, action, send_email=True): try: role = ROLES[level](course.id) except KeyError: - raise ValueError(u"unrecognized level '{}'".format(level)) + raise ValueError(u"unrecognized level '{}'".format(level)) # lint-amnesty, pylint: disable=raise-missing-from if action == 'allow': if level == 'ccx_coach': diff --git a/lms/djangoapps/instructor/enrollment.py b/lms/djangoapps/instructor/enrollment.py index d36049f1a2..e010a8b4ac 100644 --- a/lms/djangoapps/instructor/enrollment.py +++ b/lms/djangoapps/instructor/enrollment.py @@ -12,8 +12,8 @@ from datetime import datetime import pytz import six from django.conf import settings -from django.contrib.auth.models import User -from django.core.mail import send_mail +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user +from django.core.mail import send_mail # lint-amnesty, pylint: disable=unused-import from django.template.loader import render_to_string from django.urls import reverse from django.utils.translation import override as override_language @@ -43,7 +43,7 @@ from openedx.core.djangoapps.lang_pref import LANGUAGE_KEY from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.djangoapps.user_api.models import UserPreference from openedx.core.djangolib.markup import Text -from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed, anonymous_id_for_user, is_email_retired +from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed, anonymous_id_for_user, is_email_retired # lint-amnesty, pylint: disable=line-too-long from common.djangoapps.track.event_transaction_utils import ( create_new_event_transaction_id, get_event_transaction_id, diff --git a/lms/djangoapps/instructor/message_types.py b/lms/djangoapps/instructor/message_types.py index ca96316eaa..6b14a4fe5d 100644 --- a/lms/djangoapps/instructor/message_types.py +++ b/lms/djangoapps/instructor/message_types.py @@ -15,7 +15,7 @@ class AccountCreationAndEnrollment(BaseMessageType): APP_LABEL = 'instructor' def __init__(self, *args, **kwargs): - super(AccountCreationAndEnrollment, self).__init__(*args, **kwargs) + super(AccountCreationAndEnrollment, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.options['transactional'] = True @@ -26,7 +26,7 @@ class AddBetaTester(BaseMessageType): APP_LABEL = 'instructor' def __init__(self, *args, **kwargs): - super(AddBetaTester, self).__init__(*args, **kwargs) + super(AddBetaTester, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.options['transactional'] = True @@ -37,7 +37,7 @@ class AllowedEnroll(BaseMessageType): APP_LABEL = 'instructor' def __init__(self, *args, **kwargs): - super(AllowedEnroll, self).__init__(*args, **kwargs) + super(AllowedEnroll, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.options['transactional'] = True @@ -48,7 +48,7 @@ class AllowedUnenroll(BaseMessageType): APP_LABEL = 'instructor' def __init__(self, *args, **kwargs): - super(AllowedUnenroll, self).__init__(*args, **kwargs) + super(AllowedUnenroll, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.options['transactional'] = True @@ -59,7 +59,7 @@ class EnrollEnrolled(BaseMessageType): APP_LABEL = 'instructor' def __init__(self, *args, **kwargs): - super(EnrollEnrolled, self).__init__(*args, **kwargs) + super(EnrollEnrolled, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.options['transactional'] = True @@ -70,7 +70,7 @@ class EnrolledUnenroll(BaseMessageType): APP_LABEL = 'instructor' def __init__(self, *args, **kwargs): - super(EnrolledUnenroll, self).__init__(*args, **kwargs) + super(EnrolledUnenroll, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.options['transactional'] = True @@ -81,5 +81,5 @@ class RemoveBetaTester(BaseMessageType): APP_LABEL = 'instructor' def __init__(self, *args, **kwargs): - super(RemoveBetaTester, self).__init__(*args, **kwargs) + super(RemoveBetaTester, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments self.options['transactional'] = True diff --git a/lms/djangoapps/instructor/tests/test_access.py b/lms/djangoapps/instructor/tests/test_access.py index 12b49c5900..91b2e3f2fe 100644 --- a/lms/djangoapps/instructor/tests/test_access.py +++ b/lms/djangoapps/instructor/tests/test_access.py @@ -23,7 +23,7 @@ class TestInstructorAccessList(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorAccessList, self).setUp() + super(TestInstructorAccessList, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructors = [UserFactory.create() for _ in range(4)] for user in self.instructors: allow_access(self.course, user, 'instructor') @@ -48,7 +48,7 @@ class TestInstructorAccessAllow(EmailTemplateTagMixin, SharedModuleStoreTestCase cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorAccessAllow, self).setUp() + super(TestInstructorAccessAllow, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create() @@ -93,7 +93,7 @@ class TestInstructorAccessRevoke(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorAccessRevoke, self).setUp() + super(TestInstructorAccessRevoke, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.staff = [UserFactory.create() for _ in range(4)] for user in self.staff: allow_access(self.course, user, 'staff') @@ -132,7 +132,7 @@ class TestInstructorAccessForum(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorAccessForum, self).setUp() + super(TestInstructorAccessForum, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.mod_role = Role.objects.create( course_id=self.course.id, name=FORUM_ROLE_MODERATOR diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index ed067c57c3..a61012473d 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -17,7 +17,7 @@ import pytest import six from boto.exception import BotoServerError from django.conf import settings -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.http import HttpRequest, HttpResponse @@ -36,12 +36,12 @@ from testfixtures import LogCapture from lms.djangoapps.bulk_email.models import BulkEmailFlag, CourseEmail, CourseEmailTemplate from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.course_modes.tests.factories import CourseModeFactory -from edx_toggles.toggles.testutils import override_waffle_flag +from edx_toggles.toggles.testutils import override_waffle_flag # lint-amnesty, pylint: disable=unused-import, wrong-import-order from lms.djangoapps.certificates.api import generate_user_certificates from lms.djangoapps.certificates.models import CertificateStatuses from lms.djangoapps.certificates.tests.factories import GeneratedCertificateFactory from lms.djangoapps.courseware.models import StudentModule -from lms.djangoapps.courseware.tests.factories import ( +from lms.djangoapps.courseware.tests.factories import ( # lint-amnesty, pylint: disable=unused-import BetaTesterFactory, GlobalStaffFactory, InstructorFactory, @@ -87,14 +87,14 @@ from common.djangoapps.student.models import ( get_retired_email_by_email, get_retired_username_by_username ) -from common.djangoapps.student.roles import ( +from common.djangoapps.student.roles import ( # lint-amnesty, pylint: disable=unused-import CourseBetaTesterRole, CourseDataResearcherRole, CourseFinanceAdminRole, CourseInstructorRole, CourseSalesAdminRole ) -from common.djangoapps.student.tests.factories import AdminFactory, UserFactory +from common.djangoapps.student.tests.factories import AdminFactory, UserFactory # lint-amnesty, pylint: disable=unused-import from xmodule.fields import Date from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase @@ -251,7 +251,7 @@ class TestCommonExceptions400(TestCase): """ def setUp(self): - super(TestCommonExceptions400, self).setUp() + super(TestCommonExceptions400, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.request = Mock(spec=HttpRequest) self.request.META = {} @@ -318,7 +318,7 @@ class TestEndpointHttpMethods(SharedModuleStoreTestCase, LoginEnrollmentTestCase """ Set up global staff role so authorization will not fail. """ - super(TestEndpointHttpMethods, self).setUp() + super(TestEndpointHttpMethods, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments global_user = GlobalStaffFactory() self.client.login(username=global_user.username, password='test') @@ -353,7 +353,7 @@ class TestEndpointHttpMethods(SharedModuleStoreTestCase, LoginEnrollmentTestCase ) -@patch('lms.djangoapps.bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) +@patch('lms.djangoapps.bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) # lint-amnesty, pylint: disable=line-too-long class TestInstructorAPIDenyLevels(SharedModuleStoreTestCase, LoginEnrollmentTestCase): """ Ensure that users cannot access endpoints they shouldn't be able to. @@ -402,7 +402,7 @@ class TestInstructorAPIDenyLevels(SharedModuleStoreTestCase, LoginEnrollmentTest BulkEmailFlag.objects.all().delete() def setUp(self): - super(TestInstructorAPIDenyLevels, self).setUp() + super(TestInstructorAPIDenyLevels, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory.create() CourseEnrollment.enroll(self.user, self.course.id) @@ -613,7 +613,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(SharedModuleStoreTestCas ) def setUp(self): - super(TestInstructorAPIBulkAccountCreationAndEnrollment, self).setUp() + super(TestInstructorAPIBulkAccountCreationAndEnrollment, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments # Create a course with mode 'honor' and with price self.white_label_course = CourseFactory.create() @@ -754,7 +754,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(SharedModuleStoreTestCas self.assertEqual(len(data['row_errors']), 0) self.assertEqual(len(data['warnings']), 0) self.assertEqual(len(data['general_errors']), 1) - self.assertEqual(data['general_errors'][0]['response'], 'Data in row #1 must have exactly four columns: email, username, full name, and country') + self.assertEqual(data['general_errors'][0]['response'], 'Data in row #1 must have exactly four columns: email, username, full name, and country') # lint-amnesty, pylint: disable=line-too-long manual_enrollments = ManualEnrollmentAudit.objects.all() self.assertEqual(manual_enrollments.count(), 0) @@ -808,7 +808,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(SharedModuleStoreTestCas self.assertEqual(response.status_code, 200) data = json.loads(response.content.decode('utf-8')) warning_message = u'An account with email {email} exists but the provided username {username} ' \ - u'is different. Enrolling anyway with {email}.'.format(email='test_student@example.com', username='test_student_2') + u'is different. Enrolling anyway with {email}.'.format(email='test_student@example.com', username='test_student_2') # lint-amnesty, pylint: disable=line-too-long self.assertNotEqual(len(data['warnings']), 0) self.assertEqual(data['warnings'][0]['response'], warning_message) user = User.objects.get(email='test_student@example.com') @@ -861,7 +861,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(SharedModuleStoreTestCas self.assertEqual(response.status_code, 200) data = json.loads(response.content.decode('utf-8')) self.assertNotEqual(len(data['row_errors']), 0) - self.assertEqual(data['row_errors'][0]['response'], u'Username {user} already exists.'.format(user='test_student_1')) + self.assertEqual(data['row_errors'][0]['response'], u'Username {user} already exists.'.format(user='test_student_1')) # lint-amnesty, pylint: disable=line-too-long def test_csv_file_not_attached(self): """ @@ -1046,7 +1046,7 @@ class TestInstructorAPIEnrollment(SharedModuleStoreTestCase, LoginEnrollmentTest cls.course_path = '/courses/{}/'.format(cls.course.id) def setUp(self): - super(TestInstructorAPIEnrollment, self).setUp() + super(TestInstructorAPIEnrollment, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.request = RequestFactory().request() self.instructor = InstructorFactory(course_key=self.course.id) @@ -1088,7 +1088,7 @@ class TestInstructorAPIEnrollment(SharedModuleStoreTestCase, LoginEnrollmentTest def test_invalid_email(self): url = reverse('students_update_enrollment', kwargs={'course_id': text_type(self.course.id)}) - response = self.client.post(url, {'identifiers': 'percivaloctavius@', 'action': 'enroll', 'email_students': False}) + response = self.client.post(url, {'identifiers': 'percivaloctavius@', 'action': 'enroll', 'email_students': False}) # lint-amnesty, pylint: disable=line-too-long self.assertEqual(response.status_code, 200) # test the response data @@ -1935,7 +1935,7 @@ class TestInstructorAPIBulkBetaEnrollment(SharedModuleStoreTestCase, LoginEnroll cls.course_path = '/courses/{}/'.format(cls.course.id) def setUp(self): - super(TestInstructorAPIBulkBetaEnrollment, self).setUp() + super(TestInstructorAPIBulkBetaEnrollment, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) self.client.login(username=self.instructor.username, password='test') @@ -2019,25 +2019,25 @@ class TestInstructorAPIBulkBetaEnrollment(SharedModuleStoreTestCase, LoginEnroll def test_add_notenrolled_email(self): url = reverse('bulk_beta_modify_access', kwargs={'course_id': text_type(self.course.id)}) - response = self.client.post(url, {'identifiers': self.notenrolled_student.email, 'action': 'add', 'email_students': False}) + response = self.client.post(url, {'identifiers': self.notenrolled_student.email, 'action': 'add', 'email_students': False}) # lint-amnesty, pylint: disable=line-too-long self.add_notenrolled(response, self.notenrolled_student.email) self.assertFalse(CourseEnrollment.is_enrolled(self.notenrolled_student, self.course.id)) def test_add_notenrolled_email_autoenroll(self): url = reverse('bulk_beta_modify_access', kwargs={'course_id': text_type(self.course.id)}) - response = self.client.post(url, {'identifiers': self.notenrolled_student.email, 'action': 'add', 'email_students': False, 'auto_enroll': True}) + response = self.client.post(url, {'identifiers': self.notenrolled_student.email, 'action': 'add', 'email_students': False, 'auto_enroll': True}) # lint-amnesty, pylint: disable=line-too-long self.add_notenrolled(response, self.notenrolled_student.email) self.assertTrue(CourseEnrollment.is_enrolled(self.notenrolled_student, self.course.id)) def test_add_notenrolled_username(self): url = reverse('bulk_beta_modify_access', kwargs={'course_id': text_type(self.course.id)}) - response = self.client.post(url, {'identifiers': self.notenrolled_student.username, 'action': 'add', 'email_students': False}) + response = self.client.post(url, {'identifiers': self.notenrolled_student.username, 'action': 'add', 'email_students': False}) # lint-amnesty, pylint: disable=line-too-long self.add_notenrolled(response, self.notenrolled_student.username) self.assertFalse(CourseEnrollment.is_enrolled(self.notenrolled_student, self.course.id)) def test_add_notenrolled_username_autoenroll(self): url = reverse('bulk_beta_modify_access', kwargs={'course_id': text_type(self.course.id)}) - response = self.client.post(url, {'identifiers': self.notenrolled_student.username, 'action': 'add', 'email_students': False, 'auto_enroll': True}) + response = self.client.post(url, {'identifiers': self.notenrolled_student.username, 'action': 'add', 'email_students': False, 'auto_enroll': True}) # lint-amnesty, pylint: disable=line-too-long self.add_notenrolled(response, self.notenrolled_student.username) self.assertTrue(CourseEnrollment.is_enrolled(self.notenrolled_student, self.course.id)) @@ -2155,7 +2155,7 @@ class TestInstructorAPIBulkBetaEnrollment(SharedModuleStoreTestCase, LoginEnroll def test_add_notenrolled_email_mktgsite(self): # Try with marketing site enabled url = reverse('bulk_beta_modify_access', kwargs={'course_id': text_type(self.course.id)}) - response = self.client.post(url, {'identifiers': self.notenrolled_student.email, 'action': 'add', 'email_students': True}) + response = self.client.post(url, {'identifiers': self.notenrolled_student.email, 'action': 'add', 'email_students': True}) # lint-amnesty, pylint: disable=line-too-long self.assertEqual(response.status_code, 200) @@ -2302,7 +2302,7 @@ class TestInstructorAPILevelsAccess(SharedModuleStoreTestCase, LoginEnrollmentTe cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorAPILevelsAccess, self).setUp() + super(TestInstructorAPILevelsAccess, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) self.client.login(username=self.instructor.username, password='test') @@ -2537,7 +2537,7 @@ class TestInstructorAPILevelsDataDump(SharedModuleStoreTestCase, LoginEnrollment cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorAPILevelsDataDump, self).setUp() + super(TestInstructorAPILevelsDataDump, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course_mode = CourseMode(course_id=self.course.id, mode_slug="honor", mode_display_name="honor cert", @@ -2957,7 +2957,7 @@ class TestInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginEnrollmentTes cls.problem_urlname = text_type(cls.problem_location) def setUp(self): - super(TestInstructorAPIRegradeTask, self).setUp() + super(TestInstructorAPIRegradeTask, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) self.client.login(username=self.instructor.username, password='test') @@ -3147,7 +3147,7 @@ class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginE ) def setUp(self): - super(TestEntranceExamInstructorAPIRegradeTask, self).setUp() + super(TestEntranceExamInstructorAPIRegradeTask, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) # Add instructor to invalid ee course @@ -3382,7 +3382,7 @@ class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginE self.assertContains(response, message) -@patch('lms.djangoapps.bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) +@patch('lms.djangoapps.bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message', autospec=True)) # lint-amnesty, pylint: disable=line-too-long class TestInstructorSendEmail(SiteMixin, SharedModuleStoreTestCase, LoginEnrollmentTestCase): """ Checks that only instructors have access to email endpoints, and that @@ -3408,7 +3408,7 @@ class TestInstructorSendEmail(SiteMixin, SharedModuleStoreTestCase, LoginEnrollm BulkEmailFlag.objects.all().delete() def setUp(self): - super(TestInstructorSendEmail, self).setUp() + super(TestInstructorSendEmail, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) self.client.login(username=self.instructor.username, password='test') @@ -3581,7 +3581,7 @@ class TestInstructorAPITaskLists(SharedModuleStoreTestCase, LoginEnrollmentTestC cls.problem_urlname = text_type(cls.problem_location) def setUp(self): - super(TestInstructorAPITaskLists, self).setUp() + super(TestInstructorAPITaskLists, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) self.client.login(username=self.instructor.username, password='test') @@ -3700,7 +3700,7 @@ class TestInstructorEmailContentList(SharedModuleStoreTestCase, LoginEnrollmentT cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorEmailContentList, self).setUp() + super(TestInstructorEmailContentList, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) self.client.login(username=self.instructor.username, password='test') @@ -3909,7 +3909,7 @@ class TestDueDateExtensions(SharedModuleStoreTestCase, LoginEnrollmentTestCase): """ Fixtures. """ - super(TestDueDateExtensions, self).setUp() + super(TestDueDateExtensions, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments user1 = UserFactory.create() StudentModule( @@ -4075,7 +4075,7 @@ class TestDueDateExtensionsDeletedDate(ModuleStoreTestCase, LoginEnrollmentTestC """ Fixtures. """ - super(TestDueDateExtensionsDeletedDate, self).setUp() + super(TestDueDateExtensionsDeletedDate, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create() self.due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=UTC) @@ -4192,7 +4192,7 @@ class TestCourseIssuedCertificatesData(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(TestCourseIssuedCertificatesData, self).setUp() + super(TestCourseIssuedCertificatesData, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.instructor = InstructorFactory(course_key=self.course.id) self.client.login(username=self.instructor.username, password='test') @@ -4302,7 +4302,7 @@ class TestBulkCohorting(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(TestBulkCohorting, self).setUp() + super(TestBulkCohorting, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.staff_user = StaffFactory(course_key=self.course.id) self.non_staff_user = UserFactory.create() self.tempdir = tempfile.mkdtemp() diff --git a/lms/djangoapps/instructor/tests/test_api_email_localization.py b/lms/djangoapps/instructor/tests/test_api_email_localization.py index 473878dcdf..4deae182e3 100644 --- a/lms/djangoapps/instructor/tests/test_api_email_localization.py +++ b/lms/djangoapps/instructor/tests/test_api_email_localization.py @@ -30,7 +30,7 @@ class TestInstructorAPIEnrollmentEmailLocalization(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(TestInstructorAPIEnrollmentEmailLocalization, self).setUp() + super(TestInstructorAPIEnrollmentEmailLocalization, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments # Platform language is English, instructor's language is Chinese, # student's language is Esperanto, so the emails should all be sent in diff --git a/lms/djangoapps/instructor/tests/test_certificates.py b/lms/djangoapps/instructor/tests/test_certificates.py index 36600486fa..6c0c423a2a 100644 --- a/lms/djangoapps/instructor/tests/test_certificates.py +++ b/lms/djangoapps/instructor/tests/test_certificates.py @@ -58,7 +58,7 @@ class CertificatesInstructorDashTest(SharedModuleStoreTestCase): ) def setUp(self): - super(CertificatesInstructorDashTest, self).setUp() + super(CertificatesInstructorDashTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.global_staff = GlobalStaffFactory() self.instructor = InstructorFactory(course_key=self.course.id) @@ -224,7 +224,7 @@ class CertificatesInstructorApiTest(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(CertificatesInstructorApiTest, self).setUp() + super(CertificatesInstructorApiTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.global_staff = GlobalStaffFactory() self.instructor = InstructorFactory(course_key=self.course.id) self.user = UserFactory() @@ -491,7 +491,7 @@ class CertificateExceptionViewInstructorApiTest(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(CertificateExceptionViewInstructorApiTest, self).setUp() + super(CertificateExceptionViewInstructorApiTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.global_staff = GlobalStaffFactory() self.instructor = InstructorFactory(course_key=self.course.id) self.user = UserFactory() @@ -777,7 +777,7 @@ class GenerateCertificatesInstructorApiTest(SharedModuleStoreTestCase): cls.course = CourseFactory.create() def setUp(self): - super(GenerateCertificatesInstructorApiTest, self).setUp() + super(GenerateCertificatesInstructorApiTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.global_staff = GlobalStaffFactory() self.instructor = InstructorFactory(course_key=self.course.id) self.user = UserFactory() @@ -897,7 +897,7 @@ class TestCertificatesInstructorApiBulkWhiteListExceptions(SharedModuleStoreTest kwargs={'course_id': cls.course.id}) def setUp(self): - super(TestCertificatesInstructorApiBulkWhiteListExceptions, self).setUp() + super(TestCertificatesInstructorApiBulkWhiteListExceptions, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.global_staff = GlobalStaffFactory() self.enrolled_user_1 = UserFactory( username='TestStudent1', @@ -1055,7 +1055,7 @@ class CertificateInvalidationViewTests(SharedModuleStoreTestCase): cls.notes = "Test notes." def setUp(self): - super(CertificateInvalidationViewTests, self).setUp() + super(CertificateInvalidationViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.global_staff = GlobalStaffFactory() self.enrolled_user_1 = UserFactory( username='TestStudent1', diff --git a/lms/djangoapps/instructor/tests/test_email.py b/lms/djangoapps/instructor/tests/test_email.py index 72fc6bb525..729012d20c 100644 --- a/lms/djangoapps/instructor/tests/test_email.py +++ b/lms/djangoapps/instructor/tests/test_email.py @@ -34,14 +34,14 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase): cls.email_link = '' def setUp(self): - super(TestNewInstructorDashboardEmailViewMongoBacked, self).setUp() + super(TestNewInstructorDashboardEmailViewMongoBacked, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments # Create instructor account instructor = AdminFactory.create() self.client.login(username=instructor.username, password="test") def tearDown(self): - super(TestNewInstructorDashboardEmailViewMongoBacked, self).tearDown() + super(TestNewInstructorDashboardEmailViewMongoBacked, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments BulkEmailFlag.objects.all().delete() # In order for bulk email to work, we must have both the BulkEmailFlag.is_enabled() @@ -128,7 +128,7 @@ class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase): cls.email_link = '' def setUp(self): - super(TestNewInstructorDashboardEmailViewXMLBacked, self).setUp() + super(TestNewInstructorDashboardEmailViewXMLBacked, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments # Create instructor account instructor = AdminFactory.create() @@ -140,7 +140,7 @@ class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase): self.email_link = '' def tearDown(self): - super(TestNewInstructorDashboardEmailViewXMLBacked, self).tearDown() + super(TestNewInstructorDashboardEmailViewXMLBacked, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments BulkEmailFlag.objects.all().delete() # The flag is enabled, and since REQUIRE_COURSE_EMAIL_AUTH is False, all courses should diff --git a/lms/djangoapps/instructor/tests/test_enrollment.py b/lms/djangoapps/instructor/tests/test_enrollment.py index bae4f632cf..ae2f9835f7 100644 --- a/lms/djangoapps/instructor/tests/test_enrollment.py +++ b/lms/djangoapps/instructor/tests/test_enrollment.py @@ -48,7 +48,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory class TestSettableEnrollmentState(CacheIsolationTestCase): """ Test the basis class for enrollment tests. """ def setUp(self): - super(TestSettableEnrollmentState, self).setUp() + super(TestSettableEnrollmentState, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course_key = CourseLocator('Robot', 'fAKE', 'C--se--ID') def test_mes_create(self): @@ -77,7 +77,7 @@ class TestEnrollmentChangeBase(six.with_metaclass(ABCMeta, CacheIsolationTestCas """ def setUp(self): - super(TestEnrollmentChangeBase, self).setUp() + super(TestEnrollmentChangeBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course_key = CourseLocator('Robot', 'fAKE', 'C--se--ID') def _run_state_change_test(self, before_ideal, after_ideal, action): @@ -378,8 +378,8 @@ class TestInstructorEnrollmentStudentModule(SharedModuleStoreTestCase): org='course', run='id', ) - cls.course_key = cls.course.location.course_key - with cls.store.bulk_operations(cls.course.id, emit_signals=False): + cls.course_key = cls.course.location.course_key # lint-amnesty, pylint: disable=no-member + with cls.store.bulk_operations(cls.course.id, emit_signals=False): # lint-amnesty, pylint: disable=no-member cls.parent = ItemFactory( category="library_content", parent=cls.course, @@ -403,7 +403,7 @@ class TestInstructorEnrollmentStudentModule(SharedModuleStoreTestCase): ) def setUp(self): - super(TestInstructorEnrollmentStudentModule, self).setUp() + super(TestInstructorEnrollmentStudentModule, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory() @@ -860,7 +860,7 @@ class TestSendBetaRoleEmail(CacheIsolationTestCase): """ def setUp(self): - super(TestSendBetaRoleEmail, self).setUp() + super(TestSendBetaRoleEmail, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.user = UserFactory.create() self.email_params = {'course': 'Robot Super Course'} @@ -885,7 +885,7 @@ class TestGetEmailParamsCCX(SharedModuleStoreTestCase): @patch.dict('django.conf.settings.FEATURES', {'CUSTOM_COURSES_EDX': True}) def setUp(self): - super(TestGetEmailParamsCCX, self).setUp() + super(TestGetEmailParamsCCX, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.coach = AdminFactory.create() role = CourseCcxCoachRole(self.course.id) role.add_users(self.coach) @@ -978,7 +978,7 @@ class TestRenderMessageToString(EmailTemplateTagMixin, SharedModuleStoreTestCase @patch.dict('django.conf.settings.FEATURES', {'CUSTOM_COURSES_EDX': True}) def setUp(self): - super(TestRenderMessageToString, self).setUp() + super(TestRenderMessageToString, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments coach = AdminFactory.create() role = CourseCcxCoachRole(self.course.id) role.add_users(coach) diff --git a/lms/djangoapps/instructor/tests/test_proctoring.py b/lms/djangoapps/instructor/tests/test_proctoring.py index 41dc9c9272..bf8d38ca68 100644 --- a/lms/djangoapps/instructor/tests/test_proctoring.py +++ b/lms/djangoapps/instructor/tests/test_proctoring.py @@ -29,11 +29,11 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase): @classmethod def setUpClass(cls): super(TestProctoringDashboardViews, cls).setUpClass() - button = '' + button = '' # lint-amnesty, pylint: disable=line-too-long cls.proctoring_link = button def setUp(self): - super(TestProctoringDashboardViews, self).setUp() + super(TestProctoringDashboardViews, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments # Create instructor account self.instructor = AdminFactory.create() @@ -43,13 +43,13 @@ class TestProctoringDashboardViews(SharedModuleStoreTestCase): """ Create URL for instructor dashboard """ - self.url = reverse('instructor_dashboard', kwargs={'course_id': text_type(course.id)}) + self.url = reverse('instructor_dashboard', kwargs={'course_id': text_type(course.id)}) # lint-amnesty, pylint: disable=attribute-defined-outside-init def setup_course(self, enable_proctored_exams, enable_timed_exams): """ Create course based on proctored exams and timed exams values """ - self.course = CourseFactory.create(enable_proctored_exams=enable_proctored_exams, + self.course = CourseFactory.create(enable_proctored_exams=enable_proctored_exams, # lint-amnesty, pylint: disable=attribute-defined-outside-init enable_timed_exams=enable_timed_exams) self.setup_course_url(self.course) diff --git a/lms/djangoapps/instructor/tests/test_services.py b/lms/djangoapps/instructor/tests/test_services.py index 67e57b49ec..c8efd426d0 100644 --- a/lms/djangoapps/instructor/tests/test_services.py +++ b/lms/djangoapps/instructor/tests/test_services.py @@ -43,7 +43,7 @@ class InstructorServiceTests(SharedModuleStoreTestCase): cls.other_problem_urlname = six.text_type(cls.other_problem_location) def setUp(self): - super(InstructorServiceTests, self).setUp() + super(InstructorServiceTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.student = UserFactory() CourseEnrollment.enroll(self.student, self.course.id) @@ -94,7 +94,7 @@ class InstructorServiceTests(SharedModuleStoreTestCase): Negative test of trying to reset attempts with bad content_id """ - result = self.service.delete_student_attempt( + result = self.service.delete_student_attempt( # lint-amnesty, pylint: disable=assignment-from-none self.student.username, six.text_type(self.course.id), 'foo/bar/baz', @@ -107,7 +107,7 @@ class InstructorServiceTests(SharedModuleStoreTestCase): Negative test of trying to reset attempts with bad user identifier """ - result = self.service.delete_student_attempt( + result = self.service.delete_student_attempt( # lint-amnesty, pylint: disable=assignment-from-none 'bad_student', six.text_type(self.course.id), 'foo/bar/baz', @@ -120,7 +120,7 @@ class InstructorServiceTests(SharedModuleStoreTestCase): Negative test of trying to reset attempts with bad user identifier """ - result = self.service.delete_student_attempt( + result = self.service.delete_student_attempt( # lint-amnesty, pylint: disable=assignment-from-none self.student.username, six.text_type(self.course.id), self.other_problem_urlname, diff --git a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py index 00ae66ae21..bea2463fa4 100644 --- a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py +++ b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py @@ -57,7 +57,7 @@ class TestGradebook(SharedModuleStoreTestCase): ] def setUp(self): - super(TestGradebook, self).setUp() + super(TestGradebook, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments instructor = AdminFactory.create() self.client.login(username=instructor.username, password='test') diff --git a/lms/djangoapps/instructor/tests/test_tools.py b/lms/djangoapps/instructor/tests/test_tools.py index f6606a2716..ec57255fca 100644 --- a/lms/djangoapps/instructor/tests/test_tools.py +++ b/lms/djangoapps/instructor/tests/test_tools.py @@ -9,7 +9,7 @@ import unittest import mock import six -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.core.exceptions import MultipleObjectsReturned from django.test import TestCase from opaque_keys.edx.keys import CourseKey @@ -56,7 +56,7 @@ class TestHandleDashboardError(unittest.TestCase): def test_no_error(self): @tools.handle_dashboard_error - def view(request, course_id): + def view(request, course_id): # lint-amnesty, pylint: disable=unused-argument """ Returns "Oh yes!" """ @@ -73,7 +73,7 @@ class TestRequireStudentIdentifier(TestCase): """ Fixtures """ - super(TestRequireStudentIdentifier, self).setUp() + super(TestRequireStudentIdentifier, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.student = UserFactory.create() def test_valid_student_id(self): @@ -208,7 +208,7 @@ class TestSetDueDateExtension(ModuleStoreTestCase): """ Fixtures. """ - super(TestSetDueDateExtension, self).setUp() + super(TestSetDueDateExtension, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.due = due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=UTC) course = CourseFactory.create() @@ -297,7 +297,7 @@ class TestDataDumps(ModuleStoreTestCase): """ Fixtures. """ - super(TestDataDumps, self).setUp() + super(TestDataDumps, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments due = datetime.datetime(2010, 5, 12, 2, 42, tzinfo=UTC) course = CourseFactory.create() diff --git a/lms/djangoapps/instructor/tests/utils.py b/lms/djangoapps/instructor/tests/utils.py index 87ca8297aa..084e619498 100644 --- a/lms/djangoapps/instructor/tests/utils.py +++ b/lms/djangoapps/instructor/tests/utils.py @@ -34,8 +34,8 @@ class FakeContentTask(FakeInfo): 'requester', ] - def __init__(self, email_id, num_sent, num_failed, sent_to): - super(FakeContentTask, self).__init__() + def __init__(self, email_id, num_sent, num_failed, sent_to): # lint-amnesty, pylint: disable=unused-argument + super(FakeContentTask, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments self.task_input = {'email_id': email_id} self.task_input = json.dumps(self.task_input) self.task_output = {'succeeded': num_sent, 'failed': num_failed} @@ -57,7 +57,7 @@ class FakeEmail(FakeInfo): ] def __init__(self, email_id): - super(FakeEmail, self).__init__() + super(FakeEmail, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments self.id = six.text_type(email_id) # pylint: disable=invalid-name # Select a random data for create field year = random.randint(1950, 2000) @@ -102,7 +102,7 @@ class FakeEmailInfo(FakeInfo): ] def __init__(self, fake_email, num_sent, num_failed): - super(FakeEmailInfo, self).__init__() + super(FakeEmailInfo, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments self.created = get_default_time_display(fake_email.created) number_sent = str(num_sent) + ' sent' diff --git a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py index 77873d8833..37b2224c8d 100644 --- a/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py +++ b/lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py @@ -20,7 +20,7 @@ from six.moves import range from common.test.utils import XssTestMixin from common.djangoapps.course_modes.models import CourseMode -from edx_toggles.toggles.testutils import override_waffle_flag +from edx_toggles.toggles.testutils import override_waffle_flag # lint-amnesty, pylint: disable=wrong-import-order from common.djangoapps.edxmako.shortcuts import render_to_response from lms.djangoapps.courseware.tabs import get_course_tab_list from lms.djangoapps.courseware.tests.factories import StaffFactory, StudentModuleFactory, UserFactory @@ -30,7 +30,7 @@ from lms.djangoapps.instructor.toggles import DATA_DOWNLOAD_V2 from lms.djangoapps.instructor.views.gradebook_api import calculate_page_info from openedx.core.djangoapps.site_configuration.models import SiteConfiguration from common.djangoapps.student.models import CourseEnrollment -from common.djangoapps.student.roles import CourseFinanceAdminRole +from common.djangoapps.student.roles import CourseFinanceAdminRole # lint-amnesty, pylint: disable=unused-import from common.djangoapps.student.tests.factories import AdminFactory, CourseAccessRoleFactory, CourseEnrollmentFactory from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase @@ -61,7 +61,7 @@ class TestInstructorDashboard(ModuleStoreTestCase, LoginEnrollmentTestCase, XssT """ Set up tests """ - super(TestInstructorDashboard, self).setUp() + super(TestInstructorDashboard, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create( grading_policy={"GRADE_CUTOFFS": {"A": 0.75, "B": 0.63, "C": 0.57, "D": 0.5}}, display_name='' @@ -574,7 +574,7 @@ class TestInstructorDashboardPerformance(ModuleStoreTestCase, LoginEnrollmentTes """ Set up tests """ - super(TestInstructorDashboardPerformance, self).setUp() + super(TestInstructorDashboardPerformance, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments self.course = CourseFactory.create( grading_policy={"GRADE_CUTOFFS": {"A": 0.75, "B": 0.63, "C": 0.57, "D": 0.5}}, display_name='', diff --git a/lms/djangoapps/instructor/toggles.py b/lms/djangoapps/instructor/toggles.py index 5ada0fea91..4fc8642e9a 100644 --- a/lms/djangoapps/instructor/toggles.py +++ b/lms/djangoapps/instructor/toggles.py @@ -3,7 +3,7 @@ Waffle flags for instructor dashboard. """ from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace -from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag +from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag # lint-amnesty, pylint: disable=unused-import WAFFLE_NAMESPACE = 'instructor' # Namespace for instructor waffle flags. diff --git a/lms/djangoapps/instructor/utils.py b/lms/djangoapps/instructor/utils.py index 25caf74fd8..36535536f1 100644 --- a/lms/djangoapps/instructor/utils.py +++ b/lms/djangoapps/instructor/utils.py @@ -13,7 +13,7 @@ class DummyRequest(object): META = {} - def __init__(self): + def __init__(self): # lint-amnesty, pylint: disable=useless-return self.session = {} self.user = None return diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index a8fd73b315..1cf944bd51 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -105,7 +105,7 @@ def show_analytics_dashboard_message(course_key): @ensure_csrf_cookie @cache_control(no_cache=True, no_store=True, must_revalidate=True) -def instructor_dashboard_2(request, course_id): +def instructor_dashboard_2(request, course_id): # lint-amnesty, pylint: disable=too-many-statements """ Display the instructor dashboard for a course. """ try: course_key = CourseKey.from_string(course_id) @@ -128,9 +128,9 @@ def instructor_dashboard_2(request, course_id): if not request.user.has_perm(permissions.VIEW_DASHBOARD, course_key): raise Http404() - is_white_label = CourseMode.is_white_label(course_key) + is_white_label = CourseMode.is_white_label(course_key) # lint-amnesty, pylint: disable=unused-variable - reports_enabled = configuration_helpers.get_value('SHOW_ECOMMERCE_REPORTS', False) + reports_enabled = configuration_helpers.get_value('SHOW_ECOMMERCE_REPORTS', False) # lint-amnesty, pylint: disable=unused-variable sections = [] if access['staff']: @@ -160,7 +160,7 @@ def instructor_dashboard_2(request, course_id): sections.append(_section_analytics(course, access)) # Check if there is corresponding entry in the CourseMode Table related to the Instructor Dashboard course - course_mode_has_price = False + course_mode_has_price = False # lint-amnesty, pylint: disable=unused-variable paid_modes = CourseMode.paid_modes_for_course(course_key) if len(paid_modes) == 1: course_mode_has_price = True @@ -510,7 +510,7 @@ def _section_cohort_management(course, access): return section_data -def _section_discussions_management(course, access): +def _section_discussions_management(course, access): # lint-amnesty, pylint: disable=unused-argument """ Provide data for the corresponding discussion management section """ course_key = course.id enrollment_track_schemes = available_division_schemes(course_key) @@ -626,7 +626,7 @@ def _section_data_download(course, access): 'list_report_downloads_url': reverse('list_report_downloads', kwargs={'course_id': six.text_type(course_key)}), 'calculate_grades_csv_url': reverse('calculate_grades_csv', kwargs={'course_id': six.text_type(course_key)}), 'problem_grade_report_url': reverse('problem_grade_report', kwargs={'course_id': six.text_type(course_key)}), - 'course_has_survey': True if course.course_survey_name else False, + 'course_has_survey': True if course.course_survey_name else False, # lint-amnesty, pylint: disable=simplifiable-if-expression 'course_survey_results_url': reverse( 'get_course_survey_results', kwargs={'course_id': six.text_type(course_key)} ), diff --git a/lms/djangoapps/instructor/views/tools.py b/lms/djangoapps/instructor/views/tools.py index 562cfa03d3..cca5b91778 100644 --- a/lms/djangoapps/instructor/views/tools.py +++ b/lms/djangoapps/instructor/views/tools.py @@ -8,7 +8,7 @@ import operator import dateutil import six -from django.contrib.auth.models import User +from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user from django.http import HttpResponseBadRequest from django.utils.translation import ugettext as _ from edx_when import api @@ -79,7 +79,7 @@ def require_student_from_identifier(unique_student_identifier): try: return get_student_from_identifier(unique_student_identifier) except User.DoesNotExist: - raise DashboardError( + raise DashboardError( # lint-amnesty, pylint: disable=raise-missing-from _(u"Could not find student matching identifier: {student_identifier}").format( student_identifier=unique_student_identifier ) @@ -94,7 +94,7 @@ def parse_datetime(datestr): try: return dateutil.parser.parse(datestr).replace(tzinfo=UTC) except ValueError: - raise DashboardError(_("Unable to parse date: ") + datestr) + raise DashboardError(_("Unable to parse date: ") + datestr) # lint-amnesty, pylint: disable=raise-missing-from def find_unit(course, url):