Apply pylint-amnesty.
This commit is contained in:
Awais Qureshi
2021-02-03 12:15:41 +05:00
parent 2eb4298c08
commit 42e7cac6dc
23 changed files with 74 additions and 73 deletions

View File

@@ -1,4 +1,4 @@
"""
""" # lint-amnesty, pylint: disable=django-not-configured
ace_common is a Django App that provides common utilities and templates
for edx-platform applications that use ACE as their messaging framework.
"""

View File

@@ -8,9 +8,9 @@ from edx_ace.message import MessageType
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
class BaseMessageType(MessageType):
class BaseMessageType(MessageType): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, *args, **kwargs):
super(BaseMessageType, self).__init__(*args, **kwargs)
super(BaseMessageType, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
from_address = configuration_helpers.get_value('email_from_address')
if from_address:
self.options.update({'from_address': from_address}) # pylint: disable=no-member

View File

@@ -1,4 +1,4 @@
def plugin_settings(settings):
def plugin_settings(settings): # lint-amnesty, pylint: disable=missing-function-docstring, missing-module-docstring
settings.ACE_ENABLED_CHANNELS = [
'django_email'
]

View File

@@ -67,7 +67,7 @@ class QueryStringAssertionMixin(object):
class EmailTemplateTagMixin(object):
def setUp(self):
super(EmailTemplateTagMixin, self).setUp()
super(EmailTemplateTagMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
patcher = patch('openedx.core.djangoapps.ace_common.templatetags.ace.get_current_request')
self.mock_get_current_request = patcher.start()

View File

@@ -11,7 +11,7 @@ from openedx.core.djangoapps.ace_common.message import BaseMessageType
@ddt.ddt
class TestAbsoluteUrl(TestCase):
class TestAbsoluteUrl(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
@ddt.data(
('test@example.com', True),

View File

@@ -20,7 +20,7 @@ class TestAbsoluteUrl(CacheIsolationTestCase):
def setUp(self):
self.site = SiteFactory.create()
self.site.domain = 'example.com'
super(TestAbsoluteUrl, self).setUp()
super(TestAbsoluteUrl, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
def test_absolute_url(self):
absolute = ensure_url_is_absolute(self.site, '/foo/bar')

View File

@@ -6,7 +6,7 @@ import json
from rest_framework.reverse import reverse
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.test import TestCase
from openedx.core.djangoapps.api_admin.tests import factories
@@ -21,7 +21,7 @@ class ApiAccessRequestViewTests(TestCase):
"""
password = 'test'
def setUp(self):
def setUp(self): # lint-amnesty, pylint: disable=super-method-not-called
"""
Perform operations common to all test cases.
"""

View File

