Applied pylint-amnesty to commerce

This commit is contained in:
Jawayria
2021-02-01 18:56:15 +05:00
parent a5f6f682ee
commit 4b4fc89693
17 changed files with 28 additions and 28 deletions

View File

@@ -69,7 +69,7 @@ class BasketsViewTests(EnrollmentEventTestMixin, UserMixin, ModuleStoreTestCase)
self.assertEqual(actual, expected_msg)
def setUp(self):
super(BasketsViewTests, self).setUp()
super(BasketsViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.url = reverse('commerce_api:v0:baskets:create')
self._login()
@@ -290,7 +290,7 @@ class BasketOrderViewTests(UserMixin, TestCase):
path = reverse_lazy(view_name, kwargs={'basket_id': 1})
def setUp(self):
super(BasketOrderViewTests, self).setUp()
super(BasketOrderViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self._login()
def test_order_found(self):

View File

@@ -88,7 +88,7 @@ class BasketsView(APIView):
u'Failed to handle marketing opt-in flag: user="%s", course="%s"', user.username, course_key
)
def post(self, request, *args, **kwargs):
def post(self, request, *args, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Attempt to enroll the user.
"""

View File

@@ -130,7 +130,7 @@ class Course(object):
course_id = CourseKey.from_string(six.text_type(course_id))
except InvalidKeyError:
log.debug(u'[%s] is not a valid course key.', course_id)
raise ValueError
raise ValueError # lint-amnesty, pylint: disable=raise-missing-from
course_modes = CourseMode.objects.filter(course_id=course_id)

View File

@@ -1,7 +1,7 @@
""" Custom API permissions. """
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from rest_framework.permissions import BasePermission, DjangoModelPermissions
from openedx.core.lib.api.permissions import ApiKeyHeaderPermission
@@ -22,7 +22,7 @@ class IsAuthenticatedOrActivationOverridden(BasePermission):
def has_permission(self, request, view):
if not request.user.is_authenticated and is_account_activation_requirement_disabled():
try:
request.user = User.objects.get(id=request.session._session_cache['_auth_user_id'])
request.user = User.objects.get(id=request.session._session_cache['_auth_user_id']) # lint-amnesty, pylint: disable=protected-access
except User.DoesNotExist:
pass
return request.user.is_authenticated

View File

@@ -47,7 +47,7 @@ def validate_course_id(course_id):
try:
course_key = CourseKey.from_string(six.text_type(course_id))
except InvalidKeyError:
raise serializers.ValidationError(
raise serializers.ValidationError( # lint-amnesty, pylint: disable=raise-missing-from
_(u"{course_id} is not a valid course key.").format(
course_id=course_id
)
@@ -69,7 +69,7 @@ class PossiblyUndefinedDateTimeField(serializers.DateTimeField):
def to_representation(self, value):
if value is UNDEFINED:
return None
return super(PossiblyUndefinedDateTimeField, self).to_representation(value)
return super(PossiblyUndefinedDateTimeField, self).to_representation(value) # lint-amnesty, pylint: disable=super-with-arguments
class CourseSerializer(serializers.Serializer):

View File

@@ -14,7 +14,7 @@ class CourseTests(TestCase):
""" Tests for Course model. """
def setUp(self):
super(CourseTests, self).setUp()
super(CourseTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course = Course('a/b/c', [])
@ddt.unpack

View File

@@ -35,7 +35,7 @@ class CourseApiViewTestMixin(object):
"""
def setUp(self):
super(CourseApiViewTestMixin, self).setUp()
super(CourseApiViewTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course = CourseFactory.create()
self.course_mode = CourseMode.objects.create(
course_id=self.course.id,
@@ -114,7 +114,7 @@ class CourseRetrieveUpdateViewTests(CourseApiViewTestMixin, ModuleStoreTestCase)
}
def setUp(self):
super(CourseRetrieveUpdateViewTests, self).setUp()
super(CourseRetrieveUpdateViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.path = reverse('commerce_api:v1:courses:retrieve_update', args=[six.text_type(self.course.id)])
self.user = UserFactory.create()
self.client.login(username=self.user.username, password=PASSWORD)
@@ -450,7 +450,7 @@ class OrderViewTests(UserMixin, TestCase):
path = reverse_lazy(view_name, kwargs={'number': ORDER_NUMBER})
def setUp(self):
super(OrderViewTests, self).setUp()
super(OrderViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self._login()
def test_order_found(self):

View File

@@ -5,7 +5,7 @@ Commerce views
import logging
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 Http404
from edx_rest_api_client import exceptions
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
@@ -53,7 +53,7 @@ class CourseRetrieveUpdateView(PutAsCreateMixin, RetrieveUpdateAPIView):
# rather than a CourseMode, so this isn't really used.
queryset = CourseMode.objects.all()
def get_object(self, queryset=None):
def get_object(self, queryset=None): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
course_id = self.kwargs.get(self.lookup_url_kwarg)
course = Course.get(course_id)
@@ -80,7 +80,7 @@ class OrderView(APIView):
# anonymous user object attached to the request with the actual user object (if it exists)
if not request.user.is_authenticated and is_account_activation_requirement_disabled():
try:
request.user = User.objects.get(id=request.session._session_cache['_auth_user_id'])
request.user = User.objects.get(id=request.session._session_cache['_auth_user_id']) # lint-amnesty, pylint: disable=protected-access
except User.DoesNotExist:
return JsonResponse(status=403)
try: