Commit 6900bd27 by Sarina Canelake

Merge pull request #7013 from stvstnfrd/pylint/low

Fix Pylint violations (easy)
parents 84f9d03f 237f2c32
...@@ -331,7 +331,6 @@ def get_component_templates(courselike, library=False): ...@@ -331,7 +331,6 @@ def get_component_templates(courselike, library=False):
"Advanced component %s does not exist. It will not be added to the Studio new component menu.", "Advanced component %s does not exist. It will not be added to the Studio new component menu.",
category category
) )
pass
else: else:
log.error( log.error(
"Improper format for course advanced keys! %s", "Improper format for course advanced keys! %s",
......
...@@ -25,7 +25,7 @@ def xblock_resource(request, block_type, uri): # pylint: disable=unused-argumen ...@@ -25,7 +25,7 @@ def xblock_resource(request, block_type, uri): # pylint: disable=unused-argumen
except IOError: except IOError:
log.info('Failed to load xblock resource', exc_info=True) log.info('Failed to load xblock resource', exc_info=True)
raise Http404 raise Http404
except Exception: # pylint: disable-msg=broad-except except Exception: # pylint: disable=broad-except
log.error('Failed to load xblock resource', exc_info=True) log.error('Failed to load xblock resource', exc_info=True)
raise Http404 raise Http404
......
...@@ -1016,8 +1016,6 @@ class Schematic(InputTypeBase): ...@@ -1016,8 +1016,6 @@ class Schematic(InputTypeBase):
] ]
def _extra_context(self): def _extra_context(self):
"""
"""
context = { context = {
'setup_script': '{static_url}js/capa/schematicinput.js'.format( 'setup_script': '{static_url}js/capa/schematicinput.js'.format(
static_url=self.capa_system.STATIC_URL), static_url=self.capa_system.STATIC_URL),
...@@ -1410,8 +1408,6 @@ class EditAMoleculeInput(InputTypeBase): ...@@ -1410,8 +1408,6 @@ class EditAMoleculeInput(InputTypeBase):
Attribute('missing', None)] Attribute('missing', None)]
def _extra_context(self): def _extra_context(self):
"""
"""
context = { context = {
'applet_loader': '{static_url}js/capa/editamolecule.js'.format( 'applet_loader': '{static_url}js/capa/editamolecule.js'.format(
static_url=self.capa_system.STATIC_URL), static_url=self.capa_system.STATIC_URL),
...@@ -1446,8 +1442,6 @@ class DesignProtein2dInput(InputTypeBase): ...@@ -1446,8 +1442,6 @@ class DesignProtein2dInput(InputTypeBase):
] ]
def _extra_context(self): def _extra_context(self):
"""
"""
context = { context = {
'applet_loader': '{static_url}js/capa/design-protein-2d.js'.format( 'applet_loader': '{static_url}js/capa/design-protein-2d.js'.format(
static_url=self.capa_system.STATIC_URL), static_url=self.capa_system.STATIC_URL),
...@@ -1482,8 +1476,6 @@ class EditAGeneInput(InputTypeBase): ...@@ -1482,8 +1476,6 @@ class EditAGeneInput(InputTypeBase):
] ]
def _extra_context(self): def _extra_context(self):
"""
"""
context = { context = {
'applet_loader': '{static_url}js/capa/edit-a-gene.js'.format( 'applet_loader': '{static_url}js/capa/edit-a-gene.js'.format(
static_url=self.capa_system.STATIC_URL), static_url=self.capa_system.STATIC_URL),
......
...@@ -27,8 +27,7 @@ class CapaHtmlRenderTest(unittest.TestCase): ...@@ -27,8 +27,7 @@ class CapaHtmlRenderTest(unittest.TestCase):
# Render the HTML # Render the HTML
etree.XML(problem.get_html()) etree.XML(problem.get_html())
# expect that we made it here without blowing up # TODO: This test should inspect the rendered html and assert one or more things about it
self.assertTrue(True)
def test_include_html(self): def test_include_html(self):
# Create a test file to include # Create a test file to include
......
...@@ -23,6 +23,23 @@ import calc ...@@ -23,6 +23,23 @@ import calc
from capa.responsetypes import LoncapaProblemError, \ from capa.responsetypes import LoncapaProblemError, \
StudentInputError, ResponseError StudentInputError, ResponseError
from capa.correctmap import CorrectMap from capa.correctmap import CorrectMap
from capa.tests.response_xml_factory import (
AnnotationResponseXMLFactory,
ChoiceResponseXMLFactory,
CodeResponseXMLFactory,
ChoiceTextResponseXMLFactory,
CustomResponseXMLFactory,
FormulaResponseXMLFactory,
ImageResponseXMLFactory,
JavascriptResponseXMLFactory,
MultipleChoiceResponseXMLFactory,
NumericalResponseXMLFactory,
OptionResponseXMLFactory,
SchematicResponseXMLFactory,
StringResponseXMLFactory,
SymbolicResponseXMLFactory,
TrueFalseResponseXMLFactory,
)
from capa.util import convert_files_to_filenames from capa.util import convert_files_to_filenames
from capa.util import compare_with_tolerance from capa.util import compare_with_tolerance
from capa.xqueue_interface import dateformat from capa.xqueue_interface import dateformat
...@@ -77,7 +94,6 @@ class ResponseTest(unittest.TestCase): ...@@ -77,7 +94,6 @@ class ResponseTest(unittest.TestCase):
class MultiChoiceResponseTest(ResponseTest): class MultiChoiceResponseTest(ResponseTest):
from capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
xml_factory_class = MultipleChoiceResponseXMLFactory xml_factory_class = MultipleChoiceResponseXMLFactory
def test_multiple_choice_grade(self): def test_multiple_choice_grade(self):
...@@ -99,7 +115,6 @@ class MultiChoiceResponseTest(ResponseTest): ...@@ -99,7 +115,6 @@ class MultiChoiceResponseTest(ResponseTest):
class TrueFalseResponseTest(ResponseTest): class TrueFalseResponseTest(ResponseTest):
from capa.tests.response_xml_factory import TrueFalseResponseXMLFactory
xml_factory_class = TrueFalseResponseXMLFactory xml_factory_class = TrueFalseResponseXMLFactory
def test_true_false_grade(self): def test_true_false_grade(self):
...@@ -139,7 +154,6 @@ class TrueFalseResponseTest(ResponseTest): ...@@ -139,7 +154,6 @@ class TrueFalseResponseTest(ResponseTest):
class ImageResponseTest(ResponseTest): class ImageResponseTest(ResponseTest):
from capa.tests.response_xml_factory import ImageResponseXMLFactory
xml_factory_class = ImageResponseXMLFactory xml_factory_class = ImageResponseXMLFactory
def test_rectangle_grade(self): def test_rectangle_grade(self):
...@@ -203,7 +217,6 @@ class ImageResponseTest(ResponseTest): ...@@ -203,7 +217,6 @@ class ImageResponseTest(ResponseTest):
class SymbolicResponseTest(ResponseTest): class SymbolicResponseTest(ResponseTest):
from capa.tests.response_xml_factory import SymbolicResponseXMLFactory
xml_factory_class = SymbolicResponseXMLFactory xml_factory_class = SymbolicResponseXMLFactory
def test_grade_single_input_correct(self): def test_grade_single_input_correct(self):
...@@ -321,7 +334,6 @@ class SymbolicResponseTest(ResponseTest): ...@@ -321,7 +334,6 @@ class SymbolicResponseTest(ResponseTest):
class OptionResponseTest(ResponseTest): class OptionResponseTest(ResponseTest):
from capa.tests.response_xml_factory import OptionResponseXMLFactory
xml_factory_class = OptionResponseXMLFactory xml_factory_class = OptionResponseXMLFactory
def test_grade(self): def test_grade(self):
...@@ -372,7 +384,6 @@ class FormulaResponseTest(ResponseTest): ...@@ -372,7 +384,6 @@ class FormulaResponseTest(ResponseTest):
""" """
Test the FormulaResponse class Test the FormulaResponse class
""" """
from capa.tests.response_xml_factory import FormulaResponseXMLFactory
xml_factory_class = FormulaResponseXMLFactory xml_factory_class = FormulaResponseXMLFactory
def test_grade(self): def test_grade(self):
...@@ -521,7 +532,6 @@ class FormulaResponseTest(ResponseTest): ...@@ -521,7 +532,6 @@ class FormulaResponseTest(ResponseTest):
class StringResponseTest(ResponseTest): class StringResponseTest(ResponseTest):
from capa.tests.response_xml_factory import StringResponseXMLFactory
xml_factory_class = StringResponseXMLFactory xml_factory_class = StringResponseXMLFactory
def test_backward_compatibility_for_multiple_answers(self): def test_backward_compatibility_for_multiple_answers(self):
...@@ -871,7 +881,6 @@ class StringResponseTest(ResponseTest): ...@@ -871,7 +881,6 @@ class StringResponseTest(ResponseTest):
class CodeResponseTest(ResponseTest): class CodeResponseTest(ResponseTest):
from capa.tests.response_xml_factory import CodeResponseXMLFactory
xml_factory_class = CodeResponseXMLFactory xml_factory_class = CodeResponseXMLFactory
def setUp(self): def setUp(self):
...@@ -1063,7 +1072,6 @@ class CodeResponseTest(ResponseTest): ...@@ -1063,7 +1072,6 @@ class CodeResponseTest(ResponseTest):
class ChoiceResponseTest(ResponseTest): class ChoiceResponseTest(ResponseTest):
from capa.tests.response_xml_factory import ChoiceResponseXMLFactory
xml_factory_class = ChoiceResponseXMLFactory xml_factory_class = ChoiceResponseXMLFactory
def test_radio_group_grade(self): def test_radio_group_grade(self):
...@@ -1106,7 +1114,6 @@ class ChoiceResponseTest(ResponseTest): ...@@ -1106,7 +1114,6 @@ class ChoiceResponseTest(ResponseTest):
class JavascriptResponseTest(ResponseTest): class JavascriptResponseTest(ResponseTest):
from capa.tests.response_xml_factory import JavascriptResponseXMLFactory
xml_factory_class = JavascriptResponseXMLFactory xml_factory_class = JavascriptResponseXMLFactory
def test_grade(self): def test_grade(self):
...@@ -1147,7 +1154,6 @@ class JavascriptResponseTest(ResponseTest): ...@@ -1147,7 +1154,6 @@ class JavascriptResponseTest(ResponseTest):
class NumericalResponseTest(ResponseTest): class NumericalResponseTest(ResponseTest):
from capa.tests.response_xml_factory import NumericalResponseXMLFactory
xml_factory_class = NumericalResponseXMLFactory xml_factory_class = NumericalResponseXMLFactory
# We blend the line between integration (using evaluator) and exclusively # We blend the line between integration (using evaluator) and exclusively
...@@ -1372,7 +1378,6 @@ class NumericalResponseTest(ResponseTest): ...@@ -1372,7 +1378,6 @@ class NumericalResponseTest(ResponseTest):
class CustomResponseTest(ResponseTest): class CustomResponseTest(ResponseTest):
from capa.tests.response_xml_factory import CustomResponseXMLFactory
xml_factory_class = CustomResponseXMLFactory xml_factory_class = CustomResponseXMLFactory
def test_inline_code(self): def test_inline_code(self):
...@@ -1924,7 +1929,6 @@ class SchematicResponseTest(ResponseTest): ...@@ -1924,7 +1929,6 @@ class SchematicResponseTest(ResponseTest):
""" """
Class containing setup and tests for Schematic responsetype. Class containing setup and tests for Schematic responsetype.
""" """
from capa.tests.response_xml_factory import SchematicResponseXMLFactory
xml_factory_class = SchematicResponseXMLFactory xml_factory_class = SchematicResponseXMLFactory
def test_grade(self): def test_grade(self):
...@@ -1975,7 +1979,6 @@ class SchematicResponseTest(ResponseTest): ...@@ -1975,7 +1979,6 @@ class SchematicResponseTest(ResponseTest):
class AnnotationResponseTest(ResponseTest): class AnnotationResponseTest(ResponseTest):
from capa.tests.response_xml_factory import AnnotationResponseXMLFactory
xml_factory_class = AnnotationResponseXMLFactory xml_factory_class = AnnotationResponseXMLFactory
def test_grade(self): def test_grade(self):
...@@ -2017,7 +2020,6 @@ class ChoiceTextResponseTest(ResponseTest): ...@@ -2017,7 +2020,6 @@ class ChoiceTextResponseTest(ResponseTest):
Class containing setup and tests for ChoiceText responsetype. Class containing setup and tests for ChoiceText responsetype.
""" """
from response_xml_factory import ChoiceTextResponseXMLFactory
xml_factory_class = ChoiceTextResponseXMLFactory xml_factory_class = ChoiceTextResponseXMLFactory
# `TEST_INPUTS` is a dictionary mapping from # `TEST_INPUTS` is a dictionary mapping from
...@@ -2188,13 +2190,6 @@ class ChoiceTextResponseTest(ResponseTest): ...@@ -2188,13 +2190,6 @@ class ChoiceTextResponseTest(ResponseTest):
with self.assertRaises(Exception): with self.assertRaises(Exception):
self.build_problem(type="invalidtextgroup") self.build_problem(type="invalidtextgroup")
def test_valid_xml(self):
"""
Test that `build_problem` builds valid xml
"""
self.build_problem()
self.assertTrue(True)
def test_unchecked_input_not_validated(self): def test_unchecked_input_not_validated(self):
""" """
Test that a student can have a non numeric answer in an unselected Test that a student can have a non numeric answer in an unselected
......
...@@ -53,4 +53,4 @@ class HeartbeatFailure(Exception): ...@@ -53,4 +53,4 @@ class HeartbeatFailure(Exception):
In addition to a msg, provide the name of the service. In addition to a msg, provide the name of the service.
""" """
self.service = service self.service = service
return super(HeartbeatFailure, self).__init__(msg) super(HeartbeatFailure, self).__init__(msg)
...@@ -62,7 +62,7 @@ class TestMixedModuleStore(CourseComparisonTest): ...@@ -62,7 +62,7 @@ class TestMixedModuleStore(CourseComparisonTest):
ASSET_COLLECTION = 'assetstore' ASSET_COLLECTION = 'assetstore'
FS_ROOT = DATA_DIR FS_ROOT = DATA_DIR
DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor' DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor'
RENDER_TEMPLATE = lambda t_n, d, ctx = None, nsp = 'main': '' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': ''
MONGO_COURSEID = 'MITx/999/2013_Spring' MONGO_COURSEID = 'MITx/999/2013_Spring'
XML_COURSEID1 = 'edX/toy/2012_Fall' XML_COURSEID1 = 'edX/toy/2012_Fall'
......
...@@ -54,7 +54,7 @@ COLLECTION = 'modulestore' ...@@ -54,7 +54,7 @@ COLLECTION = 'modulestore'
ASSET_COLLECTION = 'assetstore' ASSET_COLLECTION = 'assetstore'
FS_ROOT = DATA_DIR # TODO (vshnayder): will need a real fs_root for testing load_item FS_ROOT = DATA_DIR # TODO (vshnayder): will need a real fs_root for testing load_item
DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor' DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor'
RENDER_TEMPLATE = lambda t_n, d, ctx = None, nsp = 'main': '' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': ''
class ReferenceTestXBlock(XBlock, XModuleMixin): class ReferenceTestXBlock(XBlock, XModuleMixin):
......
...@@ -28,7 +28,7 @@ class ModuleStoreNoSettings(unittest.TestCase): ...@@ -28,7 +28,7 @@ class ModuleStoreNoSettings(unittest.TestCase):
COLLECTION = 'modulestore' COLLECTION = 'modulestore'
FS_ROOT = DATA_DIR FS_ROOT = DATA_DIR
DEFAULT_CLASS = 'xmodule.modulestore.tests.test_xml_importer.StubXBlock' DEFAULT_CLASS = 'xmodule.modulestore.tests.test_xml_importer.StubXBlock'
RENDER_TEMPLATE = lambda t_n, d, ctx = None, nsp = 'main': '' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': ''
modulestore_options = { modulestore_options = {
'default_class': DEFAULT_CLASS, 'default_class': DEFAULT_CLASS,
......
...@@ -706,7 +706,7 @@ class XMLModuleStore(ModuleStoreReadBase): ...@@ -706,7 +706,7 @@ class XMLModuleStore(ModuleStoreReadBase):
""" """
return CourseLocator(org, course, run, deprecated=True) return CourseLocator(org, course, run, deprecated=True)
def get_courses(self, depth=0, **kwargs): def get_courses(self, **kwargs):
""" """
Returns a list of course descriptors. If there were errors on loading, Returns a list of course descriptors. If there were errors on loading,
some of these may be ErrorDescriptors instead. some of these may be ErrorDescriptors instead.
......
...@@ -117,13 +117,12 @@ class PeerGradingService(GradingService): ...@@ -117,13 +117,12 @@ class PeerGradingService(GradingService):
return result return result
"""
This is a mock peer grading service that can be used for unit tests
without making actual service calls to the grading controller
"""
class MockPeerGradingService(object): class MockPeerGradingService(object):
"""
This is a mock peer grading service that can be used for unit tests
without making actual service calls to the grading controller
"""
def get_next_submission(self, problem_location, grader_id): def get_next_submission(self, problem_location, grader_id):
return { return {
'success': True, 'success': True,
......
""" """
Implement CourseTab Implement CourseTab
""" """
# pylint: disable=incomplete-protocol
# Note: pylint complains that we do not implement __delitem__ and __len__, although we implement __setitem__
# and __getitem__. However, the former two do not apply to the CourseTab class so we do not implement them.
# The reason we implement the latter two is to enable callers to continue to use the CourseTab object with
# dict-type accessors.
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from xblock.fields import List from xblock.fields import List
...@@ -15,7 +9,7 @@ from xblock.fields import List ...@@ -15,7 +9,7 @@ from xblock.fields import List
_ = lambda text: text _ = lambda text: text
class CourseTab(object): # pylint: disable=incomplete-protocol class CourseTab(object):
""" """
The Course Tab class is a data abstraction for all tabs (i.e., course navigation links) within a course. The Course Tab class is a data abstraction for all tabs (i.e., course navigation links) within a course.
It is an abstract class - to be inherited by various tab types. It is an abstract class - to be inherited by various tab types.
......
...@@ -119,8 +119,8 @@ class TestErrorModuleConstruction(unittest.TestCase): ...@@ -119,8 +119,8 @@ class TestErrorModuleConstruction(unittest.TestCase):
""" """
Test that error module construction happens correctly Test that error module construction happens correctly
""" """
def setUp(self): def setUp(self):
# pylint: disable=abstract-class-instantiated
super(TestErrorModuleConstruction, self).setUp() super(TestErrorModuleConstruction, self).setUp()
field_data = Mock(spec=FieldData) field_data = Mock(spec=FieldData)
self.descriptor = BrokenDescriptor( self.descriptor = BrokenDescriptor(
......
...@@ -17,7 +17,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey ...@@ -17,7 +17,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class CourseEmailTemplateForm(forms.ModelForm): # pylint: disable=incomplete-protocol class CourseEmailTemplateForm(forms.ModelForm):
"""Form providing validation of CourseEmail templates.""" """Form providing validation of CourseEmail templates."""
name = forms.CharField(required=False) name = forms.CharField(required=False)
...@@ -73,7 +73,7 @@ class CourseEmailTemplateForm(forms.ModelForm): # pylint: disable=incomplete-pr ...@@ -73,7 +73,7 @@ class CourseEmailTemplateForm(forms.ModelForm): # pylint: disable=incomplete-pr
return name return name
class CourseAuthorizationAdminForm(forms.ModelForm): # pylint: disable=incomplete-protocol class CourseAuthorizationAdminForm(forms.ModelForm):
"""Input form for email enabling, allowing us to verify data.""" """Input form for email enabling, allowing us to verify data."""
class Meta: # pylint: disable=missing-docstring class Meta: # pylint: disable=missing-docstring
......
...@@ -92,7 +92,7 @@ BULK_EMAIL_FAILURE_ERRORS = ( ...@@ -92,7 +92,7 @@ BULK_EMAIL_FAILURE_ERRORS = (
) )
def _get_recipient_queryset(user_id, to_option, course_id, course_location): def _get_recipient_queryset(user_id, to_option, course_id):
""" """
Returns a query set of email recipients corresponding to the requested to_option category. Returns a query set of email recipients corresponding to the requested to_option category.
...@@ -230,7 +230,7 @@ def perform_delegate_email_batches(entry_id, course_id, task_input, action_name) ...@@ -230,7 +230,7 @@ def perform_delegate_email_batches(entry_id, course_id, task_input, action_name)
) )
return new_subtask return new_subtask
recipient_qset = _get_recipient_queryset(user_id, to_option, course_id, course.location) recipient_qset = _get_recipient_queryset(user_id, to_option, course_id)
recipient_fields = ['profile__name', 'email'] recipient_fields = ['profile__name', 'email']
log.info(u"Task %s: Preparing to queue subtasks for sending emails for course %s, email %s, to_option %s", log.info(u"Task %s: Preparing to queue subtasks for sending emails for course %s, email %s, to_option %s",
......
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
from datetime import datetime
from model_utils import Choices
from xmodule_django.models import CourseKeyField, NoneToEmptyManager
from util.milestones_helpers import fulfill_course_milestone
""" """
Certificates are created for a student and an offering of a course. Certificates are created for a student and an offering of a course.
...@@ -55,6 +45,16 @@ Eligibility: ...@@ -55,6 +45,16 @@ Eligibility:
unless he has allow_certificate set to False. unless he has allow_certificate set to False.
""" """
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
from datetime import datetime
from model_utils import Choices
from xmodule_django.models import CourseKeyField, NoneToEmptyManager
from util.milestones_helpers import fulfill_course_milestone
class CertificateStatuses(object): class CertificateStatuses(object):
deleted = 'deleted' deleted = 'deleted'
......
...@@ -31,7 +31,7 @@ def circuit_line(circuit): ...@@ -31,7 +31,7 @@ def circuit_line(circuit):
return xml.etree.ElementTree.tostring(circuit_line) return xml.etree.ElementTree.tostring(circuit_line)
def edit_circuit(request, circuit): def edit_circuit(_request, circuit):
try: try:
sc = ServerCircuit.objects.get(name=circuit) sc = ServerCircuit.objects.get(name=circuit)
except: except:
......
...@@ -96,7 +96,7 @@ def has_access(user, action, obj, course_key=None): ...@@ -96,7 +96,7 @@ def has_access(user, action, obj, course_key=None):
return _has_access_location(user, action, obj, course_key) return _has_access_location(user, action, obj, course_key)
if isinstance(obj, basestring): if isinstance(obj, basestring):
return _has_access_string(user, action, obj, course_key) return _has_access_string(user, action, obj)
# Passing an unknown object here is a coding error, so rather than # Passing an unknown object here is a coding error, so rather than
# returning a default, complain. # returning a default, complain.
...@@ -487,7 +487,7 @@ def _has_access_course_key(user, action, course_key): ...@@ -487,7 +487,7 @@ def _has_access_course_key(user, action, course_key):
return _dispatch(checkers, action, user, course_key) return _dispatch(checkers, action, user, course_key)
def _has_access_string(user, action, perm, course_key): def _has_access_string(user, action, perm):
""" """
Check if user has certain special access, specified as string. Valid strings: Check if user has certain special access, specified as string. Valid strings:
......
...@@ -45,7 +45,7 @@ def export(course, export_dir): ...@@ -45,7 +45,7 @@ def export(course, export_dir):
return False return False
def import_with_checks(course_dir, verbose=True): def import_with_checks(course_dir):
all_ok = True all_ok = True
print "Attempting to load '{0}'".format(course_dir) print "Attempting to load '{0}'".format(course_dir)
......
...@@ -13,7 +13,7 @@ class RedirectUnenrolledMiddleware(object): ...@@ -13,7 +13,7 @@ class RedirectUnenrolledMiddleware(object):
Catch UserNotEnrolled errors thrown by `get_course_with_access` and redirect Catch UserNotEnrolled errors thrown by `get_course_with_access` and redirect
users to the course about page users to the course about page
""" """
def process_exception(self, request, exception): def process_exception(self, _request, exception):
if isinstance(exception, UserNotEnrolled): if isinstance(exception, UserNotEnrolled):
course_key = exception.course_key course_key = exception.course_key
return redirect( return redirect(
......
...@@ -823,7 +823,7 @@ def xblock_resource(request, block_type, uri): # pylint: disable=unused-argumen ...@@ -823,7 +823,7 @@ def xblock_resource(request, block_type, uri): # pylint: disable=unused-argumen
except IOError: except IOError:
log.info('Failed to load xblock resource', exc_info=True) log.info('Failed to load xblock resource', exc_info=True)
raise Http404 raise Http404
except Exception: # pylint: disable-msg=broad-except except Exception: # pylint: disable=broad-except
log.error('Failed to load xblock resource', exc_info=True) log.error('Failed to load xblock resource', exc_info=True)
raise Http404 raise Http404
mimetype, _ = mimetypes.guess_type(uri) mimetype, _ = mimetypes.guess_type(uri)
......
...@@ -88,12 +88,12 @@ class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase): ...@@ -88,12 +88,12 @@ class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
def test__has_access_string(self): def test__has_access_string(self):
user = Mock(is_staff=True) user = Mock(is_staff=True)
self.assertFalse(access._has_access_string(user, 'staff', 'not_global', self.course.course_key)) self.assertFalse(access._has_access_string(user, 'staff', 'not_global'))
user._has_global_staff_access.return_value = True user._has_global_staff_access.return_value = True
self.assertTrue(access._has_access_string(user, 'staff', 'global', self.course.course_key)) self.assertTrue(access._has_access_string(user, 'staff', 'global'))
self.assertRaises(ValueError, access._has_access_string, user, 'not_staff', 'global', self.course.course_key) self.assertRaises(ValueError, access._has_access_string, user, 'not_staff', 'global')
def test__has_access_error_desc(self): def test__has_access_error_desc(self):
descriptor = Mock() descriptor = Mock()
......
...@@ -584,7 +584,7 @@ def jump_to_id(request, course_id, module_id): ...@@ -584,7 +584,7 @@ def jump_to_id(request, course_id, module_id):
@ensure_csrf_cookie @ensure_csrf_cookie
def jump_to(request, course_id, location): def jump_to(_request, course_id, location):
""" """
Show the page that contains a specific location. Show the page that contains a specific location.
......
...@@ -6,8 +6,6 @@ from xmodule.modulestore.mongoengine_fields import CourseKeyField ...@@ -6,8 +6,6 @@ from xmodule.modulestore.mongoengine_fields import CourseKeyField
class CourseImportLog(mongoengine.Document): class CourseImportLog(mongoengine.Document):
"""Mongoengine model for git log""" """Mongoengine model for git log"""
# pylint: disable=incomplete-protocol
course_id = CourseKeyField(max_length=128) course_id = CourseKeyField(max_length=128)
# NOTE: this location is not a Location object but a pathname # NOTE: this location is not a Location object but a pathname
location = mongoengine.StringField(max_length=168) location = mongoengine.StringField(max_length=168)
......
...@@ -18,7 +18,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey ...@@ -18,7 +18,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class RefundForm(forms.Form): # pylint: disable=incomplete-protocol class RefundForm(forms.Form):
""" """
Form for manual refunds Form for manual refunds
""" """
......
...@@ -165,7 +165,7 @@ class SubtaskStatus(object): ...@@ -165,7 +165,7 @@ class SubtaskStatus(object):
self.state = state if state is not None else QUEUING self.state = state if state is not None else QUEUING
@classmethod @classmethod
def from_dict(self, d): def from_dict(cls, d):
"""Construct a SubtaskStatus object from a dict representation.""" """Construct a SubtaskStatus object from a dict representation."""
options = dict(d) options = dict(d)
task_id = options['task_id'] task_id = options['task_id']
...@@ -173,9 +173,9 @@ class SubtaskStatus(object): ...@@ -173,9 +173,9 @@ class SubtaskStatus(object):
return SubtaskStatus.create(task_id, **options) return SubtaskStatus.create(task_id, **options)
@classmethod @classmethod
def create(self, task_id, **options): def create(cls, task_id, **options):
"""Construct a SubtaskStatus object.""" """Construct a SubtaskStatus object."""
return self(task_id, **options) return cls(task_id, **options)
def to_dict(self): def to_dict(self):
""" """
......
...@@ -24,8 +24,6 @@ class Command(BaseCommand): ...@@ -24,8 +24,6 @@ class Command(BaseCommand):
args = "course_id software_id count" args = "course_id software_id count"
def handle(self, *args, **options): def handle(self, *args, **options):
"""
"""
course_id, software_name, count = self._parse_arguments(args) course_id, software_name, count = self._parse_arguments(args)
software, _ = CourseSoftware.objects.get_or_create(course_id=course_id, software, _ = CourseSoftware.objects.get_or_create(course_id=course_id,
......
...@@ -24,8 +24,6 @@ class Command(BaseCommand): ...@@ -24,8 +24,6 @@ class Command(BaseCommand):
args = "course_id software_id serial_file" args = "course_id software_id serial_file"
def handle(self, *args, **options): def handle(self, *args, **options):
"""
"""
course_id, software_name, filename = self._parse_arguments(args) course_id, software_name, filename = self._parse_arguments(args)
software, _ = CourseSoftware.objects.get_or_create(course_id=course_id, software, _ = CourseSoftware.objects.get_or_create(course_id=course_id,
......
...@@ -148,7 +148,7 @@ def create(request, course_key): ...@@ -148,7 +148,7 @@ def create(request, course_key):
return ApiResponse(http_response=response, data=None) return ApiResponse(http_response=response, data=None)
def read(request, course_key, note_id): # pylint: disable=unused-argument (course_key) def read(request, _course_key, note_id):
''' '''
Returns a single annotation object. Returns a single annotation object.
''' '''
...@@ -163,7 +163,7 @@ def read(request, course_key, note_id): # pylint: disable=unused-argument (cour ...@@ -163,7 +163,7 @@ def read(request, course_key, note_id): # pylint: disable=unused-argument (cour
return ApiResponse(http_response=HttpResponse(), data=note.as_dict()) return ApiResponse(http_response=HttpResponse(), data=note.as_dict())
def update(request, course_key, note_id): # pylint: disable=unused-argument (course_key) def update(request, course_key, note_id): # pylint: disable=unused-argument
''' '''
Updates an annotation object and returns a 303 with the read location. Updates an annotation object and returns a 303 with the read location.
''' '''
...@@ -247,7 +247,7 @@ def search(request, course_key): ...@@ -247,7 +247,7 @@ def search(request, course_key):
return ApiResponse(http_response=HttpResponse(), data=result) return ApiResponse(http_response=HttpResponse(), data=result)
def root(request, course_key): # pylint: disable=unused-argument (course_key, request) def root(request, course_key): # pylint: disable=unused-argument
''' '''
Returns version information about the API. Returns version information about the API.
''' '''
......
...@@ -1930,7 +1930,7 @@ class Donation(OrderItem): ...@@ -1930,7 +1930,7 @@ class Donation(OrderItem):
).format(platform_name=settings.PLATFORM_NAME) ).format(platform_name=settings.PLATFORM_NAME)
@classmethod @classmethod
def _line_item_description(self, course_id=None): def _line_item_description(cls, course_id=None):
"""Create a line-item description for the donation. """Create a line-item description for the donation.
Includes the course display name if provided. Includes the course display name if provided.
......
...@@ -7,7 +7,7 @@ from django.contrib import admin ...@@ -7,7 +7,7 @@ from django.contrib import admin
from survey.models import SurveyForm from survey.models import SurveyForm
class SurveyFormAdminForm(forms.ModelForm): # pylint: disable=incomplete-protocol class SurveyFormAdminForm(forms.ModelForm):
"""Form providing validation of SurveyForm content.""" """Form providing validation of SurveyForm content."""
class Meta: # pylint: disable=missing-docstring class Meta: # pylint: disable=missing-docstring
......
...@@ -377,7 +377,7 @@ FEATURES['CLASS_DASHBOARD'] = True ...@@ -377,7 +377,7 @@ FEATURES['CLASS_DASHBOARD'] = True
# Generated checkid_setup request to http://testserver/openid/provider/login/ with assocication {HMAC-SHA1}{51d49995}{s/kRmA==} # Generated checkid_setup request to http://testserver/openid/provider/login/ with assocication {HMAC-SHA1}{51d49995}{s/kRmA==}
import openid.oidutil import openid.oidutil
openid.oidutil.log = lambda message, level = 0: None openid.oidutil.log = lambda message, level=0: None
PLATFORM_NAME = "edX" PLATFORM_NAME = "edX"
SITE_NAME = "edx.org" SITE_NAME = "edx.org"
......
...@@ -61,7 +61,7 @@ git clean -qxfd ...@@ -61,7 +61,7 @@ git clean -qxfd
source scripts/jenkins-common.sh source scripts/jenkins-common.sh
# Violations thresholds for failing the build # Violations thresholds for failing the build
PYLINT_THRESHOLD=6300 PYLINT_THRESHOLD=6100
PEP8_THRESHOLD=0 PEP8_THRESHOLD=0
# If the environment variable 'SHARD' is not set, default to 'all'. # If the environment variable 'SHARD' is not set, default to 'all'.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment