BOM-2285
Apply pylint-amnesty.
This commit is contained in:
@@ -109,7 +109,7 @@ class ProgramCourseGradeOk(BaseProgramCourseGrade):
|
||||
Given a ProgramCourseEnrollment and course grade object,
|
||||
create a ProgramCourseGradeOk.
|
||||
"""
|
||||
super(ProgramCourseGradeOk, self).__init__(
|
||||
super(ProgramCourseGradeOk, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
|
||||
program_course_enrollment
|
||||
)
|
||||
self.passed = course_grade.passed
|
||||
@@ -129,7 +129,7 @@ class ProgramCourseGradeError(BaseProgramCourseGrade):
|
||||
Given a ProgramCourseEnrollment and an Exception,
|
||||
create a ProgramCourseGradeError.
|
||||
"""
|
||||
super(ProgramCourseGradeError, self).__init__(
|
||||
super(ProgramCourseGradeError, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
|
||||
program_course_enrollment
|
||||
)
|
||||
self.error = text_type(exception) if exception else "Unknown error"
|
||||
|
||||
@@ -451,7 +451,7 @@ def get_saml_provider_by_org_key(org_key):
|
||||
try:
|
||||
organization = Organization.objects.get(short_name=org_key)
|
||||
except Organization.DoesNotExist:
|
||||
raise BadOrganizationShortNameException(org_key)
|
||||
raise BadOrganizationShortNameException(org_key) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
return get_saml_provider_for_organization(organization)
|
||||
|
||||
|
||||
@@ -495,9 +495,9 @@ def get_saml_provider_for_organization(organization):
|
||||
try:
|
||||
provider_config = organization.samlproviderconfig_set.current_set().get(enabled=True)
|
||||
except SAMLProviderConfig.DoesNotExist:
|
||||
raise ProviderDoesNotExistException(organization)
|
||||
raise ProviderDoesNotExistException(organization) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
except SAMLProviderConfig.MultipleObjectsReturned:
|
||||
raise ProviderConfigurationException(organization)
|
||||
raise ProviderConfigurationException(organization) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
return provider_config
|
||||
|
||||
|
||||
|
||||
@@ -504,7 +504,7 @@ class GetUsersByExternalKeysTests(CacheIsolationTestCase):
|
||||
cls.user_2 = UserFactory(username='user-2')
|
||||
|
||||
def setUp(self):
|
||||
super(GetUsersByExternalKeysTests, self).setUp()
|
||||
super(GetUsersByExternalKeysTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
catalog_org = CatalogOrganizationFactory.create(key=self.organization_key)
|
||||
program = ProgramFactory.create(
|
||||
uuid=self.program_uuid,
|
||||
|
||||
@@ -75,7 +75,7 @@ class EnrollmentTestMixin(CacheIsolationTestCase):
|
||||
cls.student_2 = UserFactory(username='student-2')
|
||||
|
||||
def setUp(self):
|
||||
super(EnrollmentTestMixin, self).setUp()
|
||||
super(EnrollmentTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=self.program_uuid), self.program, None)
|
||||
|
||||
def create_program_enrollment(self, external_user_key, user=False):
|
||||
|
||||
@@ -73,14 +73,14 @@ class Command(BaseCommand):
|
||||
try:
|
||||
parsed_program_uuid = UUID(program_uuid)
|
||||
except ValueError:
|
||||
raise CommandError("supplied program_uuid '{}' is not a valid UUID")
|
||||
raise CommandError("supplied program_uuid '{}' is not a valid UUID") # lint-amnesty, pylint: disable=raise-missing-from
|
||||
ext_keys_to_usernames = self.parse_user_items(user_items)
|
||||
try:
|
||||
link_program_enrollments(
|
||||
parsed_program_uuid, ext_keys_to_usernames
|
||||
)
|
||||
except Exception as e:
|
||||
raise CommandError(str(e))
|
||||
raise CommandError(str(e)) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
def parse_user_items(self, user_items):
|
||||
"""
|
||||
|
||||
@@ -29,7 +29,7 @@ class TestResetEnrollmentData(TestCase):
|
||||
cls.program_uuid = uuid4()
|
||||
|
||||
def setUp(self):
|
||||
super(TestResetEnrollmentData, self).setUp()
|
||||
super(TestResetEnrollmentData, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory()
|
||||
|
||||
@contextmanager
|
||||
|
||||
@@ -4,7 +4,7 @@ Django model specifications for the Program Enrollments API
|
||||
"""
|
||||
|
||||
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 import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@@ -85,7 +85,7 @@ class ProgramEnrollment(TimeStampedModel):
|
||||
return '[ProgramEnrollment id={}]'.format(self.id)
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
return ( # lint-amnesty, pylint: disable=missing-format-attribute
|
||||
"<ProgramEnrollment" # pylint: disable=missing-format-attribute
|
||||
" id={self.id}"
|
||||
" user={self.user!r}"
|
||||
@@ -141,7 +141,7 @@ class ProgramCourseEnrollment(TimeStampedModel):
|
||||
return '[ProgramCourseEnrollment id={}]'.format(self.id)
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
return ( # lint-amnesty, pylint: disable=missing-format-attribute
|
||||
"<ProgramCourseEnrollment" # pylint: disable=missing-format-attribute
|
||||
" id={self.id}"
|
||||
" program_enrollment={self.program_enrollment!r}"
|
||||
@@ -168,7 +168,7 @@ class CourseAccessRoleAssignment(TimeStampedModel):
|
||||
return '[CourseAccessRoleAssignment id={}]'.format(self.id)
|
||||
|
||||
def __repr__(self):
|
||||
return (
|
||||
return ( # lint-amnesty, pylint: disable=missing-format-attribute
|
||||
"<CourseAccessRoleAssignment" # pylint: disable=missing-format-attribute
|
||||
" id={self.id}"
|
||||
" role={self.role!r}"
|
||||
|
||||
@@ -10,7 +10,7 @@ from uuid import UUID, uuid4
|
||||
import ddt
|
||||
import mock
|
||||
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.cache import cache
|
||||
from django.test import override_settings
|
||||
from django.urls import reverse
|
||||
@@ -137,7 +137,7 @@ class EnrollmentsDataMixin(ProgramCacheMixin):
|
||||
cls.global_staff = GlobalStaffFactory(username='global-staff', password=cls.password)
|
||||
|
||||
def setUp(self):
|
||||
super(EnrollmentsDataMixin, self).setUp()
|
||||
super(EnrollmentsDataMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.set_program_in_catalog_cache(self.program_uuid, self.program)
|
||||
|
||||
@classmethod
|
||||
@@ -456,12 +456,12 @@ class ProgramEnrollmentsPostTests(ProgramEnrollmentsWriteMixin, APITestCase):
|
||||
add_uuid = True
|
||||
|
||||
def setUp(self):
|
||||
super(ProgramEnrollmentsPostTests, self).setUp()
|
||||
super(ProgramEnrollmentsPostTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.request = self.client.post
|
||||
self.client.login(username=self.global_staff.username, password='password')
|
||||
|
||||
def tearDown(self):
|
||||
super(ProgramEnrollmentsPostTests, self).tearDown()
|
||||
super(ProgramEnrollmentsPostTests, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
ProgramEnrollment.objects.all().delete()
|
||||
|
||||
def test_successful_program_enrollments_no_existing_user(self):
|
||||
@@ -554,7 +554,7 @@ class ProgramEnrollmentsPatchTests(ProgramEnrollmentsWriteMixin, APITestCase):
|
||||
add_uuid = False
|
||||
|
||||
def setUp(self):
|
||||
super(ProgramEnrollmentsPatchTests, self).setUp()
|
||||
super(ProgramEnrollmentsPatchTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.request = self.client.patch
|
||||
self.client.login(username=self.global_staff.username, password=self.password)
|
||||
|
||||
@@ -699,7 +699,7 @@ class ProgramEnrollmentsPutTests(ProgramEnrollmentsWriteMixin, APITestCase):
|
||||
add_uuid = True
|
||||
|
||||
def setUp(self):
|
||||
super(ProgramEnrollmentsPutTests, self).setUp()
|
||||
super(ProgramEnrollmentsPutTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.request = self.client.put
|
||||
self.client.login(username=self.global_staff.username, password='password')
|
||||
|
||||
@@ -785,7 +785,7 @@ class ProgramCourseEnrollmentsMixin(EnrollmentsDataMixin):
|
||||
super(ProgramCourseEnrollmentsMixin, cls).tearDownClass()
|
||||
|
||||
def setUp(self):
|
||||
super(ProgramCourseEnrollmentsMixin, self).setUp()
|
||||
super(ProgramCourseEnrollmentsMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.default_url = self.get_url(course_id=self.course_id)
|
||||
self.log_in_staff()
|
||||
|
||||
@@ -1150,7 +1150,7 @@ class MultiprogramEnrollmentsTest(EnrollmentsDataMixin, APITestCase):
|
||||
cls.user = UserFactory.create(username='multiprogram_user')
|
||||
|
||||
def setUp(self):
|
||||
super(MultiprogramEnrollmentsTest, self).setUp()
|
||||
super(MultiprogramEnrollmentsTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.set_program_in_catalog_cache(self.another_program_uuid, self.another_program)
|
||||
self.client.login(username=self.global_staff.username, password=self.password)
|
||||
|
||||
@@ -2297,7 +2297,7 @@ class UserProgramCourseEnrollmentViewGetTests(ProgramCourseEnrollmentOverviewGet
|
||||
and the sizes of the each request.
|
||||
"""
|
||||
|
||||
def mock_get_enrollment_overviews(user, program, enrollments, request):
|
||||
def mock_get_enrollment_overviews(user, program, enrollments, request): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Mock implementation of `utils.get_enrollments_overviews`
|
||||
that returns a dict with the correct `course_run_id`
|
||||
@@ -2371,7 +2371,7 @@ class EnrollmentDataResetViewTests(ProgramCacheMixin, APITestCase):
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
super(EnrollmentDataResetViewTests, self).setUp()
|
||||
super(EnrollmentDataResetViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.start_cache_isolation()
|
||||
|
||||
self.organization = LMSOrganizationFactory(short_name='uox')
|
||||
@@ -2389,7 +2389,7 @@ class EnrollmentDataResetViewTests(ProgramCacheMixin, APITestCase):
|
||||
|
||||
def tearDown(self):
|
||||
self.end_cache_isolation()
|
||||
super(EnrollmentDataResetViewTests, self).tearDown()
|
||||
super(EnrollmentDataResetViewTests, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
@patch_call_command
|
||||
def test_feature_disabled_by_default(self, mock_call_command):
|
||||
|
||||
@@ -340,7 +340,7 @@ class ProgramEnrollmentsView(
|
||||
ok_write_statuses = ProgramOperationStatuses.__OK__
|
||||
|
||||
@verify_program_exists
|
||||
def get(self, request, program_uuid=None):
|
||||
def get(self, request, program_uuid=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
""" Defines the GET list endpoint for ProgramEnrollment objects. """
|
||||
enrollments = fetch_program_enrollments(
|
||||
self.program_uuid
|
||||
@@ -350,21 +350,21 @@ class ProgramEnrollmentsView(
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
@verify_program_exists
|
||||
def post(self, request, program_uuid=None):
|
||||
def post(self, request, program_uuid=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Create program enrollments for a list of learners
|
||||
"""
|
||||
return self.handle_write_request()
|
||||
|
||||
@verify_program_exists
|
||||
def patch(self, request, program_uuid=None):
|
||||
def patch(self, request, program_uuid=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Update program enrollments for a list of learners
|
||||
"""
|
||||
return self.handle_write_request()
|
||||
|
||||
@verify_program_exists
|
||||
def put(self, request, program_uuid=None):
|
||||
def put(self, request, program_uuid=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Create/update program enrollments for a list of learners
|
||||
"""
|
||||
@@ -498,21 +498,21 @@ class ProgramCourseEnrollmentsView(
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
@verify_course_exists_and_in_program
|
||||
def post(self, request, program_uuid=None, course_id=None):
|
||||
def post(self, request, program_uuid=None, course_id=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Enroll a list of students in a course in a program
|
||||
"""
|
||||
return self.handle_write_request()
|
||||
|
||||
@verify_course_exists_and_in_program
|
||||
def patch(self, request, program_uuid=None, course_id=None):
|
||||
def patch(self, request, program_uuid=None, course_id=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Modify the program course enrollments of a list of learners
|
||||
"""
|
||||
return self.handle_write_request()
|
||||
|
||||
@verify_course_exists_and_in_program
|
||||
def put(self, request, program_uuid=None, course_id=None):
|
||||
def put(self, request, program_uuid=None, course_id=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Create or Update the program course enrollments of a list of learners
|
||||
"""
|
||||
@@ -616,7 +616,7 @@ class ProgramCourseGradesView(
|
||||
pagination_class = ProgramEnrollmentPagination
|
||||
|
||||
@verify_course_exists_and_in_program
|
||||
def get(self, request, program_uuid=None, course_id=None):
|
||||
def get(self, request, program_uuid=None, course_id=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Defines the GET list endpoint for ProgramCourseGrade objects.
|
||||
"""
|
||||
@@ -823,7 +823,7 @@ class UserProgramCourseEnrollmentView(
|
||||
)
|
||||
@verify_program_exists
|
||||
@verify_user_enrolled_in_program
|
||||
def get(self, request, username, program_uuid):
|
||||
def get(self, request, username, program_uuid): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Get an overview of each of a user's course enrollments associated with a program.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ def _listen_for_lms_retire(sender, **kwargs): # pylint: disable=unused-argument
|
||||
|
||||
|
||||
@receiver(post_save, sender=UserSocialAuth)
|
||||
def listen_for_social_auth_creation(sender, instance, created, **kwargs):
|
||||
def listen_for_social_auth_creation(sender, instance, created, **kwargs): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Post-save signal that will attempt to link a social auth entry with waiting enrollments
|
||||
"""
|
||||
|
||||
@@ -18,7 +18,7 @@ class ProgramEnrollmentAdminTests(TestCase):
|
||||
new fields, etc.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(ProgramEnrollmentAdminTests, self).setUp()
|
||||
super(ProgramEnrollmentAdminTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.program_admin = ProgramEnrollmentAdmin(ProgramEnrollment, AdminSite())
|
||||
self.program_course_admin = ProgramCourseEnrollmentAdmin(ProgramCourseEnrollment, AdminSite())
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class ProgramEnrollmentModelTests(TestCase):
|
||||
"""
|
||||
Set up the test data used in the specific tests
|
||||
"""
|
||||
super(ProgramEnrollmentModelTests, self).setUp()
|
||||
super(ProgramEnrollmentModelTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory(username="rocko")
|
||||
self.program_uuid = UUID("88888888-4444-2222-1111-000000000000")
|
||||
self.other_program_uuid = UUID("88888888-4444-3333-1111-000000000000")
|
||||
@@ -124,7 +124,7 @@ class ProgramCourseEnrollmentModelTests(TestCase):
|
||||
"""
|
||||
Set up test data
|
||||
"""
|
||||
super(ProgramCourseEnrollmentModelTests, self).setUp()
|
||||
super(ProgramCourseEnrollmentModelTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
RequestCache.clear_all_namespaces()
|
||||
self.user = UserFactory(username="rocko")
|
||||
self.program_uuid = UUID("88888888-4444-2222-1111-000000000000")
|
||||
@@ -216,7 +216,7 @@ class CourseAccessRoleAssignmentTests(TestCase):
|
||||
Tests for the CourseAccessRoleAssignment model.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(CourseAccessRoleAssignmentTests, self).setUp()
|
||||
super(CourseAccessRoleAssignmentTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.program_course_enrollment = ProgramCourseEnrollmentFactory()
|
||||
self.pending_role_assignment = CourseAccessRoleAssignmentFactory(
|
||||
enrollment=self.program_course_enrollment,
|
||||
|
||||
@@ -127,7 +127,7 @@ class SocialAuthEnrollmentCompletionSignalTest(CacheIsolationTestCase):
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
super(SocialAuthEnrollmentCompletionSignalTest, self).setUp()
|
||||
super(SocialAuthEnrollmentCompletionSignalTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
RequestCache.clear_all_namespaces()
|
||||
catalog_org = CatalogOrganizationFactory.create(key=self.organization.short_name)
|
||||
self.program_uuid = self._create_catalog_program(catalog_org)['uuid']
|
||||
|
||||
@@ -13,7 +13,7 @@ class WhitelistedRssUrlTests(TestCase):
|
||||
""" Tests for the rss_proxy.WhitelistedRssUrl model """
|
||||
|
||||
def setUp(self):
|
||||
super(WhitelistedRssUrlTests, self).setUp()
|
||||
super(WhitelistedRssUrlTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.whitelisted_rss_url = WhitelistedRssUrl.objects.create(url='http://www.example.com')
|
||||
|
||||
def test_unicode(self):
|
||||
|
||||
@@ -14,7 +14,7 @@ class RssProxyViewTests(TestCase):
|
||||
""" Tests for the rss_proxy views """
|
||||
|
||||
def setUp(self):
|
||||
super(RssProxyViewTests, self).setUp()
|
||||
super(RssProxyViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.whitelisted_url1 = 'http://www.example.com'
|
||||
self.whitelisted_url2 = 'http://www.example.org'
|
||||
|
||||
Reference in New Issue
Block a user