@@ -2,7 +2,7 @@
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.utils.translation import ugettext as _
from openedx.core.djangoapps.api_admin.models import ApiAccessRequest, Catalog
@@ -34,7 +34,7 @@ class ApiAccessRequestForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
# Get rid of the colons at the end of the field labels.
kwargs.setdefault('label_suffix', '')
super(ApiAccessRequestForm, self).__init__(*args, **kwargs)
super(ApiAccessRequestForm, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
class ViewersWidget(forms.widgets.TextInput):
@@ -61,7 +61,7 @@ class ViewersField(forms.Field):
return [username.strip() for username in value.split(',')]
def validate(self, value):
super(ViewersField, self).validate(value)
super(ViewersField, self).validate(value) # lint-amnesty, pylint: disable=super-with-arguments
nonexistent_users = []
for username in value:
try:

View File

@@ -4,7 +4,7 @@
import logging
from contextlib import contextmanager
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand, CommandError
from django.db.models.signals import post_save, pre_save
@@ -106,7 +106,7 @@ class Command(BaseCommand):
try:
return User.objects.get(username=username)
except User.DoesNotExist:
raise CommandError('User {} not found'.format(username))
raise CommandError('User {} not found'.format(username)) # lint-amnesty, pylint: disable=raise-missing-from
def create_api_access_request(self, user, status, reason, website):
"""
@@ -127,14 +127,14 @@ class Command(BaseCommand):
if 'Permission denied' in error_msg and 'mako_lms' in error_msg:
logger.warning('Error sending email about access request: {}'.format(error_msg))
else:
raise CommandError(error_msg)
raise CommandError(error_msg) # lint-amnesty, pylint: disable=raise-missing-from
except Exception as e:
msg = 'Unable to create ApiAccessRequest for {}. Exception is {}: {}'.format(
user.username,
type(e).__name__,
e
)
raise CommandError(msg)
raise CommandError(msg) # lint-amnesty, pylint: disable=raise-missing-from
logger.info('Created ApiAccessRequest for user {}'.format(user.username))
@@ -146,7 +146,7 @@ class Command(BaseCommand):
_, created = ApiAccessConfig.objects.get_or_create(enabled=True)
except Exception as e:
msg = 'Unable to create ApiAccessConfig. Exception is {}: {}'.format(type(e).__name__, e)
raise CommandError(msg)
raise CommandError(msg) # lint-amnesty, pylint: disable=raise-missing-from
if created:
logger.info('Created ApiAccessConfig')

View File

@@ -6,7 +6,7 @@ from smtplib import SMTPException
from config_models.models import ConfigurationModel
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.contrib.sites.models import Site
from django.core.mail import send_mail
from django.db import models
@@ -252,9 +252,9 @@ class Catalog(models.Model):
self.query = attributes['query']
self.viewers = attributes['viewers']
else:
super(Catalog, self).__init__(*args, **kwargs)
super(Catalog, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
def save(self, **kwargs): # pylint: disable=unused-argument
def save(self, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
return None
@property

View File

@@ -37,7 +37,7 @@ class ViewersWidgetTest(TestCase):
extra_formating = ''
if django.VERSION < (2, 1):
extra_formating = ' /'
expected_widget_html = '<input type="text" name="{input_field_name}" value="{serialized_value}"{extra_formating}>'.format(
expected_widget_html = '<input type="text" name="{input_field_name}" value="{serialized_value}"{extra_formating}>'.format( # lint-amnesty, pylint: disable=line-too-long
input_field_name=input_field_name,
serialized_value=dummy_string_value,
extra_formating=extra_formating,

View File

@@ -22,7 +22,7 @@ from common.djangoapps.student.tests.factories import UserFactory
class ApiAccessRequestTests(TestCase):
def setUp(self):
super(ApiAccessRequestTests, self).setUp()
super(ApiAccessRequestTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = UserFactory()
self.request = ApiAccessRequestFactory(user=self.user)
@@ -97,7 +97,7 @@ class ApiAccessConfigTests(TestCase):
@skip_unless_lms
class ApiAccessRequestSignalTests(TestCase):
def setUp(self):
super(ApiAccessRequestSignalTests, self).setUp()
super(ApiAccessRequestSignalTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = UserFactory()
self.api_access_request = ApiAccessRequest(user=self.user, site=SiteFactory())
self.send_new_pending_email_function = 'openedx.core.djangoapps.api_admin.models._send_new_pending_email'

View File

@@ -29,7 +29,7 @@ class ApiAdminTest(TestCase):
Base class to allow API admin access to tests.
"""
def setUp(self):
super(ApiAdminTest, self).setUp()
super(ApiAdminTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
ApiAccessConfig(enabled=True).save()
@@ -39,7 +39,7 @@ class ApiRequestViewTest(ApiAdminTest):
Test the API Request View.
"""
def setUp(self):
super(ApiRequestViewTest, self).setUp()
super(ApiRequestViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.url = reverse('api_admin:api-request')
password = 'abc123'
self.user = UserFactory(password=password)
@@ -110,7 +110,7 @@ class ApiRequestStatusViewTest(ApiAdminTest):
Tests of the API Status endpoint.
"""
def setUp(self):
super(ApiRequestStatusViewTest, self).setUp()
super(ApiRequestStatusViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
password = 'abc123'
self.user = UserFactory(password=password)
self.client.login(username=self.user.username, password=password)
@@ -226,7 +226,7 @@ class CatalogTest(ApiAdminTest):
Test the catalog API.
"""
def setUp(self):
super(CatalogTest, self).setUp()
super(CatalogTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
password = 'abc123'
self.user = UserFactory(password=password, is_staff=True)
self.client.login(username=self.user.username, password=password)
@@ -254,7 +254,7 @@ class CatalogSearchViewTest(CatalogTest):
Test the catalog search endpoint.
"""
def setUp(self):
super(CatalogSearchViewTest, self).setUp()
super(CatalogSearchViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.url = reverse('api_admin:catalog-search')
def test_get(self):
@@ -279,7 +279,7 @@ class CatalogListViewTest(CatalogTest):
Test the catalog list endpoint.
"""
def setUp(self):
super(CatalogListViewTest, self).setUp()
super(CatalogListViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.catalog_user = UserFactory()
self.url = reverse('api_admin:catalog-list', kwargs={'username': self.catalog_user.username})
@@ -331,7 +331,7 @@ class CatalogEditViewTest(CatalogTest):
Test edits to the catalog endpoint.
"""
def setUp(self):
super(CatalogEditViewTest, self).setUp()
super(CatalogEditViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.catalog_user = UserFactory()
self.catalog = CatalogFactory(viewers=[self.catalog_user.username])
self.url = reverse('api_admin:catalog-edit', kwargs={'catalog_id': self.catalog.id})
@@ -353,7 +353,7 @@ class CatalogEditViewTest(CatalogTest):
self.assertRedirects(response, reverse('api_admin:catalog-search'))
self.assertEqual(httpretty.last_request().method, 'DELETE')
self.assertEqual(
httpretty.last_request().path,
httpretty.last_request().path, # lint-amnesty, pylint: disable=no-member
'/api/v1/catalogs/{}/'.format(self.catalog.id)
)
self.assertEqual(len(httpretty.httpretty.latest_requests), 1)
@@ -382,7 +382,7 @@ class CatalogPreviewViewTest(CatalogTest):
Test the catalog preview endpoint.
"""
def setUp(self):
super(CatalogPreviewViewTest, self).setUp()
super(CatalogPreviewViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.url = reverse('api_admin:catalog-preview')
@httpretty.activate

View File

@@ -33,19 +33,19 @@ class ApiRequestView(CreateView):
template_name = 'api_admin/api_access_request_form.html'
success_url = reverse_lazy('api_admin:api-status')
def get(self, request):
def get(self, request): # lint-amnesty, pylint: disable=arguments-differ
"""
If the requesting user has already requested API access, redirect
them to the client creation page.
"""
if ApiAccessRequest.api_access_status(request.user) is not None:
return redirect(reverse('api_admin:api-status'))
return super(ApiRequestView, self).get(request)
return super(ApiRequestView, self).get(request) # lint-amnesty, pylint: disable=super-with-arguments
def form_valid(self, form):
form.instance.user = self.request.user
form.instance.site = get_current_site(self.request)
return super(ApiRequestView, self).form_valid(form)
return super(ApiRequestView, self).form_valid(form) # lint-amnesty, pylint: disable=super-with-arguments
class ApiRequestStatusView(ApplicationRegistration):
@@ -87,7 +87,7 @@ class ApiRequestStatusView(ApplicationRegistration):
})
def get_form(self, form_class=None):
form = super(ApiRequestStatusView, self).get_form(form_class)
form = super(ApiRequestStatusView, self).get_form(form_class) # lint-amnesty, pylint: disable=super-with-arguments
# Copy the data, since it's an immutable QueryDict.
copied_data = form.data.copy()
# Now set the fields that were removed earlier. We give them
@@ -105,14 +105,14 @@ class ApiRequestStatusView(ApplicationRegistration):
def form_valid(self, form):
# Delete any existing applications if the user has decided to regenerate their credentials
Application.objects.filter(user=self.request.user).delete()
return super(ApiRequestStatusView, self).form_valid(form)
return super(ApiRequestStatusView, self).form_valid(form) # lint-amnesty, pylint: disable=super-with-arguments
def form_invalid(self, form):
return self.get(self.request, form)
@require_api_access
def post(self, request):
return super(ApiRequestStatusView, self).post(request)
def post(self, request): # lint-amnesty, pylint: disable=arguments-differ
return super(ApiRequestStatusView, self).post(request) # lint-amnesty, pylint: disable=super-with-arguments
class ApiTosView(TemplateView):

View File

@@ -3,7 +3,7 @@ Forms to support third-party to first-party OAuth 2.0 access token exchange
"""
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.forms import CharField
from django.conf import settings
from django.utils.encoding import smart_text
@@ -86,7 +86,7 @@ class AccessTokenExchangeForm(forms.Form):
client_id = CharField(required=False)
def __init__(self, request, oauth2_adapter, *args, **kwargs):
super(AccessTokenExchangeForm, self).__init__(*args, **kwargs)
super(AccessTokenExchangeForm, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.request = request
self.oauth2_adapter = oauth2_adapter
@@ -96,7 +96,7 @@ class AccessTokenExchangeForm(forms.Form):
instead of validating each field.
"""
try:
super(AccessTokenExchangeForm, self)._clean_fields()
super(AccessTokenExchangeForm, self)._clean_fields() # lint-amnesty, pylint: disable=super-with-arguments
except OAuthValidationError as e:
self._errors.update(e.args[0])
@@ -105,7 +105,7 @@ class AccessTokenExchangeForm(forms.Form):
Overriding the default cleaning behaviour for a shallow error dict.
"""
try:
super(AccessTokenExchangeForm, self)._clean_form()
super(AccessTokenExchangeForm, self)._clean_form() # lint-amnesty, pylint: disable=super-with-arguments
except OAuthValidationError as e:
self._errors.update(e.args[0])
@@ -164,7 +164,7 @@ class AccessTokenExchangeForm(forms.Form):
try:
client = self.oauth2_adapter.get_client(client_id=client_id)
except Application.DoesNotExist:
raise OAuthValidationError(
raise OAuthValidationError( # lint-amnesty, pylint: disable=raise-missing-from
{
"error": "invalid_client",
"error_description": u"{} is not a valid client_id".format(client_id),

View File

@@ -65,4 +65,4 @@ class DOTAdapterMixin(object):
@expectedFailure
def test_single_access_token(self):
# TODO: Single access tokens not supported yet for DOT (See MA-2122)
super(DOTAdapterMixin, self).test_single_access_token()
super(DOTAdapterMixin, self).test_single_access_token() # lint-amnesty, pylint: disable=super-with-arguments

View File

@@ -13,7 +13,7 @@ from django.test import TestCase
from django.test.client import RequestFactory
from social_django.models import Partial
from common.djangoapps.third_party_auth.tests.utils import ThirdPartyOAuthTestMixinFacebook, ThirdPartyOAuthTestMixinGoogle
from common.djangoapps.third_party_auth.tests.utils import ThirdPartyOAuthTestMixinFacebook, ThirdPartyOAuthTestMixinGoogle # lint-amnesty, pylint: disable=line-too-long
from ..forms import AccessTokenExchangeForm
from .mixins import DOTAdapterMixin
@@ -25,7 +25,7 @@ class AccessTokenExchangeFormTest(AccessTokenExchangeTestMixin):
Mixin that defines test cases for AccessTokenExchangeForm
"""
def setUp(self):
super(AccessTokenExchangeFormTest, self).setUp()
super(AccessTokenExchangeFormTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.request = RequestFactory().post("dummy_url")
redirect_uri = 'dummy_redirect_url'
SessionMiddleware().process_request(self.request)
@@ -34,10 +34,10 @@ class AccessTokenExchangeFormTest(AccessTokenExchangeTestMixin):
self.request.backend = social_utils.load_backend(self.request.social_strategy, self.BACKEND, redirect_uri)
def tearDown(self):
super(AccessTokenExchangeFormTest, self).tearDown()
super(AccessTokenExchangeFormTest, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
Partial.objects.all().delete()
def _assert_error(self, data, expected_error, expected_error_description):
def _assert_error(self, data, expected_error, expected_error_description): # lint-amnesty, pylint: disable=arguments-differ
form = AccessTokenExchangeForm(request=self.request, oauth2_adapter=self.oauth2_adapter, data=data)
self.assertEqual(
form.errors,
@@ -65,7 +65,7 @@ class DOTAccessTokenExchangeFormTestFacebook(
Tests for AccessTokenExchangeForm used with Facebook, tested against
django-oauth-toolkit (DOT).
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
# This is necessary because cms does not implement third party auth
@@ -81,4 +81,4 @@ class DOTAccessTokenExchangeFormTestGoogle(
Tests for AccessTokenExchangeForm used with Google, tested against
django-oauth-toolkit (DOT).
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass

View File

@@ -22,7 +22,7 @@ from social_django.models import Partial
from openedx.core.djangoapps.oauth_dispatch.tests import factories as dot_factories
from common.djangoapps.student.tests.factories import UserFactory
from common.djangoapps.third_party_auth.tests.utils import ThirdPartyOAuthTestMixinFacebook, ThirdPartyOAuthTestMixinGoogle
from common.djangoapps.third_party_auth.tests.utils import ThirdPartyOAuthTestMixinFacebook, ThirdPartyOAuthTestMixinGoogle # lint-amnesty, pylint: disable=line-too-long
from .mixins import DOTAdapterMixin
from .utils import TPA_FEATURE_ENABLED, TPA_FEATURES_KEY, AccessTokenExchangeTestMixin
@@ -34,12 +34,12 @@ class AccessTokenExchangeViewTest(AccessTokenExchangeTestMixin):
Mixin that defines test cases for AccessTokenExchangeView
"""
def setUp(self):
super(AccessTokenExchangeViewTest, self).setUp()
super(AccessTokenExchangeViewTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.url = reverse("exchange_access_token", kwargs={"backend": self.BACKEND})
self.csrf_client = APIClient(enforce_csrf_checks=True)
def tearDown(self):
super(AccessTokenExchangeViewTest, self).tearDown()
super(AccessTokenExchangeViewTest, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
Partial.objects.all().delete()
def _assert_error(self, data, expected_error, expected_error_description, error_code=None):
@@ -120,7 +120,7 @@ class AccessTokenExchangeViewTest(AccessTokenExchangeTestMixin):
Remove when dop has been removed from third party auth
(currently underlying code used dop adapter, which is no longer supported by auth_exchange)
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
@pytest.mark.skip(reason="this is very entangled with dop use in third_party_auth")
def test_missing_fields(self):
@@ -128,7 +128,7 @@ class AccessTokenExchangeViewTest(AccessTokenExchangeTestMixin):
Remove when dop has been removed from third party auth
(currently underlying code used dop adapter, which is no longer supported by auth_exchange)
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def test_disabled_user(self):
"""
@@ -151,7 +151,7 @@ class DOTAccessTokenExchangeViewTestFacebook(
"""
Rerun AccessTokenExchangeViewTestFacebook tests against DOT backend
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
# This is necessary because cms does not implement third party auth
@@ -167,7 +167,7 @@ class DOTAccessTokenExchangeViewTestGoogle(
Tests for AccessTokenExchangeView used with Google using
django-oauth-toolkit backend.
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
@unittest.skipUnless(settings.FEATURES.get("ENABLE_OAUTH2_PROVIDER"), "OAuth2 not enabled")
@@ -176,7 +176,7 @@ class TestLoginWithAccessTokenView(TestCase):
Tests for LoginWithAccessTokenView
"""
def setUp(self):
super(TestLoginWithAccessTokenView, self).setUp()
super(TestLoginWithAccessTokenView, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user = UserFactory()
self.oauth2_client = Application.objects.create(client_type=Application.CLIENT_CONFIDENTIAL)

View File

@@ -20,7 +20,7 @@ class AccessTokenExchangeTestMixin(ThirdPartyOAuthTestMixin):
* _assert_success(data, expected_scopes)
"""
def setUp(self):
super(AccessTokenExchangeTestMixin, self).setUp()
super(AccessTokenExchangeTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# Initialize to minimal data
self.data = {
@@ -61,11 +61,11 @@ class AccessTokenExchangeTestMixin(ThirdPartyOAuthTestMixin):
for field in ["access_token", "client_id"]:
data = dict(self.data)
del data[field]
self._assert_error(data, "invalid_request", u"{} is required".format(field))
self._assert_error(data, "invalid_request", u"{} is required".format(field)) # lint-amnesty, pylint: disable=no-value-for-parameter
def test_invalid_client(self):
self.data["client_id"] = "nonexistent_client"
self._assert_error(
self._assert_error( # lint-amnesty, pylint: disable=no-value-for-parameter
self.data,
"invalid_client",
"nonexistent_client is not a valid client_id"
@@ -74,7 +74,7 @@ class AccessTokenExchangeTestMixin(ThirdPartyOAuthTestMixin):
def test_confidential_client(self):
self.data['client_id'] += '_confidential'
self.oauth_client = self.create_confidential_client(self.user, self.data['client_id'])
self._assert_error(
self._assert_error( # lint-amnesty, pylint: disable=no-value-for-parameter
self.data,
"invalid_client",
"{}_confidential is not a public client".format(self.client_id),
@@ -88,13 +88,13 @@ class AccessTokenExchangeTestMixin(ThirdPartyOAuthTestMixin):
def test_invalid_acess_token(self):
self._setup_provider_response(success=False)
self._assert_error(self.data, "invalid_grant", "access_token is not valid")
self._assert_error(self.data, "invalid_grant", "access_token is not valid") # lint-amnesty, pylint: disable=no-value-for-parameter
def test_no_linked_user(self):
UserSocialAuth.objects.all().delete()
Partial.objects.all().delete()
self._setup_provider_response(success=True)
self._assert_error(self.data, "invalid_grant", "access_token is not valid")
self._assert_error(self.data, "invalid_grant", "access_token is not valid") # lint-amnesty, pylint: disable=no-value-for-parameter
def test_user_automatically_linked_by_email(self):
UserSocialAuth.objects.all().delete()
@@ -108,4 +108,4 @@ class AccessTokenExchangeTestMixin(ThirdPartyOAuthTestMixin):
self._setup_provider_response(success=True, email=self.user.email)
self.user.is_active = False
self.user.save()
self._assert_error(self.data, "invalid_grant", "access_token is not valid")
self._assert_error(self.data, "invalid_grant", "access_token is not valid") # lint-amnesty, pylint: disable=no-value-for-parameter

View File

@@ -38,19 +38,19 @@ class AccessTokenExchangeBase(APIView):
@method_decorator(csrf_exempt)
@method_decorator(social_utils.psa("social:complete"))
def dispatch(self, *args, **kwargs): # pylint: disable=arguments-differ
return super(AccessTokenExchangeBase, self).dispatch(*args, **kwargs)
return super(AccessTokenExchangeBase, self).dispatch(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
def get(self, request, _backend):
"""
Pass through GET requests without the _backend
"""
return super(AccessTokenExchangeBase, self).get(request)
return super(AccessTokenExchangeBase, self).get(request) # lint-amnesty, pylint: disable=no-member, super-with-arguments
def post(self, request, _backend):
"""
Handle POST requests to get a first-party access token.
"""
form = AccessTokenExchangeForm(request=request, oauth2_adapter=self.oauth2_adapter, data=request.POST)
form = AccessTokenExchangeForm(request=request, oauth2_adapter=self.oauth2_adapter, data=request.POST) # lint-amnesty, pylint: disable=no-member
if not form.is_valid():
error_response = self.error_response(form.errors) # pylint: disable=no-member
if error_response.status_code == 403:
@@ -74,7 +74,7 @@ class AccessTokenExchangeBase(APIView):
"""
edx_access_token = self.create_access_token(request, user, scope, client)
return self.access_token_response(edx_access_token)
return self.access_token_response(edx_access_token) # lint-amnesty, pylint: disable=no-member
class DOTAccessTokenExchangeView(AccessTokenExchangeBase, DOTAccessTokenView):

View File

@@ -1,4 +1,5 @@
"""
""" # lint-amnesty, pylint: disable=django-not-configured
# lint-amnesty, pylint: disable=django-not-configured # lint-amnesty, pylint: disable=django-not-configured
Bookmarks module.
"""

View File

@@ -19,7 +19,7 @@ class BookmarksLimitReachedError(Exception):
"""
if try to create new bookmark when max limit of bookmarks already reached
"""
pass
pass # lint-amnesty, pylint: disable=unnecessary-pass
def get_bookmark(user, usage_key, fields=None):

View File

@@ -35,4 +35,4 @@ class BookmarksConfig(AppConfig):
def ready(self):
# Register the signals handled by bookmarks.
from . import signals
from . import signals # lint-amnesty, pylint: disable=unused-import