pylint amnesty in cms apps
This commit is contained in:
@@ -80,7 +80,7 @@ admin.site.register(CourseCreator, CourseCreatorAdmin)
|
||||
|
||||
|
||||
@receiver(update_creator_state, sender=CourseCreator)
|
||||
def update_creator_group_callback(sender, **kwargs):
|
||||
def update_creator_group_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Callback for when the model's creator status has changed.
|
||||
"""
|
||||
@@ -90,7 +90,7 @@ def update_creator_group_callback(sender, **kwargs):
|
||||
|
||||
|
||||
@receiver(send_user_notification, sender=CourseCreator)
|
||||
def send_user_notification_callback(sender, **kwargs):
|
||||
def send_user_notification_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Callback for notifying user about course creator status change.
|
||||
"""
|
||||
@@ -113,12 +113,12 @@ def send_user_notification_callback(sender, **kwargs):
|
||||
|
||||
try:
|
||||
user.email_user(subject, message, studio_request_email)
|
||||
except:
|
||||
except: # lint-amnesty, pylint: disable=bare-except
|
||||
log.warning(u"Unable to send course creator status e-mail to %s", user.email)
|
||||
|
||||
|
||||
@receiver(send_admin_notification, sender=CourseCreator)
|
||||
def send_admin_notification_callback(sender, **kwargs):
|
||||
def send_admin_notification_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Callback for notifying admin of a user in the 'pending' state.
|
||||
"""
|
||||
|
||||
@@ -3,7 +3,7 @@ Table for storing information about whether or not Studio users have course crea
|
||||
"""
|
||||
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.db import models
|
||||
from django.db.models.signals import post_init, post_save
|
||||
from django.dispatch import Signal, receiver
|
||||
@@ -54,7 +54,7 @@ class CourseCreator(models.Model):
|
||||
|
||||
|
||||
@receiver(post_init, sender=CourseCreator)
|
||||
def post_init_callback(sender, **kwargs):
|
||||
def post_init_callback(sender, **kwargs): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Extend to store previous state.
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,7 @@ Tests course_creators.admin.py.
|
||||
|
||||
import mock
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
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.http import HttpRequest
|
||||
from django.test import TestCase
|
||||
@@ -29,7 +29,7 @@ class CourseCreatorAdminTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
""" Test case setup """
|
||||
super(CourseCreatorAdminTest, self).setUp()
|
||||
super(CourseCreatorAdminTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = User.objects.create_user('test_user', 'test_user+courses@edx.org', 'foo')
|
||||
self.table_entry = CourseCreator(user=self.user)
|
||||
self.table_entry.save()
|
||||
|
||||
@@ -4,7 +4,7 @@ Tests course_creators.views.py.
|
||||
|
||||
|
||||
import mock
|
||||
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 PermissionDenied
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
@@ -27,7 +27,7 @@ class CourseCreatorView(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
""" Test case setup """
|
||||
super(CourseCreatorView, self).setUp()
|
||||
super(CourseCreatorView, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = User.objects.create_user('test_user', 'test_user+courses@edx.org', 'foo')
|
||||
self.admin = User.objects.create_user('Mark', 'admin+courses@edx.org', 'foo')
|
||||
self.admin.is_staff = True
|
||||
|
||||
@@ -30,7 +30,7 @@ class TestMaintenanceIndex(ModuleStoreTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestMaintenanceIndex, self).setUp()
|
||||
super(TestMaintenanceIndex, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = AdminFactory()
|
||||
login_success = self.client.login(username=self.user.username, password='test')
|
||||
self.assertTrue(login_success)
|
||||
@@ -56,7 +56,7 @@ class MaintenanceViewTestCase(ModuleStoreTestCase):
|
||||
view_url = ''
|
||||
|
||||
def setUp(self):
|
||||
super(MaintenanceViewTestCase, self).setUp()
|
||||
super(MaintenanceViewTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = AdminFactory()
|
||||
login_success = self.client.login(username=self.user.username, password='test')
|
||||
self.assertTrue(login_success)
|
||||
@@ -73,7 +73,7 @@ class MaintenanceViewTestCase(ModuleStoreTestCase):
|
||||
Reverse the setup.
|
||||
"""
|
||||
self.client.logout()
|
||||
super(MaintenanceViewTestCase, self).tearDown()
|
||||
super(MaintenanceViewTestCase, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -131,7 +131,7 @@ class TestForcePublish(MaintenanceViewTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestForcePublish, self).setUp()
|
||||
super(TestForcePublish, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.view_url = reverse('maintenance:force_publish_course')
|
||||
|
||||
def setup_test_course(self):
|
||||
@@ -271,7 +271,7 @@ class TestAnnouncementsViews(MaintenanceViewTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestAnnouncementsViews, self).setUp()
|
||||
super(TestAnnouncementsViews, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.admin = AdminFactory.create(
|
||||
email='staff@edx.org',
|
||||
username='admin',
|
||||
|
||||
@@ -84,7 +84,7 @@ class MaintenanceBaseView(View):
|
||||
template = 'maintenance/container.html'
|
||||
|
||||
def __init__(self, view=None):
|
||||
super(MaintenanceBaseView, self).__init__()
|
||||
super(MaintenanceBaseView, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.context = {
|
||||
'view': view if view else '',
|
||||
'form_data': {},
|
||||
@@ -142,7 +142,7 @@ class ForcePublishCourseView(MaintenanceBaseView):
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super(ForcePublishCourseView, self).__init__(MAINTENANCE_VIEWS['force_publish_course'])
|
||||
super(ForcePublishCourseView, self).__init__(MAINTENANCE_VIEWS['force_publish_course']) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.context.update({
|
||||
'current_versions': [],
|
||||
'updated_versions': [],
|
||||
@@ -238,7 +238,7 @@ class AnnouncementBaseView(View):
|
||||
|
||||
@method_decorator(require_global_staff)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super(AnnouncementBaseView, self).dispatch(request, *args, **kwargs)
|
||||
return super(AnnouncementBaseView, self).dispatch(request, *args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
|
||||
class AnnouncementIndexView(ListView, MaintenanceBaseView):
|
||||
@@ -251,10 +251,10 @@ class AnnouncementIndexView(ListView, MaintenanceBaseView):
|
||||
paginate_by = 8
|
||||
|
||||
def __init__(self):
|
||||
super(AnnouncementIndexView, self).__init__(MAINTENANCE_VIEWS['announcement_index'])
|
||||
super(AnnouncementIndexView, self).__init__(MAINTENANCE_VIEWS['announcement_index']) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(AnnouncementIndexView, self).get_context_data(**kwargs)
|
||||
context = super(AnnouncementIndexView, self).get_context_data(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
context['view'] = MAINTENANCE_VIEWS['announcement_index']
|
||||
return context
|
||||
|
||||
@@ -274,7 +274,7 @@ class AnnouncementEditView(UpdateView, AnnouncementBaseView):
|
||||
template_name = '/maintenance/_announcement_edit.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(AnnouncementEditView, self).get_context_data(**kwargs)
|
||||
context = super(AnnouncementEditView, self).get_context_data(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
context['action_url'] = reverse('maintenance:announcement_edit', kwargs={'pk': context['announcement'].pk})
|
||||
return context
|
||||
|
||||
@@ -289,7 +289,7 @@ class AnnouncementCreateView(CreateView, AnnouncementBaseView):
|
||||
template_name = '/maintenance/_announcement_edit.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(AnnouncementCreateView, self).get_context_data(**kwargs)
|
||||
context = super(AnnouncementCreateView, self).get_context_data(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
context['action_url'] = reverse('maintenance:announcement_create')
|
||||
return context
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ class CourseGradingModel(object):
|
||||
|
||||
# 'minimum_grade_credit' cannot be set to None
|
||||
if minimum_grade_credit is not None:
|
||||
minimum_grade_credit = minimum_grade_credit
|
||||
minimum_grade_credit = minimum_grade_credit # lint-amnesty, pylint: disable=self-assigning-variable
|
||||
|
||||
descriptor.minimum_grade_credit = minimum_grade_credit
|
||||
modulestore().update_item(descriptor, user.id)
|
||||
@@ -276,7 +276,7 @@ class CourseGradingModel(object):
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def update_section_grader_type(descriptor, grader_type, user):
|
||||
def update_section_grader_type(descriptor, grader_type, user): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
if grader_type is not None and grader_type != u'notgraded':
|
||||
descriptor.format = grader_type
|
||||
descriptor.graded = True
|
||||
@@ -289,7 +289,7 @@ class CourseGradingModel(object):
|
||||
return {'graderType': grader_type}
|
||||
|
||||
@staticmethod
|
||||
def convert_set_grace_period(descriptor):
|
||||
def convert_set_grace_period(descriptor): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
# 5 hours 59 minutes 59 seconds => converted to iso format
|
||||
rawgrace = descriptor.graceperiod
|
||||
if rawgrace:
|
||||
@@ -316,7 +316,7 @@ class CourseGradingModel(object):
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def parse_grader(json_grader):
|
||||
def parse_grader(json_grader): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
# manual to clear out kruft
|
||||
result = {"type": json_grader["type"],
|
||||
"min_count": int(json_grader.get('min_count', 0)),
|
||||
@@ -328,7 +328,7 @@ class CourseGradingModel(object):
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def jsonize_grader(i, grader):
|
||||
def jsonize_grader(i, grader): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
# Warning: converting weight to integer might give unwanted results due
|
||||
# to the reason how floating point arithmetic works
|
||||
# e.g, "0.29 * 100 = 28.999999999999996"
|
||||
@@ -342,7 +342,7 @@ class CourseGradingModel(object):
|
||||
}
|
||||
|
||||
|
||||
def _grading_event_and_signal(course_key, user_id):
|
||||
def _grading_event_and_signal(course_key, user_id): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
name = GRADING_POLICY_CHANGED_EVENT_TYPE
|
||||
course = modulestore().get_course(course_key)
|
||||
grading_policy_hash = six.text_type(hash_grading_policy(course.grading_policy))
|
||||
@@ -362,7 +362,7 @@ def _grading_event_and_signal(course_key, user_id):
|
||||
)
|
||||
|
||||
|
||||
def hash_grading_policy(grading_policy):
|
||||
def hash_grading_policy(grading_policy): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
ordered_policy = json.dumps(
|
||||
grading_policy,
|
||||
separators=(',', ':'), # Remove spaces from separators for more compact representation
|
||||
|
||||
@@ -173,14 +173,14 @@ class CourseMetadata(object):
|
||||
if field.scope != Scope.settings:
|
||||
continue
|
||||
|
||||
field_help = _(field.help)
|
||||
field_help = _(field.help) # lint-amnesty, pylint: disable=translation-of-non-string
|
||||
help_args = field.runtime_options.get('help_format_args')
|
||||
if help_args is not None:
|
||||
field_help = field_help.format(**help_args)
|
||||
|
||||
result[field.name] = {
|
||||
'value': field.read_json(descriptor),
|
||||
'display_name': _(field.display_name),
|
||||
'display_name': _(field.display_name), # lint-amnesty, pylint: disable=translation-of-non-string
|
||||
'help': field_help,
|
||||
'deprecated': field.runtime_options.get('deprecated', False),
|
||||
'hide_on_enabled_publisher': field.runtime_options.get('hide_on_enabled_publisher', False)
|
||||
@@ -211,7 +211,7 @@ class CourseMetadata(object):
|
||||
if hasattr(descriptor, key) and getattr(descriptor, key) != val:
|
||||
key_values[key] = descriptor.fields[key].from_json(val)
|
||||
except (TypeError, ValueError) as err:
|
||||
raise ValueError(_(u"Incorrect format for field '{name}'. {detailed_message}").format(
|
||||
raise ValueError(_(u"Incorrect format for field '{name}'. {detailed_message}").format( # lint-amnesty, pylint: disable=raise-missing-from
|
||||
name=model['display_name'], detailed_message=text_type(err)))
|
||||
|
||||
return cls.update_from_dict(key_values, descriptor, user)
|
||||
|
||||
@@ -20,7 +20,7 @@ class CourseSettingsEncoder(json.JSONEncoder):
|
||||
Serialize CourseDetails, CourseGradingModel, datetime, and old
|
||||
Locations
|
||||
"""
|
||||
def default(self, obj): # pylint: disable=method-hidden
|
||||
def default(self, obj): # lint-amnesty, pylint: disable=arguments-differ, method-hidden
|
||||
if isinstance(obj, (CourseDetails, CourseGradingModel)):
|
||||
return obj.__dict__
|
||||
elif isinstance(obj, Location):
|
||||
|
||||
@@ -34,7 +34,7 @@ class TestLTIConsumerHideFieldsFlag(TestCase):
|
||||
These are set via Django admin settings.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(TestLTIConsumerHideFieldsFlag, self).setUp()
|
||||
super(TestLTIConsumerHideFieldsFlag, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_id = CourseLocator(org="edx", course="course", run="run")
|
||||
|
||||
@ddt.data(
|
||||
|
||||
Reference in New Issue
Block a user