"
+ self.the_input.queue_msg = (u"
" # lint-amnesty, pylint: disable=line-too-long
u"\nans =\n\n\u0002\n\n
")
context = self.the_input._get_render_context() # pylint: disable=protected-access
@@ -1003,7 +1003,7 @@ class ImageInputTest(unittest.TestCase):
"""
Check that image inputs work
"""
- def check(self, value, egx, egy):
+ def check(self, value, egx, egy): # lint-amnesty, pylint: disable=missing-function-docstring
height = '78'
width = '427'
src = 'http://www.edx.org/cowclicker.jpg'
@@ -1151,7 +1151,7 @@ class ChemicalEquationTest(unittest.TestCase):
Check that chemical equation inputs work.
"""
def setUp(self):
- super(ChemicalEquationTest, self).setUp()
+ super(ChemicalEquationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.size = "42"
xml_str = """
""".format(size=self.size)
@@ -1246,7 +1246,7 @@ class FormulaEquationTest(unittest.TestCase):
Check that formula equation inputs work.
"""
def setUp(self):
- super(FormulaEquationTest, self).setUp()
+ super(FormulaEquationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.size = "42"
xml_str = """
""".format(size=self.size)
@@ -1427,12 +1427,12 @@ class DragAndDropTest(unittest.TestCase):
"base_image": "/dummy-static/images/about_1.png",
"draggables": [
{"can_reuse": "", "label": "Label 1", "id": "1", "icon": "", "target_fields": []},
- {"can_reuse": "", "label": "cc", "id": "name_with_icon", "icon": "/dummy-static/images/cc.jpg", "target_fields": []},
- {"can_reuse": "", "label": "arrow-left", "id": "with_icon", "icon": "/dummy-static/images/arrow-left.png", "target_fields": []},
+ {"can_reuse": "", "label": "cc", "id": "name_with_icon", "icon": "/dummy-static/images/cc.jpg", "target_fields": []}, # lint-amnesty, pylint: disable=line-too-long
+ {"can_reuse": "", "label": "arrow-left", "id": "with_icon", "icon": "/dummy-static/images/arrow-left.png", "target_fields": []}, # lint-amnesty, pylint: disable=line-too-long
{"can_reuse": "", "label": "Label2", "id": "5", "icon": "", "target_fields": []},
- {"can_reuse": "", "label": "Mute", "id": "2", "icon": "/dummy-static/images/mute.png", "target_fields": []},
- {"can_reuse": "", "label": "spinner", "id": "name_label_icon3", "icon": "/dummy-static/images/spinner.gif", "target_fields": []},
- {"can_reuse": "", "label": "Star", "id": "name4", "icon": "/dummy-static/images/volume.png", "target_fields": []},
+ {"can_reuse": "", "label": "Mute", "id": "2", "icon": "/dummy-static/images/mute.png", "target_fields": []}, # lint-amnesty, pylint: disable=line-too-long
+ {"can_reuse": "", "label": "spinner", "id": "name_label_icon3", "icon": "/dummy-static/images/spinner.gif", "target_fields": []}, # lint-amnesty, pylint: disable=line-too-long
+ {"can_reuse": "", "label": "Star", "id": "name4", "icon": "/dummy-static/images/volume.png", "target_fields": []}, # lint-amnesty, pylint: disable=line-too-long
{"can_reuse": "", "label": "Label3", "id": "7", "icon": "", "target_fields": []}],
"one_per_target": "True",
"targets": [
diff --git a/common/lib/capa/capa/tests/test_responsetypes.py b/common/lib/capa/capa/tests/test_responsetypes.py
index 1549dd277c..c4bd0cd6db 100644
--- a/common/lib/capa/capa/tests/test_responsetypes.py
+++ b/common/lib/capa/capa/tests/test_responsetypes.py
@@ -53,9 +53,9 @@ class ResponseTest(unittest.TestCase):
maxDiff = None
def setUp(self):
- super(ResponseTest, self).setUp()
+ super(ResponseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
if self.xml_factory_class:
- self.xml_factory = self.xml_factory_class()
+ self.xml_factory = self.xml_factory_class() # lint-amnesty, pylint: disable=not-callable
def build_problem(self, capa_system=None, **kwargs):
xml = self.xml_factory.build_xml(**kwargs)
@@ -944,7 +944,7 @@ class CodeResponseTest(ResponseTest): # pylint: disable=missing-class-docstring
xml_factory_class = CodeResponseXMLFactory
def setUp(self):
- super(CodeResponseTest, self).setUp()
+ super(CodeResponseTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
grader_payload = json.dumps({"grader": "ps04/grade_square.py"})
self.problem = self.build_problem(initial_display="def square(x):",
@@ -1012,7 +1012,7 @@ class CodeResponseTest(ResponseTest): # pylint: disable=missing-class-docstring
self.assertEqual(self.problem.correct_map.get_dict(), old_cmap.get_dict()) # Deep comparison
for answer_id in answer_ids:
- self.assertTrue(self.problem.correct_map.is_queued(answer_id)) # Should be still queued, since message undelivered
+ self.assertTrue(self.problem.correct_map.is_queued(answer_id)) # Should be still queued, since message undelivered # lint-amnesty, pylint: disable=line-too-long
# Correct queuekey, state should be updated
for correctness in ['correct', 'incorrect']:
@@ -1023,16 +1023,16 @@ class CodeResponseTest(ResponseTest): # pylint: disable=missing-class-docstring
new_cmap = CorrectMap()
new_cmap.update(old_cmap)
npoints = 1 if correctness == 'correct' else 0
- new_cmap.set(answer_id=answer_id, npoints=npoints, correctness=correctness, msg=grader_msg, queuestate=None)
+ new_cmap.set(answer_id=answer_id, npoints=npoints, correctness=correctness, msg=grader_msg, queuestate=None) # lint-amnesty, pylint: disable=line-too-long
self.problem.update_score(xserver_msgs[correctness], queuekey=1000 + i)
self.assertEqual(self.problem.correct_map.get_dict(), new_cmap.get_dict())
for j, test_id in enumerate(answer_ids):
if j == i:
- self.assertFalse(self.problem.correct_map.is_queued(test_id)) # Should be dequeued, message delivered
+ self.assertFalse(self.problem.correct_map.is_queued(test_id)) # Should be dequeued, message delivered # lint-amnesty, pylint: disable=line-too-long
else:
- self.assertTrue(self.problem.correct_map.is_queued(test_id)) # Should be queued, message undelivered
+ self.assertTrue(self.problem.correct_map.is_queued(test_id)) # Should be queued, message undelivered # lint-amnesty, pylint: disable=line-too-long
def test_recentmost_queuetime(self):
'''
@@ -1586,7 +1586,7 @@ class NumericalResponseTest(ResponseTest): # pylint: disable=missing-class-docs
)
@mock.patch('capa.responsetypes.log')
- def test_responsetype_i18n(self, mock_log):
+ def test_responsetype_i18n(self, mock_log): # lint-amnesty, pylint: disable=unused-argument
"""Test that LoncapaSystem has an i18n that works."""
staff_ans = "clearly bad syntax )[+1e"
problem = self.build_problem(answer=staff_ans, tolerance=1e-3)
@@ -1652,7 +1652,7 @@ class NumericalResponseTest(ResponseTest): # pylint: disable=missing-class-docs
def evaluator_side_effect(_, __, math_string):
"""Raise an error only for the student input."""
if math_string != '4':
- raise err
+ raise err # lint-amnesty, pylint: disable=cell-var-from-loop
mock_eval.side_effect = evaluator_side_effect
with self.assertRaisesRegex(StudentInputError, msg_regex):
@@ -2320,7 +2320,7 @@ class CustomResponseTest(ResponseTest): # pylint: disable=missing-class-docstri
num = my_helper.seventeen()
""")
capa_system = test_capa_system()
- capa_system.get_python_lib_zip = lambda: zipstring.getvalue()
+ capa_system.get_python_lib_zip = lambda: zipstring.getvalue() # lint-amnesty, pylint: disable=unnecessary-lambda
problem = self.build_problem(script=script, capa_system=capa_system)
self.assertEqual(problem.context['num'], 17)
@@ -2424,7 +2424,7 @@ class SchematicResponseTest(ResponseTest):
def test_check_function_randomization(self):
# The check function should get a random seed from the problem.
- script = "correct = ['correct' if (submission[0]['num'] == {code}) else 'incorrect']".format(code=self._get_random_number_code())
+ script = "correct = ['correct' if (submission[0]['num'] == {code}) else 'incorrect']".format(code=self._get_random_number_code()) # lint-amnesty, pylint: disable=line-too-long
problem = self.build_problem(answer=script)
submission_dict = {'num': self._get_random_number_result(problem.seed)}
@@ -2445,7 +2445,7 @@ class SchematicResponseTest(ResponseTest):
problem.grade_answers(input_dict)
-class AnnotationResponseTest(ResponseTest):
+class AnnotationResponseTest(ResponseTest): # lint-amnesty, pylint: disable=missing-class-docstring
xml_factory_class = AnnotationResponseXMLFactory
def test_grade(self):
diff --git a/common/lib/capa/capa/tests/test_shuffle.py b/common/lib/capa/capa/tests/test_shuffle.py
index fee3adb52a..0a87c2edf2 100644
--- a/common/lib/capa/capa/tests/test_shuffle.py
+++ b/common/lib/capa/capa/tests/test_shuffle.py
@@ -12,7 +12,7 @@ class CapaShuffleTest(unittest.TestCase):
"""Capa problem tests for shuffling and choice-name masking."""
def setUp(self):
- super(CapaShuffleTest, self).setUp()
+ super(CapaShuffleTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.system = test_capa_system()
def test_shuffle_4_choices(self):
@@ -113,7 +113,7 @@ class CapaShuffleTest(unittest.TestCase):
problem = new_loncapa_problem(xml_str, seed=0) # yields: C E A B D F
# Donut -> Zonut to show that there is not some hidden alphabetic ordering going on
the_html = problem.get_html()
- self.assertRegex(the_html, r"
.*\[.*'Chocolate'.*'Eggplant'.*'Apple'.*'Banana'.*'Zonut'.*'Filet Mignon'.*\].*
")
+ self.assertRegex(the_html, r"
.*\[.*'Chocolate'.*'Eggplant'.*'Apple'.*'Banana'.*'Zonut'.*'Filet Mignon'.*\].*
") # lint-amnesty, pylint: disable=line-too-long
def test_shuffle_false(self):
xml_str = textwrap.dedent("""
diff --git a/common/lib/capa/capa/tests/test_targeted_feedback.py b/common/lib/capa/capa/tests/test_targeted_feedback.py
index bf30a8535b..09df597b65 100644
--- a/common/lib/capa/capa/tests/test_targeted_feedback.py
+++ b/common/lib/capa/capa/tests/test_targeted_feedback.py
@@ -18,7 +18,7 @@ class CapaTargetedFeedbackTest(unittest.TestCase):
'''
def setUp(self):
- super(CapaTargetedFeedbackTest, self).setUp()
+ super(CapaTargetedFeedbackTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.system = test_capa_system()
def test_no_targeted_feedback(self):
diff --git a/common/lib/capa/capa/tests/test_util.py b/common/lib/capa/capa/tests/test_util.py
index 70fc2108fe..8c6a380678 100644
--- a/common/lib/capa/capa/tests/test_util.py
+++ b/common/lib/capa/capa/tests/test_util.py
@@ -24,10 +24,10 @@ class UtilTest(unittest.TestCase):
"""Tests for util"""
def setUp(self):
- super(UtilTest, self).setUp()
+ super(UtilTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.system = test_capa_system()
- def test_compare_with_tolerance(self):
+ def test_compare_with_tolerance(self): # lint-amnesty, pylint: disable=too-many-statements
# Test default tolerance '0.001%' (it is relative)
result = compare_with_tolerance(100.0, 100.0)
self.assertTrue(result)
diff --git a/common/lib/capa/capa/xqueue_interface.py b/common/lib/capa/capa/xqueue_interface.py
index 25b0bcf9b7..7dcda7ca5a 100644
--- a/common/lib/capa/capa/xqueue_interface.py
+++ b/common/lib/capa/capa/xqueue_interface.py
@@ -1,4 +1,4 @@
-#
+# # lint-amnesty, pylint: disable=missing-module-docstring
# LMS Interface to external queueing system (xqueue)
#
@@ -93,7 +93,7 @@ class XQueueInterface(object):
# log the send to xqueue
header_info = json.loads(header)
- queue_name = header_info.get('queue_name', u'')
+ queue_name = header_info.get('queue_name', u'') # lint-amnesty, pylint: disable=unused-variable
# Attempt to send to queue
(error, msg) = self._send_to_queue(header, body, files_to_upload)
@@ -113,14 +113,14 @@ class XQueueInterface(object):
return error, msg
- def _login(self):
+ def _login(self): # lint-amnesty, pylint: disable=missing-function-docstring
payload = {
'username': self.auth['username'],
'password': self.auth['password']
}
return self._http_post(self.url + '/xqueue/login/', payload)
- def _send_to_queue(self, header, body, files_to_upload):
+ def _send_to_queue(self, header, body, files_to_upload): # lint-amnesty, pylint: disable=missing-function-docstring
payload = {
'xqueue_header': header,
'xqueue_body': body
@@ -132,7 +132,7 @@ class XQueueInterface(object):
return self._http_post(self.url + '/xqueue/submit/', payload, files=files)
- def _http_post(self, url, data, files=None):
+ def _http_post(self, url, data, files=None): # lint-amnesty, pylint: disable=missing-function-docstring
try:
response = self.session.post(
url, data=data, files=files, timeout=(CONNECT_TIMEOUT, READ_TIMEOUT)
diff --git a/common/lib/capa/setup.py b/common/lib/capa/setup.py
index bf2badc36e..c284b9b056 100644
--- a/common/lib/capa/setup.py
+++ b/common/lib/capa/setup.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
from setuptools import find_packages, setup
diff --git a/common/lib/safe_lxml/safe_lxml/__init__.py b/common/lib/safe_lxml/safe_lxml/__init__.py
index b17efb15cc..0623f11670 100644
--- a/common/lib/safe_lxml/safe_lxml/__init__.py
+++ b/common/lib/safe_lxml/safe_lxml/__init__.py
@@ -1,4 +1,4 @@
-"""
+""" # lint-amnesty, pylint: disable=django-not-configured
Defuse vulnerabilities in XML packages.
"""
diff --git a/common/lib/safe_lxml/safe_lxml/etree.py b/common/lib/safe_lxml/safe_lxml/etree.py
index fef0694a77..8bd35afd85 100644
--- a/common/lib/safe_lxml/safe_lxml/etree.py
+++ b/common/lib/safe_lxml/safe_lxml/etree.py
@@ -13,7 +13,7 @@ For processing xml always prefer this over using lxml.etree directly.
from lxml.etree import XMLParser as _XMLParser
-from lxml.etree import *
+from lxml.etree import * # lint-amnesty, pylint: disable=redefined-builtin
from lxml.etree import _Element, _ElementTree
# This should be imported after lxml.etree so that it overrides the following attributes.
@@ -28,4 +28,4 @@ class XMLParser(_XMLParser): # pylint: disable=function-redefined
def __init__(self, *args, **kwargs):
if "resolve_entities" not in kwargs:
kwargs["resolve_entities"] = False
- super(XMLParser, self).__init__(*args, **kwargs)
+ super(XMLParser, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
diff --git a/common/lib/safe_lxml/setup.py b/common/lib/safe_lxml/setup.py
index 9a4a54c8d4..95e67f2cc4 100644
--- a/common/lib/safe_lxml/setup.py
+++ b/common/lib/safe_lxml/setup.py
@@ -1,4 +1,4 @@
-"""
+""" # lint-amnesty, pylint: disable=django-not-configured
Setup.py for safe_lxml.
"""
diff --git a/common/lib/sandbox-packages/eia.py b/common/lib/sandbox-packages/eia.py
index f8c2da59f1..a10b631502 100644
--- a/common/lib/sandbox-packages/eia.py
+++ b/common/lib/sandbox-packages/eia.py
@@ -1,4 +1,4 @@
-"""
+""" # lint-amnesty, pylint: disable=django-not-configured
Standard resistor values.
Commonly used for verifying electronic components in circuit classes are
diff --git a/common/lib/sandbox-packages/loncapa/__init__.py b/common/lib/sandbox-packages/loncapa/__init__.py
index 32661f2df8..f25098235e 100644
--- a/common/lib/sandbox-packages/loncapa/__init__.py
+++ b/common/lib/sandbox-packages/loncapa/__init__.py
@@ -1,3 +1,3 @@
-#!/usr/bin/python
+#!/usr/bin/python # lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
-from .loncapa_check import *
+from .loncapa_check import * # lint-amnesty, pylint: disable=redefined-builtin
diff --git a/common/lib/sandbox-packages/loncapa/loncapa_check.py b/common/lib/sandbox-packages/loncapa/loncapa_check.py
index fea82fdd4f..80a0a51545 100644
--- a/common/lib/sandbox-packages/loncapa/loncapa_check.py
+++ b/common/lib/sandbox-packages/loncapa/loncapa_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python # lint-amnesty, pylint: disable=missing-module-docstring
#
# File: mitx/lib/loncapa/loncapa_check.py
#
@@ -26,9 +26,9 @@ def lc_choose(index, *args):
'''
try:
return args[int(index) - 1]
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except, unused-variable
pass
- if len(args):
+ if len(args): # lint-amnesty, pylint: disable=len-as-condition
return args[0]
raise Exception(
"loncapa_check.lc_choose error, index={index}, args={args}".format(
diff --git a/common/lib/sandbox-packages/setup.py b/common/lib/sandbox-packages/setup.py
index 68b1fdd6dd..a5f85d59ff 100644
--- a/common/lib/sandbox-packages/setup.py
+++ b/common/lib/sandbox-packages/setup.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
from setuptools import setup
diff --git a/common/lib/sandbox-packages/verifiers/tests_draganddrop.py b/common/lib/sandbox-packages/verifiers/tests_draganddrop.py
index 151b98d329..a25a3125b1 100644
--- a/common/lib/sandbox-packages/verifiers/tests_draganddrop.py
+++ b/common/lib/sandbox-packages/verifiers/tests_draganddrop.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import json
import unittest
@@ -42,7 +42,7 @@ class Test_PositionsCompare(unittest.TestCase):
self.assertEqual(PositionsCompare([3.5, 4.5]), PositionsCompare([5, 7]))
-class Test_DragAndDrop_Grade(unittest.TestCase):
+class Test_DragAndDrop_Grade(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_targets_are_draggable_1(self):
user_input = json.dumps([
@@ -775,7 +775,7 @@ class Test_DragAndDrop_Grade(unittest.TestCase):
self.assertTrue(draganddrop.grade(user_input, correct_answer))
-class Test_DragAndDrop_Populate(unittest.TestCase):
+class Test_DragAndDrop_Populate(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_1(self):
correct_answer = {'1': [[40, 10], 29], 'name_with_icon': [20, 20]}
@@ -793,7 +793,7 @@ class Test_DragAndDrop_Populate(unittest.TestCase):
self.assertEqual(user_positions, dnd.user_positions)
-class Test_DraAndDrop_Compare_Positions(unittest.TestCase):
+class Test_DraAndDrop_Compare_Positions(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_1(self):
dnd = draganddrop.DragAndDrop({'1': 't1'}, '[{"1": "t1"}]')
@@ -844,7 +844,7 @@ class Test_DraAndDrop_Compare_Positions(unittest.TestCase):
flag='anyof'))
-def suite():
+def suite(): # lint-amnesty, pylint: disable=missing-function-docstring
testcases = [Test_PositionsCompare,
Test_DragAndDrop_Populate,
diff --git a/common/lib/symmath/setup.py b/common/lib/symmath/setup.py
index 95e5400f97..d4dd2cc074 100644
--- a/common/lib/symmath/setup.py
+++ b/common/lib/symmath/setup.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
from setuptools import setup
setup(
diff --git a/common/lib/symmath/symmath/__init__.py b/common/lib/symmath/symmath/__init__.py
index a4233e4dde..4b86811224 100644
--- a/common/lib/symmath/symmath/__init__.py
+++ b/common/lib/symmath/symmath/__init__.py
@@ -1,2 +1,3 @@
-from .formula import *
+# lint-amnesty, pylint: disable=missing-module-docstring
+from .formula import * # lint-amnesty, pylint: disable=django-not-configured
from .symmath_check import *
diff --git a/common/lib/symmath/symmath/formula.py b/common/lib/symmath/symmath/formula.py
index edc4ad580a..d72389b72c 100644
--- a/common/lib/symmath/symmath/formula.py
+++ b/common/lib/symmath/symmath/formula.py
@@ -21,7 +21,7 @@ import unicodedata
#import subprocess
from copy import deepcopy
from functools import reduce
-from xml.sax.saxutils import unescape
+from xml.sax.saxutils import unescape # lint-amnesty, pylint: disable=unused-import
import six
import sympy
@@ -210,7 +210,7 @@ class formula(object):
for k in xml:
tag = gettag(k)
- if tag == 'mi' or tag == 'ci':
+ if tag == 'mi' or tag == 'ci': # lint-amnesty, pylint: disable=consider-using-in
usym = six.text_type(k.text)
try:
udata = unicodedata.name(usym)
@@ -227,7 +227,7 @@ class formula(object):
self.fix_greek_in_mathml(k)
return xml
- def preprocess_pmathml(self, xml):
+ def preprocess_pmathml(self, xml): # lint-amnesty, pylint: disable=too-many-statements
r"""
Pre-process presentation MathML from ASCIIMathML to make it more
acceptable for SnuggleTeX, and also to accomodate some sympy
@@ -420,7 +420,7 @@ class formula(object):
self.xml = xml # pylint: disable=attribute-defined-outside-init
return self.xml
- def get_content_mathml(self):
+ def get_content_mathml(self): # lint-amnesty, pylint: disable=missing-function-docstring
if self.the_cmathml:
return self.the_cmathml
@@ -436,7 +436,7 @@ class formula(object):
cmathml = property(get_content_mathml, None, None, 'content MathML representation')
- def make_sympy(self, xml=None):
+ def make_sympy(self, xml=None): # lint-amnesty, pylint: disable=too-many-statements
"""
Return sympy expression for the math formula.
The math formula is converted to Content MathML then that is parsed.
@@ -457,11 +457,11 @@ class formula(object):
cmml = self.cmathml
xml = etree.fromstring(str(cmml))
except Exception as err:
- if 'conversion from Presentation MathML to Content MathML was not successful' in cmml:
+ if 'conversion from Presentation MathML to Content MathML was not successful' in cmml: # lint-amnesty, pylint: disable=unsupported-membership-test
msg = "Illegal math expression"
else:
msg = 'Err %s while converting cmathml to xml; cmml=%s' % (err, cmml)
- raise Exception(msg)
+ raise Exception(msg) # lint-amnesty, pylint: disable=raise-missing-from
xml = self.fix_greek_in_mathml(xml)
self.the_sympy = self.make_sympy(xml[0])
else:
@@ -482,14 +482,14 @@ class formula(object):
def op_minus(*args):
if len(args) == 1:
return -args[0]
- if not len(args) == 2:
+ if not len(args) == 2: # lint-amnesty, pylint: disable=unneeded-not
raise Exception('minus given wrong number of arguments!')
#return sympy.Add(args[0],-args[1])
return args[0] - args[1]
opdict = {
'plus': op_plus,
- 'divide': operator.div,
+ 'divide': operator.div, # lint-amnesty, pylint: disable=no-member
'times': op_times,
'minus': op_minus,
'root': sympy.sqrt,
@@ -546,7 +546,7 @@ class formula(object):
except Exception as err:
self.args = args # pylint: disable=attribute-defined-outside-init
self.op = op # pylint: disable=attribute-defined-outside-init, invalid-name
- raise Exception('[formula] error=%s failed to apply %s to args=%s' % (err, opstr, args))
+ raise Exception('[formula] error=%s failed to apply %s to args=%s' % (err, opstr, args)) # lint-amnesty, pylint: disable=raise-missing-from
return res
else:
raise Exception('[formula]: unknown operator tag %s' % (opstr))
diff --git a/common/lib/symmath/symmath/symmath_check.py b/common/lib/symmath/symmath/symmath_check.py
index 5a1a2171a7..6ac03a47d2 100644
--- a/common/lib/symmath/symmath/symmath_check.py
+++ b/common/lib/symmath/symmath/symmath_check.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python # lint-amnesty, pylint: disable=missing-module-docstring
# -*- coding: utf-8 -*-
#
# File: symmath_check.py
@@ -16,7 +16,7 @@ from markupsafe import escape
from openedx.core.djangolib.markup import HTML
-from .formula import *
+from .formula import * # lint-amnesty, pylint: disable=wildcard-import
log = logging.getLogger(__name__)
@@ -26,7 +26,7 @@ log = logging.getLogger(__name__)
# This is one of the main entry points to call.
-def symmath_check_simple(expect, ans, adict={}, symtab=None, extra_options=None):
+def symmath_check_simple(expect, ans, adict={}, symtab=None, extra_options=None): # lint-amnesty, pylint: disable=dangerous-default-value, unused-argument
"""
Check a symbolic mathematical expression using sympy.
The input is an ascii string (not MathML) converted to math using sympy.sympify.
@@ -51,7 +51,7 @@ def symmath_check_simple(expect, ans, adict={}, symtab=None, extra_options=None)
abcsym=options['__ABC__'],
symtab=symtab,
)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
return {'ok': False,
'msg': HTML('Error {err}
Failed in evaluating check({expect},{ans})').format(
err=err, expect=expect, ans=ans
@@ -62,7 +62,7 @@ def symmath_check_simple(expect, ans, adict={}, symtab=None, extra_options=None)
# pretty generic checking function
-def check(expect, given, numerical=False, matrix=False, normphase=False, abcsym=False, do_qubit=True, symtab=None, dosimplify=False):
+def check(expect, given, numerical=False, matrix=False, normphase=False, abcsym=False, do_qubit=True, symtab=None, dosimplify=False): # lint-amnesty, pylint: disable=line-too-long
"""
Returns dict with
@@ -93,19 +93,19 @@ def check(expect, given, numerical=False, matrix=False, normphase=False, abcsym=
threshold = float(st)
numerical = True
- if str(given) == '' and not str(expect) == '':
+ if str(given) == '' and not str(expect) == '': # lint-amnesty, pylint: disable=unneeded-not
return {'ok': False, 'msg': ''}
try:
xgiven = my_sympify(given, normphase, matrix, do_qubit=do_qubit, abcsym=abcsym, symtab=symtab)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
return {'ok': False, 'msg': HTML('Error {err}
in evaluating your expression "{given}"').format(
err=err, given=given
)}
try:
xexpect = my_sympify(expect, normphase, matrix, do_qubit=do_qubit, abcsym=abcsym, symtab=symtab)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
return {'ok': False, 'msg': HTML('Error {err}
in evaluating OUR expression "{expect}"').format(
err=err, expect=expect
)}
@@ -113,12 +113,12 @@ def check(expect, given, numerical=False, matrix=False, normphase=False, abcsym=
if 'autonorm' in flags: # normalize trace of matrices
try:
xgiven /= xgiven.trace()
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
return {'ok': False, 'msg': HTML('Error {err}
in normalizing trace of your expression {xgiven}').
format(err=err, xgiven=to_latex(xgiven))}
try:
xexpect /= xexpect.trace()
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
return {'ok': False, 'msg': HTML('Error {err}
in normalizing trace of OUR expression {xexpect}').
format(err=err, xexpect=to_latex(xexpect))}
@@ -172,7 +172,7 @@ def is_within_tolerance(expected, actual, tolerance):
# This is one of the main entry points to call.
-def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None):
+def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None): # lint-amnesty, pylint: disable=too-many-statements
"""
Check a symbolic mathematical expression using sympy.
The input may be presentation MathML. Uses formula.
@@ -220,7 +220,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
# parse expected answer
try:
fexpect = my_sympify(str(expect), matrix=do_matrix, do_qubit=do_qubit)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
msg += HTML('
Error {err} in parsing OUR expected answer "{expect}"
').format(err=err, expect=expect)
return {'ok': False, 'msg': make_error_message(msg)}
@@ -228,7 +228,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
# if expected answer is a number, try parsing provided answer as a number also
try:
fans = my_sympify(str(ans), matrix=do_matrix, do_qubit=do_qubit)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
fans = None
# do a numerical comparison if both expected and answer are numbers
@@ -256,7 +256,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
# convert mathml answer to formula
try:
mmlans = dynamath[0] if dynamath else None
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
mmlans = None
if not mmlans:
return {'ok': False, 'msg': '[symmath_check] failed to get MathML for input; dynamath=%s' % dynamath}
@@ -268,7 +268,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
try:
fsym = f.sympy
msg += HTML('
You entered: {sympy}
').format(sympy=to_latex(f.sympy))
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
log.exception("Error evaluating expression '%s' as a valid equation", ans)
msg += HTML("
Error in evaluating your expression '{ans}' as a valid equation
").format(ans=ans)
if "Illegal math" in str(err):
@@ -309,7 +309,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
except sympy.ShapeError:
msg += HTML("
Error - your input vector or matrix has the wrong dimensions")
return {'ok': False, 'msg': make_error_message(msg)}
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
msg += HTML("
Error %s in comparing expected (a list) and your answer
").format(escape(str(err)))
if DEBUG:
msg += HTML("
{format_exc}").format(format_exc=traceback.format_exc())
@@ -320,7 +320,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
#fexpect = fexpect.simplify()
try:
diff = (fexpect - fsym)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
diff = None
if DEBUG:
diff --git a/common/lib/symmath/symmath/test_formula.py b/common/lib/symmath/symmath/test_formula.py
index 3895157fd8..25d163f059 100644
--- a/common/lib/symmath/symmath/test_formula.py
+++ b/common/lib/symmath/symmath/test_formula.py
@@ -16,13 +16,13 @@ def stripXML(xml):
return xml
-class FormulaTest(unittest.TestCase):
+class FormulaTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
# for readability later
mathml_start = '
'
def setUp(self):
- super(FormulaTest, self).setUp()
+ super(FormulaTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.formulaInstance = formula('')
def test_replace_mathvariants(self):
diff --git a/common/lib/symmath/symmath/test_symmath_check.py b/common/lib/symmath/symmath/test_symmath_check.py
index 0e2f1c7cc0..502f2c8be6 100644
--- a/common/lib/symmath/symmath/test_symmath_check.py
+++ b/common/lib/symmath/symmath/test_symmath_check.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
from unittest import TestCase
from six.moves import range
@@ -6,9 +6,9 @@ from six.moves import range
from .symmath_check import symmath_check
-class SymmathCheckTest(TestCase):
+class SymmathCheckTest(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_symmath_check_integers(self):
- number_list = [i for i in range(-100, 100)]
+ number_list = [i for i in range(-100, 100)] # lint-amnesty, pylint: disable=unnecessary-comprehension
self._symmath_check_numbers(number_list)
def test_symmath_check_floats(self):
@@ -73,7 +73,7 @@ class SymmathCheckTest(TestCase):
self.assertTrue('ok' in result and not result['ok'])
self.assertNotIn('fail', result['msg'])
- def _symmath_check_numbers(self, number_list):
+ def _symmath_check_numbers(self, number_list): # lint-amnesty, pylint: disable=missing-function-docstring
for n in number_list:
diff --git a/common/lib/xmodule/setup.py b/common/lib/xmodule/setup.py
index d0817d3aee..5b2329c3ab 100644
--- a/common/lib/xmodule/setup.py
+++ b/common/lib/xmodule/setup.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
from setuptools import find_packages, setup
diff --git a/common/lib/xmodule/xmodule/annotatable_module.py b/common/lib/xmodule/xmodule/annotatable_module.py
index 16e6b1771f..e657bd3435 100644
--- a/common/lib/xmodule/xmodule/annotatable_module.py
+++ b/common/lib/xmodule/xmodule/annotatable_module.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import logging
import textwrap
@@ -107,7 +107,7 @@ class AnnotatableBlock(
HIGHLIGHT_COLORS = ['yellow', 'orange', 'purple', 'blue', 'green']
- def _get_annotation_class_attr(self, index, el):
+ def _get_annotation_class_attr(self, index, el): # lint-amnesty, pylint: disable=unused-argument
""" Returns a dict with the CSS class attribute to set on the annotation
and an XML key to delete from the element.
"""
@@ -125,7 +125,7 @@ class AnnotatableBlock(
return {'class': attr}
- def _get_annotation_data_attr(self, index, el):
+ def _get_annotation_data_attr(self, index, el): # lint-amnesty, pylint: disable=unused-argument
""" Returns a dict in which the keys are the HTML data attributes
to set on the annotation element. Each data attribute has a
corresponding 'value' and (optional) '_delete' key to specify
@@ -139,7 +139,7 @@ class AnnotatableBlock(
'problem': 'data-problem-id'
}
- for xml_key in attrs_map.keys():
+ for xml_key in attrs_map.keys(): # lint-amnesty, pylint: disable=consider-iterating-dictionary
if xml_key in el.attrib:
value = el.get(xml_key, '')
html_key = attrs_map[xml_key]
@@ -155,7 +155,7 @@ class AnnotatableBlock(
el.tag = 'span'
- for key in attr.keys():
+ for key in attr.keys(): # lint-amnesty, pylint: disable=consider-iterating-dictionary
el.set(key, attr[key]['value'])
if '_delete' in attr[key] and attr[key]['_delete'] is not None:
delete_key = attr[key]['_delete']
@@ -203,7 +203,7 @@ class AnnotatableBlock(
return self.system.render_template('annotatable.html', context)
- def student_view(self, context):
+ def student_view(self, context): # lint-amnesty, pylint: disable=unused-argument
"""
Renders the output that a student will see.
"""
diff --git a/common/lib/xmodule/xmodule/annotator_mixin.py b/common/lib/xmodule/xmodule/annotator_mixin.py
index 23a0dc4520..6ed36c54cc 100644
--- a/common/lib/xmodule/xmodule/annotator_mixin.py
+++ b/common/lib/xmodule/xmodule/annotator_mixin.py
@@ -31,7 +31,7 @@ def get_extension(srcurl):
return 'video/' + file_ext.replace('.', '')
-class MLStripper(HTMLParser):
+class MLStripper(HTMLParser): # lint-amnesty, pylint: disable=abstract-method
"helper function for html_to_text below"
def __init__(self):
HTMLParser.__init__(self)
diff --git a/common/lib/xmodule/xmodule/assetstore/__init__.py b/common/lib/xmodule/xmodule/assetstore/__init__.py
index 7b4dd96c7e..b4ecb63ea0 100644
--- a/common/lib/xmodule/xmodule/assetstore/__init__.py
+++ b/common/lib/xmodule/xmodule/assetstore/__init__.py
@@ -18,7 +18,7 @@ new_contract('CourseKey', CourseKey)
new_contract('datetime', datetime)
new_contract('basestring', six.string_types[0])
if six.PY2:
- new_contract('long', long)
+ new_contract('long', long) # lint-amnesty, pylint: disable=undefined-variable
else:
new_contract('long', int)
new_contract('AssetElement', lambda x: isinstance(x, etree._Element) and x.tag == "asset") # pylint: disable=protected-access
@@ -199,7 +199,7 @@ class AssetMetadata(object):
continue
elif tag == 'locked':
# Boolean.
- value = True if value == "true" else False
+ value = True if value == "true" else False # lint-amnesty, pylint: disable=simplifiable-if-expression
elif value == 'None':
# None.
value = None
diff --git a/common/lib/xmodule/xmodule/assetstore/assetmgr.py b/common/lib/xmodule/xmodule/assetstore/assetmgr.py
index 02af44787b..442f2dcca0 100644
--- a/common/lib/xmodule/xmodule/assetstore/assetmgr.py
+++ b/common/lib/xmodule/xmodule/assetstore/assetmgr.py
@@ -26,21 +26,21 @@ class AssetException(Exception):
"""
Base exception class for all exceptions related to assets.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class AssetMetadataNotFound(AssetException):
"""
Thrown when no asset metadata is present in the course modulestore for the particular asset requested.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class AssetMetadataFoundTemporary(AssetException):
"""
TEMPORARY: Thrown if asset metadata is actually found in the course modulestore.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class AssetManager(object):
diff --git a/common/lib/xmodule/xmodule/assetstore/tests/test_asset_xml.py b/common/lib/xmodule/xmodule/assetstore/tests/test_asset_xml.py
index baa1e5e61c..a795a70cfc 100644
--- a/common/lib/xmodule/xmodule/assetstore/tests/test_asset_xml.py
+++ b/common/lib/xmodule/xmodule/assetstore/tests/test_asset_xml.py
@@ -21,7 +21,7 @@ class TestAssetXml(unittest.TestCase):
"""
def setUp(self):
- super(TestAssetXml, self).setUp()
+ super(TestAssetXml, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
xsd_filename = "assets.xsd"
diff --git a/common/lib/xmodule/xmodule/backcompat_module.py b/common/lib/xmodule/xmodule/backcompat_module.py
index 3f86df9426..471c1b1304 100644
--- a/common/lib/xmodule/xmodule/backcompat_module.py
+++ b/common/lib/xmodule/xmodule/backcompat_module.py
@@ -41,7 +41,7 @@ def process_includes(fn):
# insert new XML into tree in place of include
parent.insert(parent.index(next_include), incxml)
- except Exception:
+ except Exception: # lint-amnesty, pylint: disable=broad-except
# Log error
msg = "Error in problem xml include: %s" % (
etree.tostring(next_include, pretty_print=True))
@@ -65,7 +65,7 @@ def process_includes(fn):
return from_xml
-class SemanticSectionDescriptor(XModuleDescriptor):
+class SemanticSectionDescriptor(XModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
resources_dir = None
@classmethod
@@ -89,7 +89,7 @@ class SemanticSectionDescriptor(XModuleDescriptor):
return system.process_xml(etree.tostring(xml_object))
-class TranslateCustomTagDescriptor(XModuleDescriptor):
+class TranslateCustomTagDescriptor(XModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
resources_dir = None
@classmethod
diff --git a/common/lib/xmodule/xmodule/capa_base.py b/common/lib/xmodule/xmodule/capa_base.py
index f63044de57..f0e0b6703c 100644
--- a/common/lib/xmodule/xmodule/capa_base.py
+++ b/common/lib/xmodule/xmodule/capa_base.py
@@ -112,7 +112,7 @@ class ComplexEncoder(json.JSONEncoder):
"""
Extend the JSON encoder to correctly handle complex numbers
"""
- def default(self, obj): # pylint: disable=method-hidden
+ def default(self, obj): # lint-amnesty, pylint: disable=arguments-differ, method-hidden
"""
Print a nicely formatted complex number, or default to the JSON encoder
"""
@@ -294,7 +294,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
return self.seed
@cached_property
- def lcp(self):
+ def lcp(self): # lint-amnesty, pylint: disable=method-hidden, missing-function-docstring
try:
lcp = self.new_lcp(self.get_state_for_lcp())
except Exception as err: # pylint: disable=broad-except
@@ -446,7 +446,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
'graded': self.graded,
})
- def handle_fatal_lcp_error(self, error):
+ def handle_fatal_lcp_error(self, error): # lint-amnesty, pylint: disable=missing-function-docstring
log.exception(u"LcpFatalError Encountered for {block}".format(block=str(self.location)))
if error:
return(
@@ -876,7 +876,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
'correcthint', 'regexphint', 'additional_answer', 'stringequalhint', 'compoundhint',
'stringequalhint']
for tag in tags:
- html = re.sub(r'<%s.*?>.*?%s>' % (tag, tag), '', html, flags=re.DOTALL) # xss-lint: disable=python-interpolate-html
+ html = re.sub(r'<%s.*?>.*?%s>' % (tag, tag), '', html, flags=re.DOTALL) # xss-lint: disable=python-interpolate-html # lint-amnesty, pylint: disable=line-too-long
# Some of these tags span multiple lines
# Note: could probably speed this up by calling sub() once with a big regex
# vs. simply calling sub() many times as we have here.
@@ -1066,7 +1066,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
event_info = dict()
event_info['problem_id'] = text_type(self.location)
self.track_function_unmask('showanswer', event_info)
- if not self.answer_available():
+ if not self.answer_available(): # lint-amnesty, pylint: disable=no-else-raise
raise NotFoundError('Answer is not available')
else:
answers = self.lcp.get_question_answers()
@@ -1155,7 +1155,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
# If key has no underscores, then partition
# will return (key, '', '')
# We detect this and raise an error
- if not name:
+ if not name: # lint-amnesty, pylint: disable=no-else-raise
raise ValueError(u"{key} must contain at least one underscore".format(key=key))
else:
@@ -1176,7 +1176,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
val = json.loads(data[key])
# If the submission wasn't deserializable, raise an error.
except(KeyError, ValueError):
- raise ValueError(
+ raise ValueError( # lint-amnesty, pylint: disable=raise-missing-from
u"Invalid submission: {val} for {key}".format(val=data[key], key=key)
)
else:
@@ -1184,7 +1184,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
# If the name already exists, then we don't want
# to override it. Raise an error instead
- if name in answers:
+ if name in answers: # lint-amnesty, pylint: disable=no-else-raise
raise ValueError(u"Key {name} already exists in answers dict".format(name=name))
else:
answers[name] = val
@@ -1227,7 +1227,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
answers_without_files = convert_files_to_filenames(answers)
event_info['answers'] = answers_without_files
- metric_name = u'capa.check_problem.{}'.format
+ metric_name = u'capa.check_problem.{}'.format # lint-amnesty, pylint: disable=unused-variable
# Can override current time
current_time = datetime.datetime.now(utc)
if override_time is not False:
@@ -1682,7 +1682,7 @@ class CapaMixin(ScorableXBlockMixin, CapaFields):
try:
self.update_correctness()
calculated_score = self.calculate_score()
- except (StudentInputError, ResponseError, LoncapaProblemError) as inst:
+ except (StudentInputError, ResponseError, LoncapaProblemError) as inst: # lint-amnesty, pylint: disable=unused-variable
log.warning("Input error in capa_module:problem_rescore", exc_info=True)
event_info['failure'] = 'input_error'
self.track_function_unmask('problem_rescore_fail', event_info)
diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py
index 58c939b12e..7b339df708 100644
--- a/common/lib/xmodule/xmodule/capa_module.py
+++ b/common/lib/xmodule/xmodule/capa_module.py
@@ -30,7 +30,7 @@ from xmodule.x_module import (
)
from xmodule.xml_module import XmlMixin
-from .capa_base import CapaMixin, ComplexEncoder, _
+from .capa_base import CapaMixin, ComplexEncoder, _ # lint-amnesty, pylint: disable=unused-import
log = logging.getLogger("edx.courseware")
@@ -95,8 +95,8 @@ class ProblemBlock(
]
}
- def bind_for_student(self, *args, **kwargs):
- super(ProblemBlock, self).bind_for_student(*args, **kwargs)
+ def bind_for_student(self, *args, **kwargs): # lint-amnesty, pylint: disable=signature-differs
+ super(ProblemBlock, self).bind_for_student(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
# Capa was an XModule. When bind_for_student() was called on it with a new runtime, a new CapaModule object
# was initialized when XModuleDescriptor._xmodule() was called next. self.lcp was constructed in CapaModule
@@ -111,7 +111,7 @@ class ProblemBlock(
# self.score is initialized in self.lcp but in this method is accessed before self.lcp so just call it first.
try:
self.lcp
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
html = self.handle_fatal_lcp_error(err if show_detailed_errors else None)
else:
html = self.get_html()
@@ -132,7 +132,7 @@ class ProblemBlock(
return self.student_view(context)
else:
# Show a message that this content requires users to login/enroll.
- return super(ProblemBlock, self).public_view(context)
+ return super(ProblemBlock, self).public_view(context) # lint-amnesty, pylint: disable=super-with-arguments
def author_view(self, context):
"""
@@ -163,7 +163,7 @@ class ProblemBlock(
}
"""
# self.score is initialized in self.lcp but in this method is accessed before self.lcp so just call it first.
- self.lcp
+ self.lcp # lint-amnesty, pylint: disable=pointless-statement
handlers = {
'hint_button': self.hint_button,
'problem_get': self.get_problem,
@@ -207,7 +207,7 @@ class ProblemBlock(
_, _, traceback_obj = sys.exc_info()
six.reraise(ProcessingError, ProcessingError(not_found_error_message), traceback_obj)
- except Exception:
+ except Exception: # lint-amnesty, pylint: disable=broad-except
log.exception(
"Unknown error when dispatching %s to %s for user %s",
dispatch,
@@ -275,7 +275,7 @@ class ProblemBlock(
@property
def non_editable_metadata_fields(self):
- non_editable_fields = super(ProblemBlock, self).non_editable_metadata_fields
+ non_editable_fields = super(ProblemBlock, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.extend([
ProblemBlock.due,
ProblemBlock.graceperiod,
@@ -301,7 +301,7 @@ class ProblemBlock(
"""
Return dictionary prepared with module content and type for indexing.
"""
- xblock_body = super(ProblemBlock, self).index_dictionary()
+ xblock_body = super(ProblemBlock, self).index_dictionary() # lint-amnesty, pylint: disable=super-with-arguments
# Make optioninput's options index friendly by replacing the actual tag with the values
capa_content = re.sub(r'\s*|\S*<\/optioninput>', r'\1', self.data)
diff --git a/common/lib/xmodule/xmodule/conditional_module.py b/common/lib/xmodule/xmodule/conditional_module.py
index 1b842d5455..2ecfad726a 100644
--- a/common/lib/xmodule/xmodule/conditional_module.py
+++ b/common/lib/xmodule/xmodule/conditional_module.py
@@ -194,7 +194,7 @@ class ConditionalBlock(
"""
Create an instance of the Conditional XBlock.
"""
- super(ConditionalBlock, self).__init__(*args, **kwargs)
+ super(ConditionalBlock, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
# Convert sources xml_attribute to a ReferenceList field type so Location/Locator
# substitution can be done.
if not self.sources_list:
@@ -208,7 +208,7 @@ class ConditionalBlock(
for item in ConditionalBlock.parse_sources(self.xml_attributes)
]
- def is_condition_satisfied(self):
+ def is_condition_satisfied(self): # lint-amnesty, pylint: disable=missing-function-docstring
attr_name = self.conditions_map[self.conditional_attr]
if self.conditional_value and self.get_required_blocks:
@@ -360,7 +360,7 @@ class ConditionalBlock(
try:
descriptor = system.process_xml(etree.tostring(child, encoding='unicode'))
children.append(descriptor.scope_ids.usage_id)
- except:
+ except: # lint-amnesty, pylint: disable=bare-except
msg = "Unable to load child when parsing Conditional."
log.exception(msg)
system.error_tracker(msg)
@@ -390,7 +390,7 @@ class ConditionalBlock(
return xml_object
def validate(self):
- validation = super(ConditionalBlock, self).validate()
+ validation = super(ConditionalBlock, self).validate() # lint-amnesty, pylint: disable=super-with-arguments
if not self.sources_list:
conditional_validation = StudioValidation(self.location)
conditional_validation.add(
@@ -407,7 +407,7 @@ class ConditionalBlock(
@property
def non_editable_metadata_fields(self):
- non_editable_fields = super(ConditionalBlock, self).non_editable_metadata_fields
+ non_editable_fields = super(ConditionalBlock, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.extend([
ConditionalBlock.due,
ConditionalBlock.show_tag_list,
diff --git a/common/lib/xmodule/xmodule/contentstore/content.py b/common/lib/xmodule/xmodule/contentstore/content.py
index 15dd1122dc..3486743027 100644
--- a/common/lib/xmodule/xmodule/contentstore/content.py
+++ b/common/lib/xmodule/xmodule/contentstore/content.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import logging
import os
@@ -26,11 +26,11 @@ VERSIONED_ASSETS_PREFIX = '/assets/courseware'
VERSIONED_ASSETS_PATTERN = r'/assets/courseware/(v[\d]/)?([a-f0-9]{32})'
-class StaticContent(object):
+class StaticContent(object): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, loc, name, content_type, data, last_modified_at=None, thumbnail_location=None, import_path=None,
length=None, locked=False, content_digest=None):
self.location = loc
- self.name = name # a display string which can be edited, and thus not part of the location which needs to be fixed
+ self.name = name # a display string which can be edited, and thus not part of the location which needs to be fixed # lint-amnesty, pylint: disable=line-too-long
self.content_type = content_type
self._data = data
self.length = length
@@ -70,7 +70,7 @@ class StaticContent(object):
)
@staticmethod
- def compute_location(course_key, path, revision=None, is_thumbnail=False):
+ def compute_location(course_key, path, revision=None, is_thumbnail=False): # lint-amnesty, pylint: disable=unused-argument
"""
Constructs a location object for static content.
@@ -111,10 +111,10 @@ class StaticContent(object):
@staticmethod
def get_static_path_from_location(location):
"""
- This utility static method will take a location identifier and create a 'durable' /static/.. URL representation of it.
- This link is 'durable' as it can maintain integrity across cloning of courseware across course-ids, e.g. reruns of
+ This utility static method will take a location identifier and create a 'durable' /static/.. URL representation of it. # lint-amnesty, pylint: disable=line-too-long
+ This link is 'durable' as it can maintain integrity across cloning of courseware across course-ids, e.g. reruns of # lint-amnesty, pylint: disable=line-too-long
courses.
- In the LMS/CMS, we have runtime link-rewriting, so at render time, this /static/... format will get translated into
+ In the LMS/CMS, we have runtime link-rewriting, so at render time, this /static/... format will get translated into # lint-amnesty, pylint: disable=line-too-long
the actual /c4x/... path which the client needs to reference static content
"""
if location is not None:
@@ -123,7 +123,7 @@ class StaticContent(object):
return None
@staticmethod
- def get_base_url_path_for_course_assets(course_key):
+ def get_base_url_path_for_course_assets(course_key): # lint-amnesty, pylint: disable=missing-function-docstring
if course_key is None:
return None
@@ -307,10 +307,10 @@ class StaticContent(object):
return url
-class StaticContentStream(StaticContent):
- def __init__(self, loc, name, content_type, stream, last_modified_at=None, thumbnail_location=None, import_path=None,
+class StaticContentStream(StaticContent): # lint-amnesty, pylint: disable=missing-class-docstring
+ def __init__(self, loc, name, content_type, stream, last_modified_at=None, thumbnail_location=None, import_path=None, # lint-amnesty, pylint: disable=line-too-long
length=None, locked=False, content_digest=None):
- super(StaticContentStream, self).__init__(loc, name, content_type, None, last_modified_at=last_modified_at,
+ super(StaticContentStream, self).__init__(loc, name, content_type, None, last_modified_at=last_modified_at, # lint-amnesty, pylint: disable=super-with-arguments
thumbnail_location=thumbnail_location, import_path=import_path,
length=length, locked=locked, content_digest=content_digest)
self._stream = stream
@@ -340,7 +340,7 @@ class StaticContentStream(StaticContent):
def close(self):
self._stream.close()
- def copy_to_in_mem(self):
+ def copy_to_in_mem(self): # lint-amnesty, pylint: disable=missing-function-docstring
self._stream.seek(0)
content = StaticContent(self.location, self.name, self.content_type, self._stream.read(),
last_modified_at=self.last_modified_at, thumbnail_location=self.thumbnail_location,
@@ -469,4 +469,4 @@ class ContentStore(object):
Ensure that all appropriate indexes are created that are needed by this modulestore, or raise
an exception if unable to.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
diff --git a/common/lib/xmodule/xmodule/contentstore/django.py b/common/lib/xmodule/xmodule/contentstore/django.py
index dfbe512be5..186524da41 100644
--- a/common/lib/xmodule/xmodule/contentstore/django.py
+++ b/common/lib/xmodule/xmodule/contentstore/django.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
from importlib import import_module
@@ -18,7 +18,7 @@ def load_function(path):
return getattr(import_module(module_path), name)
-def contentstore(name='default'):
+def contentstore(name='default'): # lint-amnesty, pylint: disable=missing-function-docstring
if name not in _CONTENTSTORE:
class_ = load_function(settings.CONTENTSTORE['ENGINE'])
options = {}
diff --git a/common/lib/xmodule/xmodule/contentstore/mongo.py b/common/lib/xmodule/xmodule/contentstore/mongo.py
index d25ff3596e..754bde44e1 100644
--- a/common/lib/xmodule/xmodule/contentstore/mongo.py
+++ b/common/lib/xmodule/xmodule/contentstore/mongo.py
@@ -28,7 +28,7 @@ class MongoContentStore(ContentStore):
"""
MongoDB-backed ContentStore.
"""
- # pylint: disable=unused-argument, bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value, unused-argument
def __init__(
self, host, db,
port=27017, tz_aware=True, user=None, password=None, bucket='fs', collection=None, **kwargs
@@ -92,8 +92,8 @@ class MongoContentStore(ContentStore):
# the location as the _id, we must delete before adding (there's no replace method in gridFS)
self.delete(content_id) # delete is a noop if the entry doesn't exist; so, don't waste time checking
- thumbnail_location = content.thumbnail_location.to_deprecated_list_repr() if content.thumbnail_location else None
- with self.fs.new_file(_id=content_id, filename=six.text_type(content.location), content_type=content.content_type,
+ thumbnail_location = content.thumbnail_location.to_deprecated_list_repr() if content.thumbnail_location else None # lint-amnesty, pylint: disable=line-too-long
+ with self.fs.new_file(_id=content_id, filename=six.text_type(content.location), content_type=content.content_type, # lint-amnesty, pylint: disable=line-too-long
displayname=content.name, content_son=content_son,
thumbnail_location=thumbnail_location,
import_path=content.import_path,
@@ -127,7 +127,7 @@ class MongoContentStore(ContentStore):
self.fs.delete(location_or_id)
@autoretry_read()
- def find(self, location, throw_on_not_found=True, as_stream=False):
+ def find(self, location, throw_on_not_found=True, as_stream=False): # lint-amnesty, pylint: disable=arguments-differ
content_id, __ = self.asset_db_key(location)
try:
@@ -135,8 +135,8 @@ class MongoContentStore(ContentStore):
fp = self.fs.get(content_id)
# Need to replace dict IDs with SON for chunk lookup to work under Python 3
# because field order can be different and mongo cares about the order
- if isinstance(fp._id, dict):
- fp._file['_id'] = content_id
+ if isinstance(fp._id, dict): # lint-amnesty, pylint: disable=protected-access
+ fp._file['_id'] = content_id # lint-amnesty, pylint: disable=protected-access
thumbnail_location = getattr(fp, 'thumbnail_location', None)
if thumbnail_location:
thumbnail_location = location.course_key.make_asset_key(
@@ -154,8 +154,8 @@ class MongoContentStore(ContentStore):
with self.fs.get(content_id) as fp:
# Need to replace dict IDs with SON for chunk lookup to work under Python 3
# because field order can be different and mongo cares about the order
- if isinstance(fp._id, dict):
- fp._file['_id'] = content_id
+ if isinstance(fp._id, dict): # lint-amnesty, pylint: disable=protected-access
+ fp._file['_id'] = content_id # lint-amnesty, pylint: disable=protected-access
thumbnail_location = getattr(fp, 'thumbnail_location', None)
if thumbnail_location:
thumbnail_location = location.course_key.make_asset_key(
@@ -170,12 +170,12 @@ class MongoContentStore(ContentStore):
content_digest=getattr(fp, 'md5', None),
)
except NoFile:
- if throw_on_not_found:
- raise NotFoundError(content_id)
+ if throw_on_not_found: # lint-amnesty, pylint: disable=no-else-raise
+ raise NotFoundError(content_id) # lint-amnesty, pylint: disable=raise-missing-from
else:
return None
- def export(self, location, output_directory):
+ def export(self, location, output_directory): # lint-amnesty, pylint: disable=missing-function-docstring
content = self.find(location)
filename = content.name
@@ -418,8 +418,8 @@ class MongoContentStore(ContentStore):
__, asset_key = self.asset_db_key(asset_key)
# Need to replace dict IDs with SON for chunk lookup to work under Python 3
# because field order can be different and mongo cares about the order
- if isinstance(source_content._id, dict):
- source_content._file['_id'] = asset_key.copy()
+ if isinstance(source_content._id, dict): # lint-amnesty, pylint: disable=protected-access
+ source_content._file['_id'] = asset_key.copy() # lint-amnesty, pylint: disable=protected-access
asset_key['org'] = dest_course_key.org
asset_key['course'] = dest_course_key.course
if getattr(dest_course_key, 'deprecated', False): # remove the run if exists
diff --git a/common/lib/xmodule/xmodule/contentstore/utils.py b/common/lib/xmodule/xmodule/contentstore/utils.py
index 5231524c11..181c7afe40 100644
--- a/common/lib/xmodule/xmodule/contentstore/utils.py
+++ b/common/lib/xmodule/xmodule/contentstore/utils.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
from xmodule.contentstore.content import StaticContent
@@ -43,5 +43,5 @@ def restore_asset_from_trashcan(location):
try:
thumbnail_content = trash.find(content.thumbnail_location)
store.save(thumbnail_content)
- except Exception:
+ except Exception: # lint-amnesty, pylint: disable=broad-except
pass # OK if this is left dangling
diff --git a/common/lib/xmodule/xmodule/course_metadata_utils.py b/common/lib/xmodule/xmodule/course_metadata_utils.py
index c90df652bc..f61c5e04de 100644
--- a/common/lib/xmodule/xmodule/course_metadata_utils.py
+++ b/common/lib/xmodule/xmodule/course_metadata_utils.py
@@ -202,7 +202,7 @@ def sorting_dates(start, advertised_start, announcement):
if start.tzinfo is None:
start = start.replace(tzinfo=utc)
except (TypeError, ValueError, AttributeError):
- start = start
+ start = start # lint-amnesty, pylint: disable=self-assigning-variable
now = datetime.now(utc)
diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py
index b0b08df980..c3215ed6e2 100644
--- a/common/lib/xmodule/xmodule/course_module.py
+++ b/common/lib/xmodule/xmodule/course_module.py
@@ -20,10 +20,10 @@ from pytz import utc
from six import text_type
from xblock.fields import Boolean, Dict, Float, Integer, List, Scope, String
-from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers # lint-amnesty, pylint: disable=unused-import
from openedx.core.djangoapps.video_pipeline.models import VideoUploadsEnabledByDefault
from openedx.core.lib.license import LicenseMixin
-from openedx.core.lib.teams_config import TeamsConfig, DEFAULT_COURSE_RUN_MAX_TEAM_SIZE
+from openedx.core.lib.teams_config import TeamsConfig, DEFAULT_COURSE_RUN_MAX_TEAM_SIZE # lint-amnesty, pylint: disable=unused-import
from xmodule import course_metadata_utils
from xmodule.course_metadata_utils import DEFAULT_GRADING_POLICY, DEFAULT_START_DATE
from xmodule.graders import grader_from_conf
@@ -58,14 +58,14 @@ COURSE_VISIBILITY_PUBLIC_OUTLINE = 'public_outline'
COURSE_VISIBILITY_PUBLIC = 'public'
-class StringOrDate(Date):
- def from_json(self, value):
+class StringOrDate(Date): # lint-amnesty, pylint: disable=missing-class-docstring
+ def from_json(self, value): # lint-amnesty, pylint: disable=arguments-differ
"""
Parse an optional metadata key containing a time or a string:
if present, assume it's a string if it doesn't parse.
"""
try:
- result = super(StringOrDate, self).from_json(value)
+ result = super(StringOrDate, self).from_json(value) # lint-amnesty, pylint: disable=super-with-arguments
except ValueError:
return value
if result is None:
@@ -78,8 +78,8 @@ class StringOrDate(Date):
Convert a time struct or string to a string.
"""
try:
- result = super(StringOrDate, self).to_json(value)
- except:
+ result = super(StringOrDate, self).to_json(value) # lint-amnesty, pylint: disable=super-with-arguments
+ except: # lint-amnesty, pylint: disable=bare-except
return value
if result is None:
return value
@@ -105,7 +105,7 @@ edx_xml_parser = etree.XMLParser(dtd_validation=False, load_dtd=False,
_cached_toc = {}
-class Textbook(object):
+class Textbook(object): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, title, book_url):
self.title = title
self.book_url = book_url
@@ -115,7 +115,7 @@ class Textbook(object):
return int(self.table_of_contents[0].attrib['page'])
@lazy
- def end_page(self):
+ def end_page(self): # lint-amnesty, pylint: disable=missing-function-docstring
# The last page should be the last element in the table of contents,
# but it may be nested. So recurse all the way down the last element
last_el = self.table_of_contents[-1]
@@ -148,7 +148,7 @@ class Textbook(object):
# expire every 10 minutes
if age.seconds < 600:
return table_of_contents
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
pass
# Get the table of contents from S3
@@ -158,7 +158,7 @@ class Textbook(object):
except Exception as err:
msg = 'Error %s: Unable to retrieve textbook table of contents at %s' % (err, toc_url)
log.error(msg)
- raise Exception(msg)
+ raise Exception(msg) # lint-amnesty, pylint: disable=raise-missing-from
# TOC is XML. Parse it
try:
@@ -166,7 +166,7 @@ class Textbook(object):
except Exception as err:
msg = 'Error %s: Unable to parse XML for textbook table of contents at %s' % (err, toc_url)
log.error(msg)
- raise Exception(msg)
+ raise Exception(msg) # lint-amnesty, pylint: disable=raise-missing-from
return table_of_contents
@@ -178,13 +178,13 @@ class Textbook(object):
return not self == other
-class TextbookList(List):
- def from_json(self, values):
+class TextbookList(List): # lint-amnesty, pylint: disable=missing-class-docstring
+ def from_json(self, values): # lint-amnesty, pylint: disable=arguments-differ
textbooks = []
for title, book_url in values:
try:
textbooks.append(Textbook(title, book_url))
- except:
+ except: # lint-amnesty, pylint: disable=bare-except
# If we can't get to S3 (e.g. on a train with no internet), don't break
# the rest of the courseware.
log.exception("Couldn't load textbook ({0}, {1})".format(title, book_url))
@@ -192,7 +192,7 @@ class TextbookList(List):
return textbooks
- def to_json(self, values):
+ def to_json(self, values): # lint-amnesty, pylint: disable=arguments-differ
json_data = []
for val in values:
if isinstance(val, Textbook):
@@ -215,7 +215,7 @@ class ProctoringProvider(String):
and include any inherited values from the platform default.
"""
errors = []
- value = super(ProctoringProvider, self).from_json(value)
+ value = super(ProctoringProvider, self).from_json(value) # lint-amnesty, pylint: disable=super-with-arguments
provider_errors = self._validate_proctoring_provider(value)
errors.extend(provider_errors)
@@ -265,7 +265,7 @@ class ProctoringProvider(String):
"""
Return default value for ProctoringProvider.
"""
- default = super(ProctoringProvider, self).default
+ default = super(ProctoringProvider, self).default # lint-amnesty, pylint: disable=super-with-arguments
proctoring_backend_settings = getattr(settings, 'PROCTORING_BACKENDS', None)
@@ -275,7 +275,7 @@ class ProctoringProvider(String):
return default
-def get_available_providers():
+def get_available_providers(): # lint-amnesty, pylint: disable=missing-function-docstring
proctoring_backend_settings = getattr(
settings,
'PROCTORING_BACKENDS',
@@ -314,7 +314,7 @@ class TeamsConfigField(Dict):
return value.cleaned_data
-class CourseFields(object):
+class CourseFields(object): # lint-amnesty, pylint: disable=missing-class-docstring
lti_passports = List(
display_name=_("LTI Passports"),
help=_('Enter the passports for course LTI tools in the following format: "id:client_key:client_secret".'),
@@ -1051,7 +1051,7 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
"""
Expects the same arguments as XModuleDescriptor.__init__
"""
- super(CourseDescriptor, self).__init__(*args, **kwargs)
+ super(CourseDescriptor, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
_ = self.runtime.service(self, "i18n").ugettext
self._gating_prerequisites = None
@@ -1087,7 +1087,7 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
if not getattr(self, "tabs", []):
CourseTabList.initialize_default(self)
except InvalidTabsException as err:
- raise type(err)('{msg} For course: {course_id}'.format(msg=text_type(err), course_id=six.text_type(self.id)))
+ raise type(err)('{msg} For course: {course_id}'.format(msg=text_type(err), course_id=six.text_type(self.id))) # lint-amnesty, pylint: disable=line-too-long
self.set_default_certificate_available_date()
@@ -1197,11 +1197,11 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
return definition, children
def definition_to_xml(self, resource_fs):
- xml_object = super(CourseDescriptor, self).definition_to_xml(resource_fs)
+ xml_object = super(CourseDescriptor, self).definition_to_xml(resource_fs) # lint-amnesty, pylint: disable=super-with-arguments
if self.textbooks:
textbook_xml_object = etree.Element('textbook')
- for textbook in self.textbooks:
+ for textbook in self.textbooks: # lint-amnesty, pylint: disable=not-an-iterable
textbook_xml_object.set('title', textbook.title)
textbook_xml_object.set('book_url', textbook.book_url)
@@ -1245,7 +1245,7 @@ class CourseDescriptor(CourseFields, SequenceDescriptor, LicenseMixin):
return grader_from_conf(self.raw_grader)
@property
- def raw_grader(self):
+ def raw_grader(self): # lint-amnesty, pylint: disable=missing-function-docstring
# force the caching of the xblock value so that it can detect the change
# pylint: disable=pointless-statement
self.grading_policy['GRADER']
diff --git a/common/lib/xmodule/xmodule/editing_module.py b/common/lib/xmodule/xmodule/editing_module.py
index c32211584f..17b40009e9 100644
--- a/common/lib/xmodule/xmodule/editing_module.py
+++ b/common/lib/xmodule/xmodule/editing_module.py
@@ -32,7 +32,7 @@ class EditingMixin(EditingFields, MakoTemplateBlockBase):
"""
`data` should not be editable in the Studio settings editor.
"""
- non_editable_fields = super(EditingMixin, self).non_editable_metadata_fields
+ non_editable_fields = super(EditingMixin, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.append(self.fields['data'])
return non_editable_fields
@@ -46,7 +46,7 @@ class EditingMixin(EditingFields, MakoTemplateBlockBase):
return _context
-class EditingDescriptor(EditingMixin, MakoModuleDescriptor):
+class EditingDescriptor(EditingMixin, MakoModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method
pass
@@ -72,7 +72,7 @@ class TabsEditingMixin(EditingFields, MakoTemplateBlockBase):
return _context
@classmethod
- def get_css(cls):
+ def get_css(cls): # lint-amnesty, pylint: disable=missing-function-docstring
# load every tab's css
for tab in cls.tabs:
tab_styles = tab.get('css', {})
@@ -84,7 +84,7 @@ class TabsEditingMixin(EditingFields, MakoTemplateBlockBase):
return cls.css
-class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor):
+class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method
"""
Module that provides a raw editing view of its data and children. It does not
perform any validation on its definition---just passes it along to the browser.
@@ -95,10 +95,10 @@ class TabsEditingDescriptor(TabsEditingMixin, MakoModuleDescriptor):
template to be always loaded, so don't forget to include
settings tab in your module descriptor.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
-class XMLEditingDescriptor(EditingDescriptor):
+class XMLEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method
"""
Module that provides a raw editing view of its data as XML. It does not perform
any validation of its definition
@@ -110,7 +110,7 @@ class XMLEditingDescriptor(EditingDescriptor):
js_module_name = "XMLEditingDescriptor"
-class MetadataOnlyEditingDescriptor(EditingDescriptor):
+class MetadataOnlyEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method
"""
Module which only provides an editing interface for the metadata, it does
not expose a UI for editing the module data
@@ -122,7 +122,7 @@ class MetadataOnlyEditingDescriptor(EditingDescriptor):
mako_template = "widgets/metadata-only-edit.html"
-class JSONEditingDescriptor(EditingDescriptor):
+class JSONEditingDescriptor(EditingDescriptor): # lint-amnesty, pylint: disable=abstract-method
"""
Module that provides a raw editing view of its data as XML. It does not perform
any validation of its definition
diff --git a/common/lib/xmodule/xmodule/error_module.py b/common/lib/xmodule/xmodule/error_module.py
index a6b52aa5eb..8e3db679bd 100644
--- a/common/lib/xmodule/xmodule/error_module.py
+++ b/common/lib/xmodule/xmodule/error_module.py
@@ -128,7 +128,7 @@ class ErrorBlock(
}
@classmethod
- def from_json(cls, json_data, system, location, error_msg='Error not available'):
+ def from_json(cls, json_data, system, location, error_msg='Error not available'): # lint-amnesty, pylint: disable=missing-function-docstring
try:
json_string = json.dumps(json_data, skipkeys=False, indent=4, cls=EdxJSONEncoder)
except: # pylint: disable=bare-except
diff --git a/common/lib/xmodule/xmodule/errortracker.py b/common/lib/xmodule/xmodule/errortracker.py
index c3a4113967..ba2d795257 100644
--- a/common/lib/xmodule/xmodule/errortracker.py
+++ b/common/lib/xmodule/xmodule/errortracker.py
@@ -80,6 +80,6 @@ def make_error_tracker():
return ErrorLog(error_tracker, errors)
-def null_error_tracker(msg):
+def null_error_tracker(msg): # lint-amnesty, pylint: disable=unused-argument
'''A dummy error tracker that just ignores the messages'''
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
diff --git a/common/lib/xmodule/xmodule/exceptions.py b/common/lib/xmodule/xmodule/exceptions.py
index f9a0ad597c..2e7954d9b3 100644
--- a/common/lib/xmodule/xmodule/exceptions.py
+++ b/common/lib/xmodule/xmodule/exceptions.py
@@ -1,4 +1,4 @@
-class InvalidDefinitionError(Exception):
+class InvalidDefinitionError(Exception): # lint-amnesty, pylint: disable=missing-module-docstring
pass
@@ -11,7 +11,7 @@ class ProcessingError(Exception):
An error occurred while processing a request to the XModule.
For example: if an exception occurs while checking a capa problem.
'''
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class InvalidVersionError(Exception):
@@ -20,7 +20,7 @@ class InvalidVersionError(Exception):
for a non-leaf node)
"""
def __init__(self, location):
- super(InvalidVersionError, self).__init__()
+ super(InvalidVersionError, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.location = location
@@ -29,7 +29,7 @@ class SerializationError(Exception):
Thrown when a module cannot be exported to XML
"""
def __init__(self, location, msg):
- super(SerializationError, self).__init__(msg)
+ super(SerializationError, self).__init__(msg) # lint-amnesty, pylint: disable=super-with-arguments
self.location = location
@@ -37,7 +37,7 @@ class UndefinedContext(Exception):
"""
Tried to access an xmodule field which needs a different context (runtime) to have a value.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class HeartbeatFailure(Exception):
@@ -50,4 +50,4 @@ class HeartbeatFailure(Exception):
In addition to a msg, provide the name of the service.
"""
self.service = service
- super(HeartbeatFailure, self).__init__(msg)
+ super(HeartbeatFailure, self).__init__(msg) # lint-amnesty, pylint: disable=super-with-arguments
diff --git a/common/lib/xmodule/xmodule/fields.py b/common/lib/xmodule/xmodule/fields.py
index 188182d81f..7babfd695f 100644
--- a/common/lib/xmodule/xmodule/fields.py
+++ b/common/lib/xmodule/xmodule/fields.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import datetime
import logging
@@ -43,7 +43,7 @@ class Date(JSONField):
result = result.replace(tzinfo=UTC)
return result
- def from_json(self, field):
+ def from_json(self, field): # lint-amnesty, pylint: disable=arguments-differ
"""
Parse an optional metadata key containing a time: if present, complain
if it doesn't parse.
@@ -55,7 +55,7 @@ class Date(JSONField):
return None
elif isinstance(field, six.string_types):
return self._parse_date_wo_default_month_day(field)
- elif isinstance(field, six.integer_types) or isinstance(field, float):
+ elif isinstance(field, six.integer_types) or isinstance(field, float): # lint-amnesty, pylint: disable=consider-merging-isinstance
return datetime.datetime.fromtimestamp(field / 1000, UTC)
elif isinstance(field, time.struct_time):
return datetime.datetime.fromtimestamp(time.mktime(field), UTC)
@@ -90,14 +90,14 @@ class Date(JSONField):
enforce_type = from_json
-TIMEDELTA_REGEX = re.compile(r'^((?P\d+?) day(?:s?))?(\s)?((?P\d+?) hour(?:s?))?(\s)?((?P\d+?) minute(?:s)?)?(\s)?((?P\d+?) second(?:s)?)?$')
+TIMEDELTA_REGEX = re.compile(r'^((?P\d+?) day(?:s?))?(\s)?((?P\d+?) hour(?:s?))?(\s)?((?P\d+?) minute(?:s)?)?(\s)?((?P\d+?) second(?:s)?)?$') # lint-amnesty, pylint: disable=line-too-long
-class Timedelta(JSONField):
+class Timedelta(JSONField): # lint-amnesty, pylint: disable=missing-class-docstring
# Timedeltas are immutable, see http://docs.python.org/2/library/datetime.html#available-types
MUTABLE = False
- def from_json(self, time_str):
+ def from_json(self, time_str): # lint-amnesty, pylint: disable=arguments-differ
"""
time_str: A string with the following components:
day[s] (optional)
@@ -177,7 +177,7 @@ class RelativeTime(JSONField):
try:
obj_time = time.strptime(value, '%H:%M:%S')
except ValueError as e:
- raise ValueError(
+ raise ValueError( # lint-amnesty, pylint: disable=raise-missing-from
"Incorrect RelativeTime value {!r} was set in XML or serialized. "
"Original parse message is {}".format(value, text_type(e))
)
@@ -290,7 +290,7 @@ class ScoreField(JSONField):
)
)
- if not (0 <= raw_earned <= raw_possible):
+ if not (0 <= raw_earned <= raw_possible): # lint-amnesty, pylint: disable=superfluous-parens
raise ValueError(
'Error deserializing field of type {0}: Expected raw_earned between 0 and {1}, got {2}.'.format(
self.display_name,
diff --git a/common/lib/xmodule/xmodule/graders.py b/common/lib/xmodule/xmodule/graders.py
index 3ce3dfa329..fb47e14699 100644
--- a/common/lib/xmodule/xmodule/graders.py
+++ b/common/lib/xmodule/xmodule/graders.py
@@ -78,7 +78,7 @@ class ProblemScore(ScoreBase):
:param weight: Weight of this problem
:type weight: int|float|None
"""
- super(ProblemScore, self).__init__(*args, **kwargs)
+ super(ProblemScore, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.raw_earned = float(raw_earned) if raw_earned is not None else None
self.raw_possible = float(raw_possible) if raw_possible is not None else None
self.earned = float(weighted_earned) if weighted_earned is not None else None
@@ -101,7 +101,7 @@ class AggregatedScore(ScoreBase):
:param tw_possible: Total aggregated sum of all weighted possible values
:type tw_possible: int|float|None
"""
- super(AggregatedScore, self).__init__(*args, **kwargs)
+ super(AggregatedScore, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.earned = float(tw_earned) if tw_earned is not None else None
self.possible = float(tw_possible) if tw_possible is not None else None
@@ -264,7 +264,7 @@ class WeightedSubsectionsGrader(CourseGrader):
self.subgraders = subgraders
@property
- def sum_of_weights(self):
+ def sum_of_weights(self): # lint-amnesty, pylint: disable=missing-function-docstring
result = 0
for _, _, weight in self.subgraders:
result += weight
@@ -333,7 +333,7 @@ class AssignmentFormatGrader(CourseGrader):
min_count = 2 would produce the labels "Assignment 3", "Assignment 4"
"""
- def __init__(
+ def __init__( # lint-amnesty, pylint: disable=super-init-not-called
self,
type, # pylint: disable=redefined-builtin
min_count,
diff --git a/common/lib/xmodule/xmodule/html_checker.py b/common/lib/xmodule/xmodule/html_checker.py
index e6aae980b9..6faf512fb4 100644
--- a/common/lib/xmodule/xmodule/html_checker.py
+++ b/common/lib/xmodule/xmodule/html_checker.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
from lxml import etree
diff --git a/common/lib/xmodule/xmodule/html_module.py b/common/lib/xmodule/xmodule/html_module.py
index 2169bca01c..dcca75c8b4 100644
--- a/common/lib/xmodule/xmodule/html_module.py
+++ b/common/lib/xmodule/xmodule/html_module.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import copy
import logging
@@ -43,7 +43,7 @@ _ = lambda text: text
@XBlock.needs("i18n")
-class HtmlBlockMixin(
+class HtmlBlockMixin( # lint-amnesty, pylint: disable=abstract-method
XmlMixin, EditingMixin,
XModuleDescriptorToXBlockMixin, XModuleToXBlockMixin, HTMLSnippet, ResourceTemplates, XModuleMixin,
):
@@ -223,7 +223,7 @@ class HtmlBlockMixin(
# snippets that will be included in the middle of pages.
@classmethod
- def load_definition(cls, xml_object, system, location, id_generator):
+ def load_definition(cls, xml_object, system, location, id_generator): # lint-amnesty, pylint: disable=arguments-differ
'''Load a descriptor from the specified xml_object:
If there is a filename attribute, load it as a string, and
@@ -341,12 +341,12 @@ class HtmlBlockMixin(
"""
`use_latex_compiler` should not be editable in the Studio settings editor.
"""
- non_editable_fields = super(HtmlBlockMixin, self).non_editable_metadata_fields
+ non_editable_fields = super(HtmlBlockMixin, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.append(HtmlBlockMixin.use_latex_compiler)
return non_editable_fields
def index_dictionary(self):
- xblock_body = super(HtmlBlockMixin, self).index_dictionary()
+ xblock_body = super(HtmlBlockMixin, self).index_dictionary() # lint-amnesty, pylint: disable=super-with-arguments
# Removing script and style
html_content = re.sub(
re.compile(
@@ -373,14 +373,14 @@ class HtmlBlockMixin(
@edxnotes
-class HtmlBlock(HtmlBlockMixin):
+class HtmlBlock(HtmlBlockMixin): # lint-amnesty, pylint: disable=abstract-method
"""
This is the actual HTML XBlock.
Nothing extra is required; this is just a wrapper to include edxnotes support.
"""
-class AboutFields(object):
+class AboutFields(object): # lint-amnesty, pylint: disable=missing-class-docstring
display_name = String(
help=_("The display name for this component."),
scope=Scope.settings,
@@ -394,7 +394,7 @@ class AboutFields(object):
@XBlock.tag("detached")
-class AboutBlock(AboutFields, HtmlBlockMixin):
+class AboutBlock(AboutFields, HtmlBlockMixin): # lint-amnesty, pylint: disable=abstract-method
"""
These pieces of course content are treated as HtmlBlocks but we need to overload where the templates are located
in order to be able to create new ones
@@ -429,7 +429,7 @@ class StaticTabFields(object):
@XBlock.tag("detached")
-class StaticTabBlock(StaticTabFields, HtmlBlockMixin):
+class StaticTabBlock(StaticTabFields, HtmlBlockMixin): # lint-amnesty, pylint: disable=abstract-method
"""
These pieces of course content are treated as HtmlBlocks but we need to overload where the templates are located
in order to be able to create new ones
@@ -454,7 +454,7 @@ class CourseInfoFields(object):
@XBlock.tag("detached")
-class CourseInfoBlock(CourseInfoFields, HtmlBlockMixin):
+class CourseInfoBlock(CourseInfoFields, HtmlBlockMixin): # lint-amnesty, pylint: disable=abstract-method
"""
These pieces of course content are treated as HtmlBlock but we need to overload where the templates are located
in order to be able to create new ones
@@ -485,7 +485,7 @@ class CourseInfoBlock(CourseInfoFields, HtmlBlockMixin):
return self.system.render_template("{0}/course_updates.html".format(self.TEMPLATE_DIR), context)
@classmethod
- def order_updates(self, updates):
+ def order_updates(self, updates): # lint-amnesty, pylint: disable=bad-classmethod-argument
"""
Returns any course updates in reverse chronological order.
"""
diff --git a/common/lib/xmodule/xmodule/library_content_module.py b/common/lib/xmodule/xmodule/library_content_module.py
index 3cca2e6f7a..805caab06c 100644
--- a/common/lib/xmodule/xmodule/library_content_module.py
+++ b/common/lib/xmodule/xmodule/library_content_module.py
@@ -345,7 +345,7 @@ class LibraryContentBlock(
for block_type, block_id in self.selected_children():
yield self.runtime.get_block(self.location.course_key.make_usage_key(block_type, block_id))
- def student_view(self, context):
+ def student_view(self, context): # lint-amnesty, pylint: disable=missing-function-docstring
fragment = Fragment()
contents = []
child_context = {} if not context else copy(context)
@@ -454,7 +454,7 @@ class LibraryContentBlock(
return user_id
@XBlock.handler
- def refresh_children(self, request=None, suffix=None):
+ def refresh_children(self, request=None, suffix=None): # lint-amnesty, pylint: disable=unused-argument
"""
Refresh children:
This method is to be used when any of the libraries that this block
@@ -634,7 +634,7 @@ class LibraryContentBlock(
values = [{"display_name": name, "value": six.text_type(key)} for key, name in all_libraries]
return values
- def editor_saved(self, user, old_metadata, old_content):
+ def editor_saved(self, user, old_metadata, old_content): # lint-amnesty, pylint: disable=unused-argument
"""
If source_library_id or capa_type has been edited, refresh_children automatically.
"""
diff --git a/common/lib/xmodule/xmodule/library_tools.py b/common/lib/xmodule/xmodule/library_tools.py
index d3b4209edd..e4bd89771e 100644
--- a/common/lib/xmodule/xmodule/library_tools.py
+++ b/common/lib/xmodule/xmodule/library_tools.py
@@ -4,7 +4,7 @@ XBlock runtime services for LibraryContentBlock
import hashlib
import six
-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 opaque_keys.edx.keys import UsageKey
from opaque_keys.edx.locator import LibraryLocator, LibraryUsageLocator, LibraryUsageLocatorV2, BlockUsageLocator
diff --git a/common/lib/xmodule/xmodule/lti_2_util.py b/common/lib/xmodule/xmodule/lti_2_util.py
index f6a389b2e8..947d8de98b 100644
--- a/common/lib/xmodule/xmodule/lti_2_util.py
+++ b/common/lib/xmodule/xmodule/lti_2_util.py
@@ -27,7 +27,7 @@ LTI_2_0_JSON_CONTENT_TYPE = 'application/vnd.ims.lis.v2.result+json'
class LTIError(Exception):
"""Error class for LTIModule and LTI20ModuleMixin"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class LTI20ModuleMixin(object):
@@ -295,7 +295,7 @@ class LTI20ModuleMixin(object):
self.verify_oauth_body_sign(request, content_type=LTI_2_0_JSON_CONTENT_TYPE)
except (ValueError, LTIError) as err:
log.info("[LTI]: v2.0 result service -- OAuth body verification failed: {}".format(text_type(err)))
- raise LTIError(text_type(err))
+ raise LTIError(text_type(err)) # lint-amnesty, pylint: disable=raise-missing-from
def parse_lti_2_0_result_json(self, json_str):
"""
@@ -322,7 +322,7 @@ class LTI20ModuleMixin(object):
except (ValueError, TypeError):
msg = "Supplied JSON string in request body could not be decoded: {}".format(json_str)
log.info("[LTI] {}".format(msg))
- raise LTIError(msg)
+ raise LTIError(msg) # lint-amnesty, pylint: disable=raise-missing-from
# the standard supports a list of objects, who knows why. It must contain at least 1 element, and the
# first element must be a dict
@@ -366,6 +366,6 @@ class LTI20ModuleMixin(object):
except (TypeError, ValueError) as err:
msg = "Could not convert resultScore to float: {}".format(text_type(err))
log.info("[LTI] {}".format(msg))
- raise LTIError(msg)
+ raise LTIError(msg) # lint-amnesty, pylint: disable=raise-missing-from
return score, json_obj.get('comment', "")
diff --git a/common/lib/xmodule/xmodule/lti_module.py b/common/lib/xmodule/xmodule/lti_module.py
index 39a85d0ed4..85403c76da 100644
--- a/common/lib/xmodule/xmodule/lti_module.py
+++ b/common/lib/xmodule/xmodule/lti_module.py
@@ -213,7 +213,7 @@ class LTIFields(object):
)
# Users will be presented with a message indicating that their e-mail/username would be sent to a third
- # party application. When "Open in New Page" is not selected, the tool automatically appears without any user action.
+ # party application. When "Open in New Page" is not selected, the tool automatically appears without any user action. # lint-amnesty, pylint: disable=line-too-long
ask_to_send_username = Boolean(
display_name=_("Request user's username"),
# Translators: This is used to request the user's username for a third party service.
@@ -232,7 +232,7 @@ class LTIFields(object):
description = String(
display_name=_("LTI Application Information"),
help=_(
- "Enter a description of the third party application. If requesting username and/or email, use this text box to inform users "
+ "Enter a description of the third party application. If requesting username and/or email, use this text box to inform users " # lint-amnesty, pylint: disable=line-too-long
"why their username and/or email will be forwarded to a third party application."
),
default="",
@@ -347,7 +347,7 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule):
css = {'scss': [resource_string(__name__, 'css/lti/lti.scss')]}
js_module_name = 'LTI'
- def get_input_fields(self):
+ def get_input_fields(self): # lint-amnesty, pylint: disable=missing-function-docstring
# LTI provides a list of default parameters that might be passed as
# part of the POST data. These parameters should not be prefixed.
# Likewise, The creator of an LTI link can add custom key/value parameters
@@ -397,7 +397,7 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule):
msg = _('Could not parse custom parameter: {custom_parameter}. Should be "x=y" string.').format(
custom_parameter="{0!r}".format(custom_parameter)
)
- raise LTIError(msg)
+ raise LTIError(msg) # lint-amnesty, pylint: disable=raise-missing-from
# LTI specs: 'custom_' should be prepended before each custom parameter, as pointed in link above.
if param_name not in PARAMETERS:
@@ -512,7 +512,7 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule):
i4x-2-3-lti-31de800015cf4afb973356dbe81496df this part of resource_link_id:
makes resource_link_id to be unique among courses inside same system.
"""
- return six.text_type(six.moves.urllib.parse.quote("{}-{}".format(self.system.hostname, self.location.html_id())))
+ return six.text_type(six.moves.urllib.parse.quote("{}-{}".format(self.system.hostname, self.location.html_id()))) # lint-amnesty, pylint: disable=line-too-long
def get_lis_result_sourcedid(self):
"""
@@ -599,8 +599,8 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule):
u'lis_outcome_service_url': self.get_outcome_service_url()
})
- self.user_email = ""
- self.user_username = ""
+ self.user_email = "" # lint-amnesty, pylint: disable=attribute-defined-outside-init
+ self.user_username = "" # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Username and email can't be sent in studio mode, because the user object is not defined.
# To test functionality test in LMS
@@ -608,13 +608,13 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule):
if callable(self.runtime.get_real_user):
real_user_object = self.runtime.get_real_user(self.runtime.anonymous_student_id)
try:
- self.user_email = real_user_object.email
+ self.user_email = real_user_object.email # lint-amnesty, pylint: disable=attribute-defined-outside-init
except AttributeError:
- self.user_email = ""
+ self.user_email = "" # lint-amnesty, pylint: disable=attribute-defined-outside-init
try:
- self.user_username = real_user_object.username
+ self.user_username = real_user_object.username # lint-amnesty, pylint: disable=attribute-defined-outside-init
except AttributeError:
- self.user_username = ""
+ self.user_username = "" # lint-amnesty, pylint: disable=attribute-defined-outside-init
if self.ask_to_send_username and self.user_username:
body["lis_person_sourcedid"] = self.user_username
@@ -661,14 +661,14 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
# so '='' becomes '%3D'.
# We send form via browser, so browser will encode it again,
# So we need to decode signature back:
- params[u'oauth_signature'] = six.moves.urllib.parse.unquote(params[u'oauth_signature']).encode('utf-8').decode('utf8')
+ params[u'oauth_signature'] = six.moves.urllib.parse.unquote(params[u'oauth_signature']).encode('utf-8').decode('utf8') # lint-amnesty, pylint: disable=line-too-long
# Add LTI parameters to OAuth parameters for sending in form.
params.update(body)
return params
@XBlock.handler
- def grade_handler(self, request, suffix):
+ def grade_handler(self, request, suffix): # lint-amnesty, pylint: disable=unused-argument
"""
This is called by courseware.module_render, to handle an AJAX call.
@@ -749,9 +749,9 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
try:
imsx_messageIdentifier, sourcedId, score, action = self.parse_grade_xml_body(request.body)
- except Exception as e:
+ except Exception as e: # lint-amnesty, pylint: disable=broad-except
error_message = "Request body XML parsing error: " + escape(text_type(e))
- log.debug("[LTI]: " + error_message)
+ log.debug("[LTI]: " + error_message) # lint-amnesty, pylint: disable=logging-not-lazy
failure_values['imsx_description'] = error_message
return Response(response_xml_template.format(**failure_values), content_type="application/xml")
@@ -762,7 +762,7 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
failure_values['imsx_messageIdentifier'] = escape(imsx_messageIdentifier)
error_message = "OAuth verification error: " + escape(text_type(e))
failure_values['imsx_description'] = error_message
- log.debug("[LTI]: " + error_message)
+ log.debug("[LTI]: " + error_message) # lint-amnesty, pylint: disable=logging-not-lazy
return Response(response_xml_template.format(**failure_values), content_type="application/xml")
real_user = self.system.get_real_user(six.moves.urllib.parse.unquote(sourcedId.split(':')[-1]))
@@ -808,7 +808,7 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
imsx_messageIdentifier = root.xpath("//def:imsx_messageIdentifier", namespaces=namespaces)[0].text or ''
sourcedId = root.xpath("//def:sourcedId", namespaces=namespaces)[0].text
score = root.xpath("//def:textString", namespaces=namespaces)[0].text
- action = root.xpath("//def:imsx_POXBody", namespaces=namespaces)[0].getchildren()[0].tag.replace('{' + lti_spec_namespace + '}', '')
+ action = root.xpath("//def:imsx_POXBody", namespaces=namespaces)[0].getchildren()[0].tag.replace('{' + lti_spec_namespace + '}', '') # lint-amnesty, pylint: disable=line-too-long
# Raise exception if score is not float or not in range 0.0-1.0 regarding spec.
score = float(score)
if not 0 <= score <= 1:
@@ -832,7 +832,7 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
LTIError if request is incorrect.
"""
- client_key, client_secret = self.get_client_key_secret()
+ client_key, client_secret = self.get_client_key_secret() # lint-amnesty, pylint: disable=unused-variable
headers = {
'Authorization': six.text_type(request.headers.get('Authorization')),
'Content-Type': content_type,
@@ -891,7 +891,7 @@ oauth_consumer_key="", oauth_signature="frVp4JuvT1mVXlxktiAUjQ7%2F1cw%3D"'}
msg = _('Could not parse LTI passport: {lti_passport}. Should be "id:key:secret" string.').format(
lti_passport='{0!r}'.format(lti_passport)
)
- raise LTIError(msg)
+ raise LTIError(msg) # lint-amnesty, pylint: disable=raise-missing-from
if lti_id == self.lti_id.strip():
return key, secret
diff --git a/common/lib/xmodule/xmodule/mako_module.py b/common/lib/xmodule/xmodule/mako_module.py
index bc39da82c8..1ff9a449c8 100644
--- a/common/lib/xmodule/xmodule/mako_module.py
+++ b/common/lib/xmodule/xmodule/mako_module.py
@@ -8,9 +8,9 @@ from web_fragments.fragment import Fragment
from .x_module import DescriptorSystem, XModuleDescriptor, shim_xmodule_js
-class MakoDescriptorSystem(DescriptorSystem):
+class MakoDescriptorSystem(DescriptorSystem): # lint-amnesty, pylint: disable=abstract-method
def __init__(self, render_template, **kwargs):
- super(MakoDescriptorSystem, self).__init__(**kwargs)
+ super(MakoDescriptorSystem, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.render_template = render_template
@@ -27,7 +27,7 @@ class MakoTemplateBlockBase(object):
# pylint: disable=no-member
def __init__(self, *args, **kwargs):
- super(MakoTemplateBlockBase, self).__init__(*args, **kwargs)
+ super(MakoTemplateBlockBase, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
if getattr(self.runtime, 'render_template', None) is None:
raise TypeError(
'{runtime} must have a render_template function'
diff --git a/common/lib/xmodule/xmodule/modulestore/__init__.py b/common/lib/xmodule/xmodule/modulestore/__init__.py
index 74b52b1196..a38a469840 100644
--- a/common/lib/xmodule/xmodule/modulestore/__init__.py
+++ b/common/lib/xmodule/xmodule/modulestore/__init__.py
@@ -80,7 +80,7 @@ class ModuleStoreEnum(object):
class Branch(object):
"""
Branch constants to use for stores, such as Mongo, that have only 2 branches: DRAFT and PUBLISHED
- Note: These values are taken from server configuration settings, so should not be changed without alerting DevOps
+ Note: These values are taken from server configuration settings, so should not be changed without alerting DevOps # lint-amnesty, pylint: disable=line-too-long
"""
draft_preferred = 'draft-preferred'
published_only = 'published-only'
@@ -161,7 +161,7 @@ class ActiveBulkThread(threading.local):
Add the expected vars to the thread.
"""
def __init__(self, bulk_ops_record_type, **kwargs):
- super(ActiveBulkThread, self).__init__(**kwargs)
+ super(ActiveBulkThread, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.records = defaultdict(bulk_ops_record_type)
@@ -178,7 +178,7 @@ class BulkOperationsMixin(object):
mongo_connection.
"""
def __init__(self, *args, **kwargs):
- super(BulkOperationsMixin, self).__init__(*args, **kwargs)
+ super(BulkOperationsMixin, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self._active_bulk_ops = ActiveBulkThread(self._bulk_ops_record_type)
self.signal_handler = None
@@ -211,7 +211,7 @@ class BulkOperationsMixin(object):
if ignore_case:
for key, record in six.iteritems(self._active_bulk_ops.records):
# Shortcut: check basic equivalence for cases where org/course/run might be None.
- if (key == course_key) or (
+ if (key == course_key) or ( # lint-amnesty, pylint: disable=too-many-boolean-expressions
(key.org and key.org.lower() == course_key.org.lower()) and
(key.course and key.course.lower() == course_key.course.lower()) and
(key.run and key.run.lower() == course_key.run.lower())
@@ -242,7 +242,7 @@ class BulkOperationsMixin(object):
Implementing classes must override this method; otherwise, the bulk operations are a noop
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
def _begin_bulk_operation(self, course_key, ignore_case=False):
"""
@@ -264,7 +264,7 @@ class BulkOperationsMixin(object):
Implementing classes must override this method; otherwise, the bulk operations are a noop
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
def _end_bulk_operation(self, structure_key, emit_signals=True, ignore_case=False):
"""
@@ -288,7 +288,7 @@ class BulkOperationsMixin(object):
if bulk_ops_record.active:
return
- dirty = self._end_outermost_bulk_operation(bulk_ops_record, structure_key)
+ dirty = self._end_outermost_bulk_operation(bulk_ops_record, structure_key) # lint-amnesty, pylint: disable=assignment-from-no-return
# The bulk op has ended. However, the signal tasks below still need to use the
# built-up bulk op information (if the signals trigger tasks in the same thread).
@@ -387,7 +387,7 @@ class EditInfo(object):
self.original_usage_version = edit_info.get('original_usage_version', None)
def __repr__(self):
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
return ("{classname}(previous_version={self.previous_version}, "
"update_version={self.update_version}, "
"source_version={source_version}, "
@@ -400,7 +400,7 @@ class EditInfo(object):
self=self,
classname=self.__class__.__name__,
source_version="UNSET" if self.source_version is None else self.source_version,
- ) # pylint: disable=bad-continuation
+ ) # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
def __eq__(self, edit_info):
"""
@@ -474,7 +474,7 @@ class BlockData(object):
return self.asides
def __repr__(self):
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
return ("{classname}(fields={self.fields}, "
"block_type={self.block_type}, "
"definition={self.definition}, "
@@ -485,7 +485,7 @@ class BlockData(object):
self=self,
classname=self.__class__.__name__,
asides=self.get_asides()
- ) # pylint: disable=bad-continuation
+ ) # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
def __eq__(self, block_data):
"""
@@ -508,10 +508,10 @@ class IncorrectlySortedList(Exception):
"""
Thrown when calling find() on a SortedAssetList not sorted by filename.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
-class SortedAssetList(SortedKeyList):
+class SortedAssetList(SortedKeyList): # lint-amnesty, pylint: disable=abstract-method
"""
List of assets that is sorted based on an asset attribute.
"""
@@ -521,7 +521,7 @@ class SortedAssetList(SortedKeyList):
if key_func is None:
kwargs['key'] = itemgetter('filename')
self.filename_sort = True
- super(SortedAssetList, self).__init__(**kwargs)
+ super(SortedAssetList, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
@contract(asset_id=AssetKey)
def find(self, asset_id):
@@ -575,7 +575,7 @@ class ModuleStoreAssetBase(object):
- AssetMetadata[] for all assets of the given asset_key's type
- the index of asset in list (None if asset does not exist)
"""
- course_assets = self._find_course_assets(asset_key.course_key)
+ course_assets = self._find_course_assets(asset_key.course_key) # lint-amnesty, pylint: disable=no-member
all_assets = SortedAssetList(iterable=course_assets.setdefault(asset_key.block_type, []))
idx = all_assets.find(asset_key)
@@ -605,7 +605,7 @@ class ModuleStoreAssetBase(object):
course_key='CourseKey', asset_type='None | str',
start='int | None', maxresults='int | None', sort='tuple(str,int) | None'
)
- def get_all_asset_metadata(self, course_key, asset_type, start=0, maxresults=-1, sort=None, **kwargs):
+ def get_all_asset_metadata(self, course_key, asset_type, start=0, maxresults=-1, sort=None, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Returns a list of asset metadata for all assets of the given asset_type in the course.
@@ -622,7 +622,7 @@ class ModuleStoreAssetBase(object):
Returns:
List of AssetMetadata objects.
"""
- course_assets = self._find_course_assets(course_key)
+ course_assets = self._find_course_assets(course_key) # lint-amnesty, pylint: disable=no-member
# Determine the proper sort - with defaults of ('displayname', SortOrder.ascending).
key_func = None
@@ -636,7 +636,7 @@ class ModuleStoreAssetBase(object):
if asset_type is None:
# Add assets of all types to the sorted list.
all_assets = SortedAssetList(iterable=[], key=key_func)
- for asset_type, val in six.iteritems(course_assets):
+ for asset_type, val in six.iteritems(course_assets): # lint-amnesty, pylint: disable=redefined-argument-from-local
all_assets.update(val)
else:
# Add assets of a single type to the sorted list.
@@ -775,7 +775,7 @@ class ModuleStoreAssetWriteInterface(ModuleStoreAssetBase):
dest_course_key (CourseKey): identifier of course to copy to
user_id (int): user ID copying the asset metadata
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
@@ -789,7 +789,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
"""
Returns True if usage_key exists in this ModuleStore.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_item(self, usage_key, depth=0, using_descriptor_system=None, **kwargs):
@@ -809,7 +809,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
in the request. The depth is counted in the number of calls to
get_children() to cache. None indicates to cache all descendents
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_course_errors(self, course_key):
@@ -823,7 +823,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
Args:
course_key (:class:`.CourseKey`): The course to check for errors
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_items(self, course_id, qualifiers=None, **kwargs):
@@ -834,7 +834,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
location: Something that can be passed to Location
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@contract(block='XBlock | BlockData | dict', qualifiers=dict)
def _block_matches(self, block, qualifiers):
@@ -920,7 +920,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
This key may represent a course that doesn't exist in this modulestore.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def make_course_usage_key(self, course_key):
@@ -928,7 +928,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
Return a valid :class:`~opaque_keys.edx.keys.UsageKey` for this modulestore
that matches the supplied course_key.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_courses(self, **kwargs):
@@ -938,7 +938,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
will efficiently apply a filter so that only the courses of the specified
ORG in the CourseKey will be fetched.
'''
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_course(self, course_id, depth=0, **kwargs):
@@ -946,7 +946,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
Look for a specific course by its id (:class:`CourseKey`).
Returns the course descriptor, or None if not found.
'''
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def has_course(self, course_id, ignore_case=False, **kwargs):
@@ -957,7 +957,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
ignore_case (boolean): some modulestores are case-insensitive. Use this flag
to search for whether a potentially conflicting course exists in that case.
'''
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_parent_location(self, location, **kwargs):
@@ -965,7 +965,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
Find the location that is the parent of this location in this
course. Needed for path_to_location().
'''
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_orphans(self, course_key, **kwargs):
@@ -974,7 +974,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
usually orphaned. NOTE: may include xblocks which still have references via xblocks which don't
use children to point to their dependents.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_errored_courses(self):
@@ -982,7 +982,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
Return a dictionary of course_dir -> [(msg, exception_str)], for each
course_dir where course loading failed.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_modulestore_type(self, course_id):
@@ -990,7 +990,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
Returns a type which identifies which modulestore is servicing the given
course_id. The return can be either "xml" (for XML based courses) or "mongo" for MongoDB backed courses
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_courses_for_wiki(self, wiki_slug, **kwargs):
@@ -999,21 +999,21 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
:param wiki_slug: the course wiki root slug
:return: list of course keys
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def has_published_version(self, xblock):
"""
Returns true if this xblock exists in the published course regardless of whether it's up to date
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def close_connections(self):
"""
Closes any open connections to the underlying databases
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@contextmanager
def bulk_operations(self, course_id, emit_signals=True, ignore_case=False): # pylint: disable=unused-argument
@@ -1030,7 +1030,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
This method is intended for use by tests and administrative commands, and not
to be run during server startup.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreAssetWriteInterface)):
@@ -1053,7 +1053,7 @@ class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreA
:raises VersionConflictError: if org, course, run, and version_guid given and the current
version head != version_guid and force is not True. (only applicable to version tracking stores)
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def delete_item(self, location, user_id, **kwargs):
@@ -1072,7 +1072,7 @@ class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreA
:raises VersionConflictError: if org, course, run, and version_guid given and the current
version head != version_guid and force is not True. (only applicable to version tracking stores)
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def create_course(self, org, course, run, user_id, fields=None, **kwargs):
@@ -1089,7 +1089,7 @@ class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreA
Returns: a CourseDescriptor
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def create_item(self, user_id, course_key, block_type, block_id=None, fields=None, **kwargs):
@@ -1108,7 +1108,7 @@ class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreA
fields (dict): A dictionary specifying initial values for some or all fields
in the newly created block
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def clone_course(self, source_course_id, dest_course_id, user_id, fields=None):
@@ -1125,7 +1125,7 @@ class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreA
ItemNotFoundError: if the source course doesn't exist (or any of its xblocks aren't found)
DuplicateItemError: if the destination course already exists (with content in some cases)
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def delete_course(self, course_key, user_id, **kwargs):
@@ -1137,7 +1137,7 @@ class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreA
course_key (CourseKey): which course to delete
user_id: id of the user deleting the course
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def _drop_database(self, database=True, collections=True, connections=True):
@@ -1152,7 +1152,7 @@ class ModuleStoreWrite(six.with_metaclass(ABCMeta, ModuleStoreRead, ModuleStoreA
If connections is True, then close the connection to the database as well.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
# pylint: disable=abstract-method
@@ -1163,18 +1163,18 @@ class ModuleStoreReadBase(BulkOperationsMixin, ModuleStoreRead):
def __init__(
self,
contentstore=None,
- doc_store_config=None, # ignore if passed up
+ doc_store_config=None, # ignore if passed up # lint-amnesty, pylint: disable=unused-argument
metadata_inheritance_cache_subsystem=None, request_cache=None,
- xblock_mixins=(), xblock_select=None, xblock_field_data_wrappers=(), disabled_xblock_types=lambda: [], # pylint: disable=bad-continuation
+ xblock_mixins=(), xblock_select=None, xblock_field_data_wrappers=(), disabled_xblock_types=lambda: [], # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
# temporary parms to enable backward compatibility. remove once all envs migrated
- db=None, collection=None, host=None, port=None, tz_aware=True, user=None, password=None,
+ db=None, collection=None, host=None, port=None, tz_aware=True, user=None, password=None, # lint-amnesty, pylint: disable=unused-argument
# allow lower level init args to pass harmlessly
** kwargs
):
'''
Set up the error-tracking logic.
'''
- super(ModuleStoreReadBase, self).__init__(**kwargs)
+ super(ModuleStoreReadBase, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self._course_errors = defaultdict(make_error_tracker) # location -> ErrorLog
# TODO move the inheritance_cache_subsystem to classes which use it
self.metadata_inheritance_cache_subsystem = metadata_inheritance_cache_subsystem
@@ -1262,7 +1262,7 @@ class ModuleStoreReadBase(BulkOperationsMixin, ModuleStoreRead):
"""
if self.contentstore:
self.contentstore.close_connections()
- super(ModuleStoreReadBase, self).close_connections()
+ super(ModuleStoreReadBase, self).close_connections() # lint-amnesty, pylint: disable=super-with-arguments
@contextmanager
def default_store(self, store_type):
@@ -1280,7 +1280,7 @@ class ModuleStoreWriteBase(ModuleStoreReadBase, ModuleStoreWrite):
Implement interface functionality that can be shared.
'''
def __init__(self, contentstore, **kwargs):
- super(ModuleStoreWriteBase, self).__init__(contentstore=contentstore, **kwargs)
+ super(ModuleStoreWriteBase, self).__init__(contentstore=contentstore, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.mixologist = Mixologist(self.xblock_mixins)
def partition_fields_by_scope(self, category, fields):
@@ -1300,7 +1300,7 @@ class ModuleStoreWriteBase(ModuleStoreReadBase, ModuleStoreWrite):
result[field.scope][field_name] = value
return result
- def create_course(self, org, course, run, user_id, fields=None, runtime=None, **kwargs):
+ def create_course(self, org, course, run, user_id, fields=None, runtime=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Creates any necessary other things for the course as a side effect and doesn't return
anything useful. The real subclass should call this before it returns the course.
@@ -1321,7 +1321,7 @@ class ModuleStoreWriteBase(ModuleStoreReadBase, ModuleStoreWrite):
continue_version=True,
)
- def clone_course(self, source_course_id, dest_course_id, user_id, fields=None, **kwargs):
+ def clone_course(self, source_course_id, dest_course_id, user_id, fields=None, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
This base method just copies the assets. The lower level impls must do the actual cloning of
content.
@@ -1340,7 +1340,7 @@ class ModuleStoreWriteBase(ModuleStoreReadBase, ModuleStoreWrite):
# delete the assets
if self.contentstore:
self.contentstore.delete_all_course_assets(course_key)
- super(ModuleStoreWriteBase, self).delete_course(course_key, user_id)
+ super(ModuleStoreWriteBase, self).delete_course(course_key, user_id) # lint-amnesty, pylint: disable=super-with-arguments
def _drop_database(self, database=True, collections=True, connections=True):
"""
@@ -1356,7 +1356,7 @@ class ModuleStoreWriteBase(ModuleStoreReadBase, ModuleStoreWrite):
"""
if self.contentstore:
self.contentstore._drop_database(database, collections, connections) # pylint: disable=protected-access
- super(ModuleStoreWriteBase, self)._drop_database(database, collections, connections)
+ super(ModuleStoreWriteBase, self)._drop_database(database, collections, connections) # lint-amnesty, pylint: disable=super-with-arguments
def create_child(self, user_id, parent_usage_key, block_type, block_id=None, fields=None, **kwargs):
"""
@@ -1374,7 +1374,7 @@ class ModuleStoreWriteBase(ModuleStoreReadBase, ModuleStoreWrite):
fields (dict): A dictionary specifying initial values for some or all fields
in the newly created block
"""
- item = self.create_item(user_id, parent_usage_key.course_key, block_type, block_id=block_id, fields=fields, **kwargs)
+ item = self.create_item(user_id, parent_usage_key.course_key, block_type, block_id=block_id, fields=fields, **kwargs) # lint-amnesty, pylint: disable=line-too-long
parent = self.get_item(parent_usage_key)
parent.children.append(item.location)
self.update_item(parent, user_id)
diff --git a/common/lib/xmodule/xmodule/modulestore/django.py b/common/lib/xmodule/xmodule/modulestore/django.py
index 6fd17a1c39..7ebdf0da23 100644
--- a/common/lib/xmodule/xmodule/modulestore/django.py
+++ b/common/lib/xmodule/xmodule/modulestore/django.py
@@ -10,7 +10,7 @@ import logging
import six
from pkg_resources import resource_filename
-import re
+import re # lint-amnesty, pylint: disable=wrong-import-order
from django.conf import settings
@@ -19,16 +19,16 @@ from django.conf import settings
if not settings.configured:
settings.configure()
-from django.core.cache import caches, InvalidCacheBackendError
-import django.dispatch
-import django.utils
-from django.utils.translation import get_language, to_locale
-from edx_django_utils.cache import DEFAULT_REQUEST_CACHE
+from django.core.cache import caches, InvalidCacheBackendError # lint-amnesty, pylint: disable=wrong-import-position
+import django.dispatch # lint-amnesty, pylint: disable=wrong-import-position
+import django.utils # lint-amnesty, pylint: disable=wrong-import-position
+from django.utils.translation import get_language, to_locale # lint-amnesty, pylint: disable=wrong-import-position
+from edx_django_utils.cache import DEFAULT_REQUEST_CACHE # lint-amnesty, pylint: disable=wrong-import-position
-from xmodule.contentstore.django import contentstore
-from xmodule.modulestore.draft_and_published import BranchSettingMixin
-from xmodule.modulestore.mixed import MixedModuleStore
-from xmodule.util.xmodule_django import get_current_request_hostname
+from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-position
+from xmodule.modulestore.draft_and_published import BranchSettingMixin # lint-amnesty, pylint: disable=wrong-import-position
+from xmodule.modulestore.mixed import MixedModuleStore # lint-amnesty, pylint: disable=wrong-import-position
+from xmodule.util.xmodule_django import get_current_request_hostname # lint-amnesty, pylint: disable=wrong-import-position
# We also may not always have the current request user (crum) module available
try:
@@ -68,7 +68,7 @@ class SwitchedSignal(django.dispatch.Signal):
All other args are passed to the constructor for django.dispatch.Signal.
"""
- super(SwitchedSignal, self).__init__(*args, **kwargs)
+ super(SwitchedSignal, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.name = name
self._allow_signals = True
@@ -103,7 +103,7 @@ class SwitchedSignal(django.dispatch.Signal):
"ALLOW" if self._allow_signals else "BLOCK"
)
if self._allow_signals:
- return super(SwitchedSignal, self).send(*args, **kwargs)
+ return super(SwitchedSignal, self).send(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
return []
def send_robust(self, *args, **kwargs):
@@ -121,7 +121,7 @@ class SwitchedSignal(django.dispatch.Signal):
"ALLOW" if self._allow_signals else "BLOCK"
)
if self._allow_signals:
- return super(SwitchedSignal, self).send_robust(*args, **kwargs)
+ return super(SwitchedSignal, self).send_robust(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
return []
def __repr__(self):
diff --git a/common/lib/xmodule/xmodule/modulestore/draft_and_published.py b/common/lib/xmodule/xmodule/modulestore/draft_and_published.py
index 8cd3a28d40..92bf0586ff 100644
--- a/common/lib/xmodule/xmodule/modulestore/draft_and_published.py
+++ b/common/lib/xmodule/xmodule/modulestore/draft_and_published.py
@@ -38,7 +38,7 @@ class BranchSettingMixin(object):
'branch_setting_func',
lambda: ModuleStoreEnum.Branch.published_only
)
- super(BranchSettingMixin, self).__init__(*args, **kwargs)
+ super(BranchSettingMixin, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
# cache the branch setting on a local thread to support a multi-threaded environment
self.thread_cache = threading.local()
@@ -209,4 +209,4 @@ class UnsupportedRevisionError(ValueError):
ModuleStoreEnum.RevisionOption.published_only,
ModuleStoreEnum.RevisionOption.draft_only
]
- super(UnsupportedRevisionError, self).__init__('revision not one of {}'.format(allowed_revisions))
+ super(UnsupportedRevisionError, self).__init__('revision not one of {}'.format(allowed_revisions)) # lint-amnesty, pylint: disable=super-with-arguments
diff --git a/common/lib/xmodule/xmodule/modulestore/edit_info.py b/common/lib/xmodule/xmodule/modulestore/edit_info.py
index aeb5314a00..471544d25b 100644
--- a/common/lib/xmodule/xmodule/modulestore/edit_info.py
+++ b/common/lib/xmodule/xmodule/modulestore/edit_info.py
@@ -66,39 +66,39 @@ class EditInfoRuntimeMixin(six.with_metaclass(ABCMeta, object)):
"""
The datetime of the last change to this xblock content, children, or settings.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_edited_on(self, xblock):
"""
The datetime of the last change to this xblock content, children, or settings.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_subtree_edited_by(self, xblock):
"""
The user id of the last user to change content, children, or settings in this xblock's subtree
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_subtree_edited_on(self, xblock):
"""
The datetime of the last change content, children, or settings in this xblock's subtree
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_published_by(self, xblock):
"""
The user id of the last user to publish this specific xblock (or a previous version of it).
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_published_on(self, xblock):
"""
The datetime of the last time this specific xblock was published.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
diff --git a/common/lib/xmodule/xmodule/modulestore/exceptions.py b/common/lib/xmodule/xmodule/modulestore/exceptions.py
index 5a77e66a01..79b1ec50c5 100644
--- a/common/lib/xmodule/xmodule/modulestore/exceptions.py
+++ b/common/lib/xmodule/xmodule/modulestore/exceptions.py
@@ -15,14 +15,14 @@ class MultipleCourseBlocksFound(Exception):
"""
Raise this exception when Iterating over the course blocks return multiple course blocks.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class MultipleLibraryBlocksFound(Exception):
"""
Raise this exception when Iterating over the library blocks return multiple library blocks.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class InsufficientSpecificationError(Exception):
@@ -47,7 +47,7 @@ class ReferentialIntegrityError(Exception):
xblock points to a nonexistent child (which probably raises ItemNotFoundError instead depending
on context).
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class DuplicateItemError(Exception):
@@ -55,7 +55,7 @@ class DuplicateItemError(Exception):
Attempted to create an item which already exists.
"""
def __init__(self, element_id, store=None, collection=None):
- super(DuplicateItemError, self).__init__()
+ super(DuplicateItemError, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.element_id = element_id
self.store = store
self.collection = collection
@@ -77,7 +77,7 @@ class VersionConflictError(Exception):
The caller asked for either draft or published head and gave a version which conflicted with it.
"""
def __init__(self, requestedLocation, currentHeadVersionGuid):
- super(VersionConflictError, self).__init__(u'Requested {}, but current head is {}'.format(
+ super(VersionConflictError, self).__init__(u'Requested {}, but current head is {}'.format( # lint-amnesty, pylint: disable=super-with-arguments
requestedLocation,
currentHeadVersionGuid
))
@@ -91,7 +91,7 @@ class DuplicateCourseError(Exception):
"""
existing_entry will have the who, when, and other properties of the existing entry
"""
- super(DuplicateCourseError, self).__init__(
+ super(DuplicateCourseError, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
u'Cannot create course {}, which duplicates {}'.format(course_id, existing_entry)
)
self.course_id = course_id
@@ -103,6 +103,6 @@ class InvalidBranchSetting(Exception):
Raised when the process' branch setting did not match the required setting for the attempted operation on a store.
"""
def __init__(self, expected_setting, actual_setting):
- super(InvalidBranchSetting, self).__init__(u"Invalid branch: expected {} but got {}".format(expected_setting, actual_setting))
+ super(InvalidBranchSetting, self).__init__(u"Invalid branch: expected {} but got {}".format(expected_setting, actual_setting)) # lint-amnesty, pylint: disable=line-too-long, super-with-arguments
self.expected_setting = expected_setting
self.actual_setting = actual_setting
diff --git a/common/lib/xmodule/xmodule/modulestore/inheritance.py b/common/lib/xmodule/xmodule/modulestore/inheritance.py
index 107c25f007..4c3e34f44c 100644
--- a/common/lib/xmodule/xmodule/modulestore/inheritance.py
+++ b/common/lib/xmodule/xmodule/modulestore/inheritance.py
@@ -20,10 +20,10 @@ _ = lambda text: text
class UserPartitionList(List):
"""Special List class for listing UserPartitions"""
- def from_json(self, values):
+ def from_json(self, values): # lint-amnesty, pylint: disable=arguments-differ
return [UserPartition.from_json(v) for v in values]
- def to_json(self, values):
+ def to_json(self, values): # lint-amnesty, pylint: disable=arguments-differ
return [user_partition.to_json()
for user_partition in values]
@@ -124,19 +124,19 @@ class InheritanceMixin(XBlockMixin):
)
static_asset_path = String(
display_name=_("Static Asset Path"),
- help=_("Enter the path to use for files on the Files & Uploads page. This value overrides the Studio default, c4x://."),
+ help=_("Enter the path to use for files on the Files & Uploads page. This value overrides the Studio default, c4x://."), # lint-amnesty, pylint: disable=line-too-long
scope=Scope.settings,
default='',
)
use_latex_compiler = Boolean(
display_name=_("Enable LaTeX Compiler"),
- help=_("Enter true or false. If true, you can use the LaTeX templates for HTML components and advanced Problem components."),
+ help=_("Enter true or false. If true, you can use the LaTeX templates for HTML components and advanced Problem components."), # lint-amnesty, pylint: disable=line-too-long
default=False,
scope=Scope.settings
)
max_attempts = Integer(
display_name=_("Maximum Attempts"),
- help=_("Enter the maximum number of times a student can try to answer problems. By default, Maximum Attempts is set to null, meaning that students have an unlimited number of attempts for problems. You can override this course-wide setting for individual problems. However, if the course-wide setting is a specific number, you cannot set the Maximum Attempts for individual problems to unlimited."),
+ help=_("Enter the maximum number of times a student can try to answer problems. By default, Maximum Attempts is set to null, meaning that students have an unlimited number of attempts for problems. You can override this course-wide setting for individual problems. However, if the course-wide setting is a specific number, you cannot set the Maximum Attempts for individual problems to unlimited."), # lint-amnesty, pylint: disable=line-too-long
values={"min": 0}, scope=Scope.settings
)
matlab_api_key = String(
@@ -165,7 +165,7 @@ class InheritanceMixin(XBlockMixin):
video_auto_advance = Boolean(
display_name=_("Enable video auto-advance"),
help=_(
- "Specify whether to show an auto-advance button in videos. If the student clicks it, when the last video in a unit finishes it will automatically move to the next unit and autoplay the first video."
+ "Specify whether to show an auto-advance button in videos. If the student clicks it, when the last video in a unit finishes it will automatically move to the next unit and autoplay the first video." # lint-amnesty, pylint: disable=line-too-long
),
scope=Scope.settings,
default=False
@@ -276,7 +276,7 @@ def compute_inherited_metadata(descriptor):
if descriptor.has_children:
parent_metadata = descriptor.xblock_kvs.inherited_settings.copy()
# add any of descriptor's explicitly set fields to the inheriting list
- for field in InheritanceMixin.fields.values():
+ for field in InheritanceMixin.fields.values(): # lint-amnesty, pylint: disable=no-member
if field.is_set_on(descriptor):
# inherited_settings values are json repr
parent_metadata[field.name] = field.read_json(descriptor)
@@ -318,7 +318,7 @@ class InheritingFieldData(KvsFieldData):
parents.
"""
- super(InheritingFieldData, self).__init__(**kwargs)
+ super(InheritingFieldData, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.inheritable_names = set(inheritable_names)
def has_default_value(self, name):
@@ -349,20 +349,20 @@ class InheritingFieldData(KvsFieldData):
if ancestor and \
ancestor.location.block_type == 'library_content' and \
self.has_default_value(name):
- return super(InheritingFieldData, self).default(block, name)
+ return super(InheritingFieldData, self).default(block, name) # lint-amnesty, pylint: disable=super-with-arguments
while ancestor is not None:
if field.is_set_on(ancestor):
return field.read_json(ancestor)
else:
ancestor = ancestor.get_parent()
- return super(InheritingFieldData, self).default(block, name)
+ return super(InheritingFieldData, self).default(block, name) # lint-amnesty, pylint: disable=super-with-arguments
def inheriting_field_data(kvs):
"""Create an InheritanceFieldData that inherits the names in InheritanceMixin."""
return InheritingFieldData(
- inheritable_names=InheritanceMixin.fields.keys(),
+ inheritable_names=InheritanceMixin.fields.keys(), # lint-amnesty, pylint: disable=no-member
kvs=kvs,
)
@@ -375,7 +375,7 @@ class InheritanceKeyValueStore(KeyValueStore):
Note: inherited_settings is a dict of key to json values (internal xblock field repr)
"""
def __init__(self, initial_values=None, inherited_settings=None):
- super(InheritanceKeyValueStore, self).__init__()
+ super(InheritanceKeyValueStore, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.inherited_settings = inherited_settings or {}
self._fields = initial_values or {}
diff --git a/common/lib/xmodule/xmodule/modulestore/mixed.py b/common/lib/xmodule/xmodule/modulestore/mixed.py
index 9c4b06a433..0096edbfe2 100644
--- a/common/lib/xmodule/xmodule/modulestore/mixed.py
+++ b/common/lib/xmodule/xmodule/modulestore/mixed.py
@@ -29,7 +29,7 @@ new_contract('AssetKey', AssetKey)
new_contract('AssetMetadata', AssetMetadata)
new_contract('LibraryLocator', LibraryLocator)
if six.PY2:
- new_contract('long', long)
+ new_contract('long', long) # lint-amnesty, pylint: disable=undefined-variable
else:
new_contract('long', int)
@@ -154,7 +154,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
Initialize a MixedModuleStore. Here we look into our passed in kwargs which should be a
collection of other modulestore configuration information
"""
- super(MixedModuleStore, self).__init__(contentstore, **kwargs)
+ super(MixedModuleStore, self).__init__(contentstore, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
if create_modulestore_instance is None:
raise ValueError('MixedModuleStore constructor must be passed a create_modulestore_instance function')
@@ -253,7 +253,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return store.has_item(usage_key, **kwargs)
@strip_key
- def get_item(self, usage_key, depth=0, **kwargs):
+ def get_item(self, usage_key, depth=0, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
see parent doc
"""
@@ -261,7 +261,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return store.get_item(usage_key, depth, **kwargs)
@strip_key
- def get_items(self, course_key, **kwargs):
+ def get_items(self, course_key, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns:
list of XModuleDescriptor instances for the matching items within the course with
@@ -404,7 +404,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return store.make_course_usage_key(course_key)
@strip_key
- def get_course(self, course_key, depth=0, **kwargs):
+ def get_course(self, course_key, depth=0, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
returns the course module associated with the course_id. If no such course exists,
it returns None
@@ -452,7 +452,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
store = self._get_modulestore_for_courselike(course_id)
return store.has_course(course_id, ignore_case, **kwargs)
- def delete_course(self, course_key, user_id):
+ def delete_course(self, course_key, user_id): # lint-amnesty, pylint: disable=arguments-differ
"""
See xmodule.modulestore.__init__.ModuleStoreWrite.delete_course
"""
@@ -593,7 +593,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return store.set_asset_metadata_attrs(asset_key, {attr: value}, user_id)
@contract(asset_key='AssetKey', attr_dict=dict, user_id='int|long')
- def set_asset_metadata_attrs(self, asset_key, attr_dict, user_id):
+ def set_asset_metadata_attrs(self, asset_key, attr_dict, user_id): # lint-amnesty, pylint: disable=arguments-differ
"""
Add/set the given dict of attrs on the asset at the given location. Value can be any type which pymongo accepts.
@@ -610,7 +610,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return store.set_asset_metadata_attrs(asset_key, attr_dict, user_id)
@strip_key
- def get_parent_location(self, location, **kwargs):
+ def get_parent_location(self, location, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
returns the parent locations for a given location
"""
@@ -660,7 +660,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return errs
@strip_key
- def create_course(self, org, course, run, user_id, **kwargs):
+ def create_course(self, org, course, run, user_id, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Creates and returns the course.
@@ -745,7 +745,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
dest_course_id.course, dest_course_id.run, fields, **kwargs)
# the super handles assets and any other necessities
- super(MixedModuleStore, self).clone_course(source_course_id, dest_course_id, user_id, fields, **kwargs)
+ super(MixedModuleStore, self).clone_course(source_course_id, dest_course_id, user_id, fields, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
else:
raise NotImplementedError("No code for cloning from {} to {}".format(
source_modulestore, dest_modulestore
@@ -791,7 +791,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
in the newly created block
"""
modulestore = self._verify_modulestore_support(parent_usage_key.course_key, 'create_child')
- return modulestore.create_child(user_id, parent_usage_key, block_type, block_id=block_id, fields=fields, **kwargs)
+ return modulestore.create_child(user_id, parent_usage_key, block_type, block_id=block_id, fields=fields, **kwargs) # lint-amnesty, pylint: disable=line-too-long
@strip_key
@prepare_asides
@@ -805,7 +805,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return store.import_xblock(user_id, course_key, block_type, block_id, fields, runtime, **kwargs)
@strip_key
- def copy_from_template(self, source_keys, dest_key, user_id, **kwargs):
+ def copy_from_template(self, source_keys, dest_key, user_id, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
See :py:meth `SplitMongoModuleStore.copy_from_template`
"""
@@ -814,7 +814,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
@strip_key
@prepare_asides
- def update_item(self, xblock, user_id, allow_not_found=False, **kwargs):
+ def update_item(self, xblock, user_id, allow_not_found=False, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Update the xblock persisted to be the same as the given for all types of fields
(content, children, and metadata) attribute the change to the given user.
@@ -823,7 +823,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
return store.update_item(xblock, user_id, allow_not_found, **kwargs)
@strip_key
- def delete_item(self, location, user_id, **kwargs):
+ def delete_item(self, location, user_id, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Delete the given item from persistence. kwargs allow modulestore specific parameters.
"""
diff --git a/common/lib/xmodule/xmodule/modulestore/modulestore_settings.py b/common/lib/xmodule/xmodule/modulestore/modulestore_settings.py
index 3ce3b5234f..5f9aa72df1 100644
--- a/common/lib/xmodule/xmodule/modulestore/modulestore_settings.py
+++ b/common/lib/xmodule/xmodule/modulestore/modulestore_settings.py
@@ -1,5 +1,5 @@
"""
-This file contains helper functions for configuring module_store_setting settings and support for backward compatibility with older formats.
+This file contains helper functions for configuring module_store_setting settings and support for backward compatibility with older formats. # lint-amnesty, pylint: disable=line-too-long
"""
@@ -112,10 +112,10 @@ def update_module_store_settings(
"""
for store in module_store_setting['default']['OPTIONS']['stores']:
if store['NAME'] == 'xml':
- xml_store_options and store['OPTIONS'].update(xml_store_options)
+ xml_store_options and store['OPTIONS'].update(xml_store_options) # lint-amnesty, pylint: disable=expression-not-assigned
else:
- module_store_options and store['OPTIONS'].update(module_store_options)
- doc_store_settings and store['DOC_STORE_CONFIG'].update(doc_store_settings)
+ module_store_options and store['OPTIONS'].update(module_store_options) # lint-amnesty, pylint: disable=expression-not-assigned
+ doc_store_settings and store['DOC_STORE_CONFIG'].update(doc_store_settings) # lint-amnesty, pylint: disable=expression-not-assigned
if default_store:
mixed_stores = get_mixed_stores(module_store_setting)
diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/base.py b/common/lib/xmodule/xmodule/modulestore/mongo/base.py
index ded0ad545f..84d08e4028 100644
--- a/common/lib/xmodule/xmodule/modulestore/mongo/base.py
+++ b/common/lib/xmodule/xmodule/modulestore/mongo/base.py
@@ -59,7 +59,7 @@ new_contract('CourseKey', CourseKey)
new_contract('AssetKey', AssetKey)
new_contract('AssetMetadata', AssetMetadata)
if six.PY2:
- new_contract('long', long)
+ new_contract('long', long) # lint-amnesty, pylint: disable=undefined-variable
else:
new_contract('long', int)
new_contract('BlockUsageLocator', BlockUsageLocator)
@@ -95,7 +95,7 @@ class InvalidWriteError(Exception):
Raised to indicate that writing to a particular key
in the KeyValueStore is disabled
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class MongoKeyValueStore(InheritanceKeyValueStore):
@@ -104,7 +104,7 @@ class MongoKeyValueStore(InheritanceKeyValueStore):
known to the MongoModuleStore (data, children, and metadata)
"""
def __init__(self, data, parent, children, metadata):
- super(MongoKeyValueStore, self).__init__()
+ super(MongoKeyValueStore, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
if not isinstance(data, dict):
self._data = {'data': data}
else:
@@ -176,7 +176,7 @@ class MongoKeyValueStore(InheritanceKeyValueStore):
)
-class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
+class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin): # lint-amnesty, pylint: disable=abstract-method
"""
A system that has a cache of module json that it will use to load modules
from, with a backup of calling to the underlying modulestore for more data
@@ -214,7 +214,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
id_manager = CourseLocationManager(course_key)
kwargs.setdefault('id_reader', id_manager)
kwargs.setdefault('id_generator', id_manager)
- super(CachingDescriptorSystem, self).__init__(
+ super(CachingDescriptorSystem, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
field_data=None,
load_item=self.load_item,
**kwargs
@@ -228,7 +228,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
self.course_id = course_key
self.cached_metadata = cached_metadata
- def load_item(self, location, for_parent=None):
+ def load_item(self, location, for_parent=None): # lint-amnesty, pylint: disable=method-hidden
"""
Return an XModule instance for the specified location
"""
@@ -344,7 +344,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
key = UsageKey.from_string(ref_string)
return key.replace(run=self.modulestore.fill_in_run(key.course_key).run)
- def _convert_reference_fields_to_keys(self, class_, course_key, jsonfields):
+ def _convert_reference_fields_to_keys(self, class_, course_key, jsonfields): # lint-amnesty, pylint: disable=unused-argument
"""
Find all fields of type reference and convert the payload into UsageKeys
:param class_: the XBlock class
@@ -473,7 +473,7 @@ class MongoBulkOpsRecord(BulkOpsRecord):
Tracks whether there've been any writes per course and disables inheritance generation
"""
def __init__(self):
- super(MongoBulkOpsRecord, self).__init__()
+ super(MongoBulkOpsRecord, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.dirty = False
@@ -502,11 +502,11 @@ class MongoBulkOpsMixin(BulkOperationsMixin):
bulk_ops_record.dirty = False # brand spanking clean now
return dirty
- def _is_in_bulk_operation(self, course_id, ignore_case=False):
+ def _is_in_bulk_operation(self, course_id, ignore_case=False): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns whether a bulk operation is in progress for the given course.
"""
- return super(MongoBulkOpsMixin, self)._is_in_bulk_operation(
+ return super(MongoBulkOpsMixin, self)._is_in_bulk_operation( # lint-amnesty, pylint: disable=super-with-arguments
course_id.for_branch(None), ignore_case
)
@@ -555,7 +555,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
:param doc_store_config: must have a host, db, and collection entries. Other common entries: port, tz_aware.
"""
- super(MongoModuleStore, self).__init__(contentstore=contentstore, **kwargs)
+ super(MongoModuleStore, self).__init__(contentstore=contentstore, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
def do_connection(
db, collection, host, port=27017, tz_aware=True, user=None, password=None, asset_collection=None, **kwargs
@@ -617,7 +617,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
If connections is True, then close the connection to the database as well.
"""
# drop the assets
- super(MongoModuleStore, self)._drop_database(database, collections, connections)
+ super(MongoModuleStore, self)._drop_database(database, collections, connections) # lint-amnesty, pylint: disable=super-with-arguments
connection = self.collection.database.client
@@ -770,7 +770,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
course_id = self.fill_in_run(course_id)
if not force_refresh:
# see if we are first in the request cache (if present)
- if self.request_cache is not None and six.text_type(course_id) in self.request_cache.data.get('metadata_inheritance', {}):
+ if self.request_cache is not None and six.text_type(course_id) in self.request_cache.data.get('metadata_inheritance', {}): # lint-amnesty, pylint: disable=line-too-long
return self.request_cache.data['metadata_inheritance'][six.text_type(course_id)]
# then look in any caching subsystem (e.g. memcached)
@@ -1102,7 +1102,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
"""
return BlockUsageLocator(course_key, 'course', course_key.run)
- def get_course(self, course_key, depth=0, **kwargs):
+ def get_course(self, course_key, depth=0, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Get the course with the given courseid (org/course/run)
"""
@@ -1120,7 +1120,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
return None
@autoretry_read()
- def has_course(self, course_key, ignore_case=False, **kwargs):
+ def has_course(self, course_key, ignore_case=False, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns the course_id of the course if it was found, else None
Note: we return the course_id instead of a boolean here since the found course may have
@@ -1164,7 +1164,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
except ItemNotFoundError:
return False
- def get_item(self, usage_key, depth=0, using_descriptor_system=None, for_parent=None, **kwargs):
+ def get_item(self, usage_key, depth=0, using_descriptor_system=None, for_parent=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns an XModuleDescriptor instance for the item at location.
@@ -1214,7 +1214,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
])
@autoretry_read()
- def get_items(
+ def get_items( # lint-amnesty, pylint: disable=arguments-differ
self,
course_id,
settings=None,
@@ -1286,7 +1286,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
)
return modules
- def create_course(self, org, course, run, user_id, fields=None, **kwargs):
+ def create_course(self, org, course, run, user_id, fields=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Creates and returns the course.
@@ -1323,7 +1323,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
xblock = self.create_item(user_id, course_id, 'course', course_id.run, fields=fields, **kwargs)
# create any other necessary things as a side effect
- super(MongoModuleStore, self).create_course(
+ super(MongoModuleStore, self).create_course( # lint-amnesty, pylint: disable=super-with-arguments
org, course, run, user_id, runtime=xblock.runtime, **kwargs
)
@@ -1397,7 +1397,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
xmodule.save()
return xmodule
- def create_item(self, user_id, course_key, block_type, block_id=None, **kwargs):
+ def create_item(self, user_id, course_key, block_type, block_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Creates and saves a new item in a course.
@@ -1423,7 +1423,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
return xblock
- def create_child(self, user_id, parent_usage_key, block_type, block_id=None, **kwargs):
+ def create_child(self, user_id, parent_usage_key, block_type, block_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Creates and saves a new xblock that as a child of the specified block
@@ -1453,7 +1453,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
else:
parent.children.insert(kwargs.get('position'), xblock.location)
- self.update_item(parent, user_id, child_update=True)
+ self.update_item(parent, user_id, child_update=True) # lint-amnesty, pylint: disable=unexpected-keyword-arg
return xblock
@@ -1500,7 +1500,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
self._update_single_item(parent, update)
self._update_ancestors(parent, update)
- def update_item(self, xblock, user_id, allow_not_found=False, force=False, isPublish=False,
+ def update_item(self, xblock, user_id, allow_not_found=False, force=False, isPublish=False, # lint-amnesty, pylint: disable=arguments-differ
is_publish_root=True):
"""
Update the persisted version of xblock to reflect its current values.
@@ -1565,10 +1565,10 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
self.refresh_cached_metadata_inheritance_tree(xblock.scope_ids.usage_id.course_key, xblock.runtime)
# fire signal that we've written to DB
except ItemNotFoundError:
- if not allow_not_found:
+ if not allow_not_found: # lint-amnesty, pylint: disable=no-else-raise
raise
elif not self.has_course(course_key):
- raise ItemNotFoundError(course_key)
+ raise ItemNotFoundError(course_key) # lint-amnesty, pylint: disable=raise-missing-from
return xblock
@@ -1637,7 +1637,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
but does NOT return a version agnostic location.
'''
assert location.branch is None
- assert revision == ModuleStoreEnum.RevisionOption.published_only \
+ assert revision == ModuleStoreEnum.RevisionOption.published_only \ # lint-amnesty, pylint: disable=consider-using-in
or revision == ModuleStoreEnum.RevisionOption.draft_preferred
parent_cache = self._get_parent_cache(self.get_branch_setting())
@@ -1671,7 +1671,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
# no actual parent found
return cache_and_return(None)
- if len(non_orphan_parents) > 1:
+ if len(non_orphan_parents) > 1: # lint-amnesty, pylint: disable=no-else-raise
# should never have multiple PUBLISHED parents
raise ReferentialIntegrityError(
u"{} parents claim {}".format(len(parents), location)
@@ -1723,7 +1723,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
return parent
return None
- def get_modulestore_type(self, course_key=None):
+ def get_modulestore_type(self, course_key=None): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""
Returns an enumeration-like type reflecting the type of this modulestore per ModuleStoreEnum.Type
Args:
@@ -1810,7 +1810,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
doc_id = None if course_assets is None else course_assets['_id']
if course_assets is None:
# Check to see if the course is created in the course collection.
- if self.get_course(course_key) is None:
+ if self.get_course(course_key) is None: # lint-amnesty, pylint: disable=no-else-raise
raise ItemNotFoundError(course_key)
else:
# Course exists, so create matching assets document.
@@ -1910,7 +1910,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
self.asset_collection.insert_one(dest_assets)
@contract(asset_key='AssetKey', attr_dict=dict, user_id='int|long')
- def set_asset_metadata_attrs(self, asset_key, attr_dict, user_id):
+ def set_asset_metadata_attrs(self, asset_key, attr_dict, user_id): # lint-amnesty, pylint: disable=arguments-differ
"""
Add/set the given dict of attrs on the asset at the given location. Value can be any type which pymongo accepts.
@@ -1966,7 +1966,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
return 1
@contract(course_key='CourseKey', user_id='int|long')
- def delete_all_asset_metadata(self, course_key, user_id):
+ def delete_all_asset_metadata(self, course_key, user_id): # lint-amnesty, pylint: disable=unused-argument
"""
Delete all of the assets which use this course_key as an identifier.
@@ -1991,7 +1991,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
self.database.client.admin.command('ismaster')
return {ModuleStoreEnum.Type.mongo: True}
except pymongo.errors.ConnectionFailure:
- raise HeartbeatFailure("Can't connect to {}".format(self.database.name), 'mongo')
+ raise HeartbeatFailure("Can't connect to {}".format(self.database.name), 'mongo') # lint-amnesty, pylint: disable=raise-missing-from
def ensure_indexes(self):
"""
@@ -2028,7 +2028,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
def convert_to_draft(self, location, user_id):
raise NotImplementedError()
- def delete_item(self, location, user_id, **kwargs):
+ def delete_item(self, location, user_id, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
raise NotImplementedError()
def has_changes(self, xblock):
diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py
index a382b08feb..39966d4796 100644
--- a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+++ b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py
@@ -60,7 +60,7 @@ class DraftModuleStore(MongoModuleStore):
This module also includes functionality to promote DRAFT modules (and their children)
to published modules.
"""
- def get_item(self, usage_key, depth=0, revision=None, using_descriptor_system=None, **kwargs):
+ def get_item(self, usage_key, depth=0, revision=None, using_descriptor_system=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns an XModuleDescriptor instance for the item at usage_key.
@@ -94,13 +94,13 @@ class DraftModuleStore(MongoModuleStore):
is found at that usage_key
"""
def get_published():
- return wrap_draft(super(DraftModuleStore, self).get_item(
+ return wrap_draft(super(DraftModuleStore, self).get_item( # lint-amnesty, pylint: disable=super-with-arguments
usage_key, depth=depth, using_descriptor_system=using_descriptor_system,
for_parent=kwargs.get('for_parent'),
))
def get_draft():
- return wrap_draft(super(DraftModuleStore, self).get_item(
+ return wrap_draft(super(DraftModuleStore, self).get_item( # lint-amnesty, pylint: disable=super-with-arguments
as_draft(usage_key), depth=depth, using_descriptor_system=using_descriptor_system,
for_parent=kwargs.get('for_parent')
))
@@ -133,7 +133,7 @@ class DraftModuleStore(MongoModuleStore):
else:
raise UnsupportedRevisionError()
- def has_item(self, usage_key, revision=None):
+ def has_item(self, usage_key, revision=None): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns True if location exists in this ModuleStore.
@@ -143,13 +143,13 @@ class DraftModuleStore(MongoModuleStore):
ModuleStoreEnum.RevisionOption.draft_only - checks for the draft item only
None - uses the branch setting, as follows:
if branch setting is ModuleStoreEnum.Branch.published_only, checks for the published item only
- if branch setting is ModuleStoreEnum.Branch.draft_preferred, checks whether draft or published item exists
+ if branch setting is ModuleStoreEnum.Branch.draft_preferred, checks whether draft or published item exists # lint-amnesty, pylint: disable=line-too-long
"""
def has_published():
- return super(DraftModuleStore, self).has_item(usage_key)
+ return super(DraftModuleStore, self).has_item(usage_key) # lint-amnesty, pylint: disable=super-with-arguments
def has_draft():
- return super(DraftModuleStore, self).has_item(as_draft(usage_key))
+ return super(DraftModuleStore, self).has_item(as_draft(usage_key)) # lint-amnesty, pylint: disable=super-with-arguments
if revision == ModuleStoreEnum.RevisionOption.draft_only:
return has_draft()
@@ -165,7 +165,7 @@ class DraftModuleStore(MongoModuleStore):
else:
raise UnsupportedRevisionError()
- def delete_course(self, course_key, user_id):
+ def delete_course(self, course_key, user_id): # lint-amnesty, pylint: disable=arguments-differ
"""
:param course_key: which course to delete
:param user_id: id of the user deleting the course
@@ -173,7 +173,7 @@ class DraftModuleStore(MongoModuleStore):
# Note: does not need to inform the bulk mechanism since after the course is deleted,
# it can't calculate inheritance anyway. Nothing is there to be dirty.
# delete the assets
- super(DraftModuleStore, self).delete_course(course_key, user_id)
+ super(DraftModuleStore, self).delete_course(course_key, user_id) # lint-amnesty, pylint: disable=super-with-arguments
# delete all of the db records for the course
course_query = self._course_key_to_son(course_key)
@@ -206,7 +206,7 @@ class DraftModuleStore(MongoModuleStore):
)
# clone the assets
- super(DraftModuleStore, self).clone_course(source_course_id, dest_course_id, user_id, fields)
+ super(DraftModuleStore, self).clone_course(source_course_id, dest_course_id, user_id, fields) # lint-amnesty, pylint: disable=super-with-arguments
# get the whole old course
new_course = self.get_course(dest_course_id)
@@ -242,7 +242,7 @@ class DraftModuleStore(MongoModuleStore):
log.info("Cloning module %s to %s....", original_loc, module.location)
- if 'data' in module.fields and module.fields['data'].is_set_on(module) and isinstance(module.data, six.string_types):
+ if 'data' in module.fields and module.fields['data'].is_set_on(module) and isinstance(module.data, six.string_types): # lint-amnesty, pylint: disable=line-too-long
module.data = rewrite_nonportable_content_links(
original_loc.course_key, dest_course_id, module.data
)
@@ -282,7 +282,7 @@ class DraftModuleStore(MongoModuleStore):
# return only the parent(s) that satisfy the request
return [
- BlockUsageLocator._from_deprecated_son(parent['_id'], location.course_key.run)
+ BlockUsageLocator._from_deprecated_son(parent['_id'], location.course_key.run) # lint-amnesty, pylint: disable=protected-access
for parent in parents
if (
# return all versions of the parent if revision is ModuleStoreEnum.RevisionOption.all
@@ -319,9 +319,9 @@ class DraftModuleStore(MongoModuleStore):
revision = ModuleStoreEnum.RevisionOption.published_only \
if self.get_branch_setting() == ModuleStoreEnum.Branch.published_only \
else ModuleStoreEnum.RevisionOption.draft_preferred
- return super(DraftModuleStore, self).get_parent_location(location, revision, **kwargs)
+ return super(DraftModuleStore, self).get_parent_location(location, revision, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
- def create_xblock(self, runtime, course_key, block_type, block_id=None, fields=None, **kwargs):
+ def create_xblock(self, runtime, course_key, block_type, block_id=None, fields=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Create the new xmodule but don't save it. Returns the new module with a draft locator if
the category allows drafts. If the category does not allow drafts, just creates a published module.
@@ -332,13 +332,13 @@ class DraftModuleStore(MongoModuleStore):
:param runtime: if you already have an xmodule from the course, the xmodule.runtime value
:param fields: a dictionary of field names and values for the new xmodule
"""
- new_block = super(DraftModuleStore, self).create_xblock(
+ new_block = super(DraftModuleStore, self).create_xblock( # lint-amnesty, pylint: disable=super-with-arguments
runtime, course_key, block_type, block_id, fields, **kwargs
)
new_block.location = self.for_branch_setting(new_block.location)
return wrap_draft(new_block)
- def get_items(self, course_key, revision=None, **kwargs):
+ def get_items(self, course_key, revision=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Performance Note: This is generally a costly operation, but useful for wildcard searches.
@@ -360,7 +360,7 @@ class DraftModuleStore(MongoModuleStore):
returns either Draft or Published, preferring Draft items.
"""
def base_get_items(key_revision):
- return super(DraftModuleStore, self).get_items(course_key, key_revision=key_revision, **kwargs)
+ return super(DraftModuleStore, self).get_items(course_key, key_revision=key_revision, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
def draft_items():
return [wrap_draft(item) for item in base_get_items(MongoRevisionKey.draft)]
@@ -406,7 +406,7 @@ class DraftModuleStore(MongoModuleStore):
# get_item will wrap_draft so don't call it here (otherwise, it would override the is_draft attribute)
return self.get_item(location)
- def _convert_to_draft(self, location, user_id, delete_published=False, ignore_if_draft=False):
+ def _convert_to_draft(self, location, user_id, delete_published=False, ignore_if_draft=False): # lint-amnesty, pylint: disable=unused-argument
"""
Internal method with additional internal parameters to convert a subtree to draft.
@@ -451,7 +451,7 @@ class DraftModuleStore(MongoModuleStore):
except pymongo.errors.DuplicateKeyError:
# prevent re-creation of DRAFT versions, unless explicitly requested to ignore
if not ignore_if_draft:
- raise DuplicateItemError(item['_id'], self, 'collection')
+ raise DuplicateItemError(item['_id'], self, 'collection') # lint-amnesty, pylint: disable=raise-missing-from
# delete the old PUBLISHED version if requested
if delete_published:
@@ -463,8 +463,8 @@ class DraftModuleStore(MongoModuleStore):
# convert the subtree using the original item as the root
self._breadth_first(convert_item, [location])
- def update_item(
- self,
+ def update_item( # lint-amnesty, pylint: disable=arguments-differ
+ self, # lint-amnesty, pylint: disable=unused-argument
xblock,
user_id,
allow_not_found=False,
@@ -481,13 +481,13 @@ class DraftModuleStore(MongoModuleStore):
# if the revision is published, defer to base
if draft_loc.branch == MongoRevisionKey.published:
- item = super(DraftModuleStore, self).update_item(xblock, user_id, allow_not_found)
+ item = super(DraftModuleStore, self).update_item(xblock, user_id, allow_not_found) # lint-amnesty, pylint: disable=super-with-arguments
course_key = xblock.location.course_key
if isPublish or (item.category in DIRECT_ONLY_CATEGORIES and not child_update):
self._flag_publish_event(course_key)
return item
- if not super(DraftModuleStore, self).has_item(draft_loc):
+ if not super(DraftModuleStore, self).has_item(draft_loc): # lint-amnesty, pylint: disable=super-with-arguments
try:
# ignore any descendants which are already draft
self._convert_to_draft(xblock.location, user_id, ignore_if_draft=True)
@@ -499,10 +499,10 @@ class DraftModuleStore(MongoModuleStore):
raise
xblock.location = draft_loc
- super(DraftModuleStore, self).update_item(xblock, user_id, allow_not_found, isPublish=isPublish)
+ super(DraftModuleStore, self).update_item(xblock, user_id, allow_not_found, isPublish=isPublish) # lint-amnesty, pylint: disable=super-with-arguments
return wrap_draft(xblock)
- def delete_item(self, location, user_id, revision=None, **kwargs):
+ def delete_item(self, location, user_id, revision=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Delete an item from this modulestore.
The method determines which revisions to delete. It disconnects and deletes the subtree.
@@ -560,7 +560,7 @@ class DraftModuleStore(MongoModuleStore):
if self.collection.count_documents(query) > 1:
continue
- parent_block = super(DraftModuleStore, self).get_item(parent_location)
+ parent_block = super(DraftModuleStore, self).get_item(parent_location) # lint-amnesty, pylint: disable=super-with-arguments
parent_block.children.remove(location)
parent_block.location = parent_location # ensure the location is with the correct revision
self.update_item(parent_block, user_id, child_update=True)
@@ -667,7 +667,7 @@ class DraftModuleStore(MongoModuleStore):
# use this store's request_cache
request_cache_getter=lambda args, kwargs: args[1],
)
- def _cached_has_changes(self, request_cache, xblock):
+ def _cached_has_changes(self, request_cache, xblock): # lint-amnesty, pylint: disable=unused-argument
"""
Internal has_changes method that caches the result.
"""
@@ -684,7 +684,7 @@ class DraftModuleStore(MongoModuleStore):
else:
return False
- def publish(self, location, user_id, **kwargs):
+ def publish(self, location, user_id, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Publish the subtree rooted at location to the live course and remove the drafts.
Such publishing may cause the deletion of previously published but subsequently deleted
@@ -727,7 +727,7 @@ class DraftModuleStore(MongoModuleStore):
# try to find the originally PUBLISHED version, if it exists
try:
- original_published = super(DraftModuleStore, self).get_item(item_location)
+ original_published = super(DraftModuleStore, self).get_item(item_location) # lint-amnesty, pylint: disable=super-with-arguments
except ItemNotFoundError:
original_published = None
@@ -751,7 +751,7 @@ class DraftModuleStore(MongoModuleStore):
# update the published (not draft) item (ignoring that item is "draft"). The published
# may not exist; (if original_published is None); so, allow_not_found
- super(DraftModuleStore, self).update_item(
+ super(DraftModuleStore, self).update_item( # lint-amnesty, pylint: disable=super-with-arguments
item, user_id, isPublish=True, is_publish_root=is_root, allow_not_found=True
)
to_be_deleted.append(as_draft(item_location).to_deprecated_son())
@@ -771,7 +771,7 @@ class DraftModuleStore(MongoModuleStore):
return self.get_item(as_published(location))
- def unpublish(self, location, user_id, **kwargs):
+ def unpublish(self, location, user_id, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Turn the published version into a draft, removing the published version.
@@ -867,11 +867,11 @@ class DraftModuleStore(MongoModuleStore):
def _query_children_for_cache_children(self, course_key, items):
# first get non-draft in a round-trip
- to_process_non_drafts = super(DraftModuleStore, self)._query_children_for_cache_children(course_key, items)
+ to_process_non_drafts = super(DraftModuleStore, self)._query_children_for_cache_children(course_key, items) # lint-amnesty, pylint: disable=super-with-arguments
to_process_dict = {}
for non_draft in to_process_non_drafts:
- to_process_dict[BlockUsageLocator._from_deprecated_son(non_draft["_id"], course_key.run)] = non_draft
+ to_process_dict[BlockUsageLocator._from_deprecated_son(non_draft["_id"], course_key.run)] = non_draft # lint-amnesty, pylint: disable=protected-access
if self.get_branch_setting() == ModuleStoreEnum.Branch.draft_preferred:
# now query all draft content in another round-trip
@@ -888,7 +888,7 @@ class DraftModuleStore(MongoModuleStore):
# with the draft. This is because the semantics of the DraftStore is to
# always return the draft - if available
for draft in to_process_drafts:
- draft_loc = BlockUsageLocator._from_deprecated_son(draft["_id"], course_key.run)
+ draft_loc = BlockUsageLocator._from_deprecated_son(draft["_id"], course_key.run) # lint-amnesty, pylint: disable=protected-access
draft_as_non_draft_loc = as_published(draft_loc)
# does non-draft exist in the collection
diff --git a/common/lib/xmodule/xmodule/modulestore/mongoengine_fields.py b/common/lib/xmodule/xmodule/modulestore/mongoengine_fields.py
index 6c56355646..5e5e85309c 100644
--- a/common/lib/xmodule/xmodule/modulestore/mongoengine_fields.py
+++ b/common/lib/xmodule/xmodule/modulestore/mongoengine_fields.py
@@ -17,9 +17,9 @@ class CourseKeyField(mongoengine.StringField):
"""
def __init__(self, **kwargs):
# it'd be useful to add init args such as support_deprecated, force_deprecated
- super(CourseKeyField, self).__init__(**kwargs)
+ super(CourseKeyField, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
- def to_mongo(self, course_key):
+ def to_mongo(self, course_key): # lint-amnesty, pylint: disable=arguments-differ
"""
For now saves the course key in the deprecated form
"""
@@ -30,12 +30,12 @@ class CourseKeyField(mongoengine.StringField):
else:
return None
- def to_python(self, course_key):
+ def to_python(self, course_key): # lint-amnesty, pylint: disable=arguments-differ
"""
Deserialize to a CourseKey instance
"""
# calling super b/c it decodes utf (and doesn't have circularity of from_python)
- course_key = super(CourseKeyField, self).to_python(course_key)
+ course_key = super(CourseKeyField, self).to_python(course_key) # lint-amnesty, pylint: disable=super-with-arguments
assert isinstance(course_key, (type(None), six.string_types, CourseKey))
if course_key == '':
return None
@@ -47,9 +47,9 @@ class CourseKeyField(mongoengine.StringField):
def validate(self, value):
assert isinstance(value, (type(None), six.string_types, CourseKey))
if isinstance(value, CourseKey):
- return super(CourseKeyField, self).validate(text_type(value))
+ return super(CourseKeyField, self).validate(text_type(value)) # lint-amnesty, pylint: disable=super-with-arguments
else:
- return super(CourseKeyField, self).validate(value)
+ return super(CourseKeyField, self).validate(value) # lint-amnesty, pylint: disable=super-with-arguments
def prepare_query_value(self, _opt, value):
return self.to_mongo(value)
@@ -59,16 +59,16 @@ class UsageKeyField(mongoengine.StringField):
"""
Represent a UsageKey as a single string in Mongo
"""
- def to_mongo(self, location):
+ def to_mongo(self, location): # lint-amnesty, pylint: disable=arguments-differ
"""
For now saves the usage key in the deprecated location i4x/c4x form
"""
assert isinstance(location, (type(None), UsageKey))
if location is None:
return None
- return super(UsageKeyField, self).to_mongo(text_type(location))
+ return super(UsageKeyField, self).to_mongo(text_type(location)) # lint-amnesty, pylint: disable=super-with-arguments
- def to_python(self, location):
+ def to_python(self, location): # lint-amnesty, pylint: disable=arguments-differ
"""
Deserialize to a UsageKey instance: for now it's a location missing the run
"""
@@ -76,7 +76,7 @@ class UsageKeyField(mongoengine.StringField):
if location == '':
return None
if isinstance(location, six.string_types):
- location = super(UsageKeyField, self).to_python(location)
+ location = super(UsageKeyField, self).to_python(location) # lint-amnesty, pylint: disable=super-with-arguments
return Location.from_string(location)
else:
return location
@@ -84,9 +84,9 @@ class UsageKeyField(mongoengine.StringField):
def validate(self, value):
assert isinstance(value, (type(None), six.string_types, UsageKey))
if isinstance(value, UsageKey):
- return super(UsageKeyField, self).validate(text_type(value))
+ return super(UsageKeyField, self).validate(text_type(value)) # lint-amnesty, pylint: disable=super-with-arguments
else:
- return super(UsageKeyField, self).validate(value)
+ return super(UsageKeyField, self).validate(value) # lint-amnesty, pylint: disable=super-with-arguments
def prepare_query_value(self, _opt, value):
return self.to_mongo(value)
diff --git a/common/lib/xmodule/xmodule/modulestore/perf_tests/generate_report.py b/common/lib/xmodule/xmodule/modulestore/perf_tests/generate_report.py
index 6471c004ea..e67589c268 100644
--- a/common/lib/xmodule/xmodule/modulestore/perf_tests/generate_report.py
+++ b/common/lib/xmodule/xmodule/modulestore/perf_tests/generate_report.py
@@ -95,7 +95,7 @@ class ImportExportReportGen(ReportGenerator):
Class which generates report for course import/export performance test data.
"""
def __init__(self, db_name):
- super(ImportExportReportGen, self).__init__(db_name)
+ super(ImportExportReportGen, self).__init__(db_name) # lint-amnesty, pylint: disable=super-with-arguments
self._read_timing_data()
def _read_timing_data(self):
@@ -129,7 +129,7 @@ class ImportExportReportGen(ReportGenerator):
html = HTMLDocument("Results")
# Output comparison of each phase to a different table.
- for phase in self.run_data.keys():
+ for phase in self.run_data.keys(): # lint-amnesty, pylint: disable=consider-iterating-dictionary, too-many-nested-blocks
if phase in ('fake_assets',):
continue
per_phase = self.run_data[phase]
@@ -183,7 +183,7 @@ class FindReportGen(ReportGenerator):
Class which generates report for asset access performance test data.
"""
def __init__(self, db_name):
- super(FindReportGen, self).__init__(db_name)
+ super(FindReportGen, self).__init__(db_name) # lint-amnesty, pylint: disable=super-with-arguments
self._read_timing_data()
def _read_timing_data(self):
@@ -229,7 +229,7 @@ class FindReportGen(ReportGenerator):
# per_phase = self.run_data[store]
# html.add_header(1, store)
- for phase in self.run_data.keys():
+ for phase in self.run_data.keys(): # lint-amnesty, pylint: disable=consider-iterating-dictionary
per_phase = self.run_data[phase]
# Make the table header columns and the table.
diff --git a/common/lib/xmodule/xmodule/modulestore/perf_tests/test_asset_import_export.py b/common/lib/xmodule/xmodule/modulestore/perf_tests/test_asset_import_export.py
index f177ac01c8..1dc6a43e33 100644
--- a/common/lib/xmodule/xmodule/modulestore/perf_tests/test_asset_import_export.py
+++ b/common/lib/xmodule/xmodule/modulestore/perf_tests/test_asset_import_export.py
@@ -61,7 +61,7 @@ class CrossStoreXMLRoundtrip(unittest.TestCase):
perf_test = True
def setUp(self):
- super(CrossStoreXMLRoundtrip, self).setUp()
+ super(CrossStoreXMLRoundtrip, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.export_dir = mkdtemp()
self.addCleanup(rmtree, self.export_dir, ignore_errors=True)
@@ -75,7 +75,7 @@ class CrossStoreXMLRoundtrip(unittest.TestCase):
"""
Generate timings for different amounts of asset metadata and different modulestores.
"""
- if CodeBlockTimer is None:
+ if CodeBlockTimer is None: # lint-amnesty, pylint: disable=undefined-variable
pytest.skip("CodeBlockTimer undefined.")
desc = "XMLRoundTrip:{}->{}:{}".format(
@@ -84,9 +84,9 @@ class CrossStoreXMLRoundtrip(unittest.TestCase):
num_assets
)
- with CodeBlockTimer(desc):
+ with CodeBlockTimer(desc): # lint-amnesty, pylint: disable=undefined-variable
- with CodeBlockTimer("fake_assets"):
+ with CodeBlockTimer("fake_assets"): # lint-amnesty, pylint: disable=undefined-variable
# First, make the fake asset metadata.
make_asset_xml(num_assets, ASSET_XML_PATH)
validate_xml(ASSET_XSD_PATH, ASSET_XML_PATH)
@@ -96,7 +96,7 @@ class CrossStoreXMLRoundtrip(unittest.TestCase):
source_course_key = source_store.make_course_key('a', 'course', 'course')
dest_course_key = dest_store.make_course_key('a', 'course', 'course')
- with CodeBlockTimer("initial_import"):
+ with CodeBlockTimer("initial_import"): # lint-amnesty, pylint: disable=undefined-variable
import_course_from_xml(
source_store,
'test_user',
@@ -108,7 +108,7 @@ class CrossStoreXMLRoundtrip(unittest.TestCase):
raise_on_failure=True,
)
- with CodeBlockTimer("export"):
+ with CodeBlockTimer("export"): # lint-amnesty, pylint: disable=undefined-variable
export_course_to_xml(
source_store,
source_content,
@@ -117,7 +117,7 @@ class CrossStoreXMLRoundtrip(unittest.TestCase):
'exported_source_course',
)
- with CodeBlockTimer("second_import"):
+ with CodeBlockTimer("second_import"): # lint-amnesty, pylint: disable=undefined-variable
import_course_from_xml(
dest_store,
'test_user',
@@ -194,7 +194,7 @@ class TestModulestoreAssetSize(unittest.TestCase):
results = asset_collection.map_reduce(mapper, reducer, "size_results")
result_str = "{} - Store: {:<15} - Num Assets: {:>6} - Result: {}\n".format(
- self.test_run_time, SHORT_NAME_MAP[source_ms], num_assets, [r for r in results.find()]
+ self.test_run_time, SHORT_NAME_MAP[source_ms], num_assets, [r for r in results.find()] # lint-amnesty, pylint: disable=unnecessary-comprehension
)
with open("bson_sizes.txt", "a") as f:
f.write(result_str)
diff --git a/common/lib/xmodule/xmodule/modulestore/search.py b/common/lib/xmodule/xmodule/modulestore/search.py
index 872c8909d7..608a967a37 100644
--- a/common/lib/xmodule/xmodule/modulestore/search.py
+++ b/common/lib/xmodule/xmodule/modulestore/search.py
@@ -112,7 +112,7 @@ def path_to_location(modulestore, usage_key, request=None, full_path=False):
position_list = []
for path_index in range(2, n - 1):
category = path[path_index].block_type
- if category == 'sequential' or category == 'videosequence':
+ if category == 'sequential' or category == 'videosequence': # lint-amnesty, pylint: disable=consider-using-in
section_desc = modulestore.get_item(path[path_index])
# this calls get_children rather than just children b/c old mongo includes private children
# in children but not in get_children
@@ -151,7 +151,7 @@ def get_child_locations(section_desc, request, course_id):
"""
Return True if child is appendable based on request and request's user type.
"""
- return (request and is_user_staff_and_not_masquerading_learner()) or not child_instance.visible_to_staff_only
+ return (request and is_user_staff_and_not_masquerading_learner()) or not child_instance.visible_to_staff_only # lint-amnesty, pylint: disable=consider-using-ternary
child_locs = []
for child in section_desc.get_children():
diff --git a/common/lib/xmodule/xmodule/modulestore/split_migrator.py b/common/lib/xmodule/xmodule/modulestore/split_migrator.py
index 68af627aca..23b1fbc986 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_migrator.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_migrator.py
@@ -27,7 +27,7 @@ class SplitMigrator(object):
name will be able to find the new elements.
"""
def __init__(self, split_modulestore, source_modulestore):
- super(SplitMigrator, self).__init__()
+ super(SplitMigrator, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.split_modulestore = split_modulestore
self.source_modulestore = source_modulestore
@@ -50,7 +50,7 @@ class SplitMigrator(object):
# layer and kvs's know how to store it.
# locations are in location, children, conditionals, course.tab
- # create the course: set fields to explicitly_set for each scope, id_root = new_course_locator, master_branch = 'production'
+ # create the course: set fields to explicitly_set for each scope, id_root = new_course_locator, master_branch = 'production' # lint-amnesty, pylint: disable=line-too-long
original_course = self.source_modulestore.get_course(source_course_key, **kwargs)
if original_course is None:
raise ItemNotFoundError(six.text_type(source_course_key))
@@ -94,7 +94,7 @@ class SplitMigrator(object):
"""
course_version_locator = new_course.id.version_agnostic()
- # iterate over published course elements. Wildcarding rather than descending b/c some elements are orphaned (e.g.,
+ # iterate over published course elements. Wildcarding rather than descending b/c some elements are orphaned (e.g., # lint-amnesty, pylint: disable=line-too-long
# course about pages, conditionals)
for module in self.source_modulestore.get_items(
source_course_key, revision=ModuleStoreEnum.RevisionOption.published_only, **kwargs
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/__init__.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/__init__.py
index 47b772337d..abdf51d333 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/__init__.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/__init__.py
@@ -9,11 +9,11 @@ from contracts import check, contract
from opaque_keys.edx.locator import BlockUsageLocator
-class BlockKey(namedtuple('BlockKey', 'type id')):
+class BlockKey(namedtuple('BlockKey', 'type id')): # lint-amnesty, pylint: disable=missing-class-docstring
__slots__ = ()
@contract(type="string[>0]")
- def __new__(cls, type, id):
+ def __new__(cls, type, id): # lint-amnesty, pylint: disable=redefined-builtin
return super(BlockKey, cls).__new__(cls, type, id)
@classmethod
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
index 06a21feb9b..3b11d903aa 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import logging
import sys
@@ -37,7 +37,7 @@ new_contract('CourseEnvelope', CourseEnvelope)
new_contract('XBlock', XBlock)
-class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
+class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin): # lint-amnesty, pylint: disable=abstract-method
"""
A system that has a cache of a course version's json that it will use to load modules
from, with a backup of calling to the underlying modulestore for more data.
@@ -45,7 +45,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
Computes the settings (nee 'metadata') inheritance upon creation.
"""
@contract(course_entry=CourseEnvelope)
- def __init__(self, modulestore, course_entry, default_class, module_data, lazy, **kwargs):
+ def __init__(self, modulestore, course_entry, default_class, module_data, lazy, **kwargs): # lint-amnesty, pylint: disable=redefined-outer-name
"""
Computes the settings inheritance and sets up the cache.
@@ -61,7 +61,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
"""
# needed by capa_problem (as runtime.filestore via this.resources_fs)
if course_entry.course_key.course:
- root = modulestore.fs_root / course_entry.course_key.org / course_entry.course_key.course / course_entry.course_key.run
+ root = modulestore.fs_root / course_entry.course_key.org / course_entry.course_key.course / course_entry.course_key.run # lint-amnesty, pylint: disable=line-too-long
else:
root = modulestore.fs_root / str(course_entry.structure['_id'])
root.makedirs_p() # create directory if it doesn't exist
@@ -70,7 +70,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
kwargs.setdefault('id_reader', id_manager)
kwargs.setdefault('id_generator', id_manager)
- super(CachingDescriptorSystem, self).__init__(
+ super(CachingDescriptorSystem, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
field_data=None,
load_item=self._load_item,
resources_fs=OSFS(root),
@@ -89,7 +89,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
@lazy
@contract(returns="dict(BlockKey: BlockKey)")
- def _parent_map(self):
+ def _parent_map(self): # lint-amnesty, pylint: disable=missing-function-docstring
parent_map = {}
for block_key, block in six.iteritems(self.course_entry.structure['blocks']):
for child in block.fields.get('children', []):
@@ -114,7 +114,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
try:
return self.local_modules[usage_key]
except KeyError:
- raise ItemNotFoundError
+ raise ItemNotFoundError # lint-amnesty, pylint: disable=raise-missing-from
else:
block_key = BlockKey.from_usage_key(usage_key)
version_guid = self.course_entry.course_key.version_guid
@@ -292,13 +292,13 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
"""
See :meth: cms.lib.xblock.runtime.EditInfoRuntimeMixin.get_edited_by
"""
- return xblock._edited_by
+ return xblock._edited_by # lint-amnesty, pylint: disable=protected-access
def get_edited_on(self, xblock):
"""
See :class: cms.lib.xblock.runtime.EditInfoRuntimeMixin
"""
- return xblock._edited_on
+ return xblock._edited_on # lint-amnesty, pylint: disable=protected-access
@contract(xblock='XBlock')
def get_subtree_edited_by(self, xblock):
@@ -382,7 +382,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
if aside.scope_ids.block_type == aside_type:
return aside
- new_aside = super(CachingDescriptorSystem, self).get_aside_of_type(block, aside_type)
+ new_aside = super(CachingDescriptorSystem, self).get_aside_of_type(block, aside_type) # lint-amnesty, pylint: disable=super-with-arguments
new_aside._field_data = block._field_data # pylint: disable=protected-access
for key, _ in six.iteritems(new_aside.fields):
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/definition_lazy_loader.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/definition_lazy_loader.py
index 97551e2e7b..ff59544721 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/definition_lazy_loader.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/definition_lazy_loader.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import copy
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
index 413880e6ea..aaaa1037d1 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
@@ -130,11 +130,11 @@ class QueryTimer(object):
tagger = Tagger(self._sample_rate)
metric_name = "{}.{}".format(self._metric_base, metric_name)
- start = time()
+ start = time() # lint-amnesty, pylint: disable=unused-variable
try:
yield tagger
finally:
- end = time()
+ end = time() # lint-amnesty, pylint: disable=unused-variable
tags = tagger.tags
tags.append('course:{}'.format(course_context))
@@ -244,7 +244,7 @@ class CourseStructureCache(object):
return pickle.loads(pickled_data)
else:
return pickle.loads(pickled_data, encoding='latin-1')
- except Exception:
+ except Exception: # lint-amnesty, pylint: disable=broad-except
# The cached data is corrupt in some way, get rid of it.
log.warning("CourseStructureCache: Bad data in cache for %s", course_context)
self.cache.delete(key)
@@ -273,7 +273,7 @@ class MongoConnection(object):
"""
def __init__(
self, db, collection, host, port=27017, tz_aware=True, user=None, password=None,
- asset_collection=None, retry_wait_time=0.1, **kwargs
+ asset_collection=None, retry_wait_time=0.1, **kwargs # lint-amnesty, pylint: disable=unused-argument
):
"""
Create & open the connection, authenticate, and provide pointers to the collections
@@ -301,7 +301,7 @@ class MongoConnection(object):
self.database.client.admin.command('ismaster')
return True
except pymongo.errors.ConnectionFailure:
- raise HeartbeatFailure("Can't connect to {}".format(self.database.name), 'mongo')
+ raise HeartbeatFailure("Can't connect to {}".format(self.database.name), 'mongo') # lint-amnesty, pylint: disable=raise-missing-from
def get_structure(self, key, course_context=None):
"""
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
index 455c9568b6..d10494a74a 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
@@ -140,9 +140,9 @@ new_contract('BlockKey', BlockKey)
new_contract('XBlock', XBlock)
-class SplitBulkWriteRecord(BulkOpsRecord):
+class SplitBulkWriteRecord(BulkOpsRecord): # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self):
- super(SplitBulkWriteRecord, self).__init__()
+ super(SplitBulkWriteRecord, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.initial_index = None
self.index = None
self.structures = {}
@@ -228,7 +228,7 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
]
# handle ignore case and general use
- return super(SplitBulkWriteMixin, self)._get_bulk_ops_record(
+ return super(SplitBulkWriteMixin, self)._get_bulk_ops_record( # lint-amnesty, pylint: disable=super-with-arguments
course_key.replace(branch=None, version_guid=None), ignore_case
)
@@ -246,7 +246,7 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
course_key.replace(org=None, course=None, run=None, branch=None)
]
- def _start_outermost_bulk_operation(self, bulk_write_record, course_key, ignore_case=False):
+ def _start_outermost_bulk_operation(self, bulk_write_record, course_key, ignore_case=False): # lint-amnesty, pylint: disable=arguments-differ
"""
Begin a bulk write operation on course_key.
"""
@@ -255,7 +255,7 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
bulk_write_record.index = copy.deepcopy(bulk_write_record.initial_index)
bulk_write_record.course_key = course_key
- def _end_outermost_bulk_operation(self, bulk_write_record, structure_key):
+ def _end_outermost_bulk_operation(self, bulk_write_record, structure_key): # lint-amnesty, pylint: disable=arguments-differ
"""
End the active bulk write operation on structure_key (course or library key).
"""
@@ -317,7 +317,7 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
self.db_connection.delete_course_index(course_key)
- def insert_course_index(self, course_key, index_entry):
+ def insert_course_index(self, course_key, index_entry): # lint-amnesty, pylint: disable=missing-function-docstring
bulk_write_record = self._get_bulk_ops_record(course_key)
if bulk_write_record.active:
bulk_write_record.index = index_entry
@@ -338,7 +338,7 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
else:
self.db_connection.update_course_index(updated_index_entry, course_context=course_key)
- def get_structure(self, course_key, version_guid):
+ def get_structure(self, course_key, version_guid): # lint-amnesty, pylint: disable=missing-function-docstring
bulk_write_record = self._get_bulk_ops_record(course_key)
if bulk_write_record.active:
structure = bulk_write_record.structures.get(version_guid)
@@ -450,7 +450,7 @@ class SplitBulkWriteMixin(BulkOperationsMixin):
ids.remove(definition_id)
definitions.append(definition)
- if len(ids):
+ if len(ids): # lint-amnesty, pylint: disable=len-as-condition
# Query the db for the definitions.
defs_from_db = list(self.db_connection.get_definitions(list(ids), course_key))
defs_dict = {d.get('_id'): d for d in defs_from_db}
@@ -718,7 +718,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
:param doc_store_config: must have a host, db, and collection entries. Other common entries: port, tz_aware.
"""
- super(SplitMongoModuleStore, self).__init__(contentstore, **kwargs)
+ super(SplitMongoModuleStore, self).__init__(contentstore, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.db_connection = MongoConnection(**doc_store_config)
@@ -765,7 +765,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
If connections is True, then close the connection to the database as well.
"""
# drop the assets
- super(SplitMongoModuleStore, self)._drop_database(database, collections, connections)
+ super(SplitMongoModuleStore, self)._drop_database(database, collections, connections) # lint-amnesty, pylint: disable=super-with-arguments
self.db_connection._drop_database(database, collections, connections) # pylint: disable=protected-access
@@ -1014,7 +1014,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
)
@autoretry_read()
- def get_courses(self, branch, **kwargs):
+ def get_courses(self, branch, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns a list of course descriptors matching any given qualifiers.
@@ -1188,9 +1188,9 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
return False
course_index = self.get_course_index(course_id, ignore_case)
- return CourseLocator(course_index['org'], course_index['course'], course_index['run'], course_id.branch) if course_index else None
+ return CourseLocator(course_index['org'], course_index['course'], course_index['run'], course_id.branch) if course_index else None # lint-amnesty, pylint: disable=line-too-long
- def has_library(self, library_id, ignore_case=False, **kwargs):
+ def has_library(self, library_id, ignore_case=False, **kwargs): # lint-amnesty, pylint: disable=unused-argument
"""
Does this library exist in this modulestore. This method does not verify that the branch &/or
version in the library_id exists.
@@ -1226,7 +1226,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
return self._get_block_from_structure(course_structure, BlockKey.from_usage_key(usage_key)) is not None
@contract(returns='XBlock')
- def get_item(self, usage_key, depth=0, **kwargs):
+ def get_item(self, usage_key, depth=0, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
depth (int): An argument that some module stores may use to prefetch
descendants of the queried modules for more efficient results later
@@ -1242,13 +1242,13 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
with self.bulk_operations(usage_key.course_key):
course = self._lookup_course(usage_key.course_key)
items = self._load_items(course, [BlockKey.from_usage_key(usage_key)], depth, **kwargs)
- if len(items) == 0:
+ if len(items) == 0: # lint-amnesty, pylint: disable=no-else-raise
raise ItemNotFoundError(usage_key)
elif len(items) > 1:
log.debug("Found more than one item for '{}'".format(usage_key))
return items[0]
- def get_items(self, course_locator, settings=None, content=None, qualifiers=None, include_orphans=True, **kwargs):
+ def get_items(self, course_locator, settings=None, content=None, qualifiers=None, include_orphans=True, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns:
list of XModuleDescriptor instances for the matching items within the course with
@@ -1287,7 +1287,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
Check that the block matches all the criteria
"""
# do the checks which don't require loading any additional data
- if ( # pylint: disable=bad-continuation
+ if ( # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
self._block_matches(block_data, qualifiers) and
self._block_matches(block_data.fields, settings)
):
@@ -1337,7 +1337,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
for block_id, value in six.iteritems(course.structure['blocks']):
if _block_matches_all(value):
if not include_orphans:
- if ( # pylint: disable=bad-continuation
+ if ( # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
block_id.type in DETACHED_XBLOCK_TYPES or
self.has_path_to_root(block_id, course, path_cache, parents_cache)
):
@@ -1405,7 +1405,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
return has_path
- def get_parent_location(self, locator, **kwargs):
+ def get_parent_location(self, locator, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Return the location (Locators w/ block_ids) for the parent of this location in this
course. Could use get_items(location, {'children': block_id}) but this is slightly faster.
@@ -1551,13 +1551,13 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# and reconstruct the subtree from version_guid
next_entries = self.find_structures_derived_from([version_guid])
# must only scan cursor's once
- next_versions = [struct for struct in next_entries]
+ next_versions = [struct for struct in next_entries] # lint-amnesty, pylint: disable=unnecessary-comprehension
result = {version_guid: [CourseLocator(version_guid=struct['_id']) for struct in next_versions]}
depth = 1
while depth < version_history_depth and len(next_versions) > 0:
depth += 1
next_entries = self.find_structures_derived_from([struct['_id'] for struct in next_versions])
- next_versions = [struct for struct in next_entries]
+ next_versions = [struct for struct in next_entries] # lint-amnesty, pylint: disable=unnecessary-comprehension
for course_structure in next_versions:
result.setdefault(course_structure['previous_version'], []).append(
CourseLocator(version_guid=next_entries[-1]['_id']))
@@ -1620,7 +1620,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
Find the version_history_depth next versions of this definition. Return as a VersionTree
"""
# TODO implement
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
def get_block_original_usage(self, usage_key):
"""
@@ -1726,7 +1726,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
serial += 1
@contract(returns='XBlock')
- def create_item(self, user_id, course_key, block_type, block_id=None, definition_locator=None, fields=None,
+ def create_item(self, user_id, course_key, block_type, block_id=None, definition_locator=None, fields=None, # lint-amnesty, pylint: disable=arguments-differ
asides=None, force=False, **kwargs):
"""
Add a descriptor to persistence as an element
@@ -1764,7 +1764,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
specify version_guid or the one it specifies == the current head of the branch,
it progresses the course to point
to the new head and sets the active version to point to the new head
- * If the locator has a org and course and run but its version_guid != current head, it raises VersionConflictError.
+ * If the locator has a org and course and run but its version_guid != current head, it raises VersionConflictError. # lint-amnesty, pylint: disable=line-too-long
NOTE: using a version_guid will end up creating a new version of the course. Your new item won't be in
the course id'd by version_guid but instead in one w/ a new version_guid. Ensure in this case that you get
@@ -1790,7 +1790,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
if definition_locator is None or isinstance(definition_locator.definition_id, LocalId):
definition_locator = self.create_definition_from_data(course_key, new_def_data, block_type, user_id)
elif new_def_data:
- definition_locator, _ = self.update_definition_from_data(course_key, definition_locator, new_def_data, user_id)
+ definition_locator, _ = self.update_definition_from_data(course_key, definition_locator, new_def_data, user_id) # lint-amnesty, pylint: disable=line-too-long
# copy the structure and modify the new one
new_structure = self.version_structure(course_key, structure, user_id)
@@ -1843,7 +1843,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# reconstruct the new_item from the cache
return self.get_item(item_loc)
- def create_child(self, user_id, parent_usage_key, block_type, block_id=None, fields=None, asides=None, **kwargs):
+ def create_child(self, user_id, parent_usage_key, block_type, block_id=None, fields=None, asides=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Creates and saves a new xblock that as a child of the specified block
@@ -1923,13 +1923,13 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
**kwargs
)
# don't copy assets until we create the course in case something's awry
- super(SplitMongoModuleStore, self).clone_course(source_course_id, dest_course_id, user_id, fields, **kwargs)
+ super(SplitMongoModuleStore, self).clone_course(source_course_id, dest_course_id, user_id, fields, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
return new_course
DEFAULT_ROOT_COURSE_BLOCK_ID = 'course'
DEFAULT_ROOT_LIBRARY_BLOCK_ID = 'library'
- def create_course(
+ def create_course( # lint-amnesty, pylint: disable=arguments-differ
self, org, course, run, user_id, master_branch=None, fields=None,
versions_dict=None, search_targets=None, root_category='course',
root_block_id=None, **kwargs
@@ -1985,7 +1985,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
search_targets, root_category, root_block_id, **kwargs
)
- def _create_courselike(
+ def _create_courselike( # lint-amnesty, pylint: disable=too-many-statements
self, locator, user_id, master_branch, fields=None,
versions_dict=None, search_targets=None, root_category='course',
root_block_id=None, **kwargs
@@ -2007,7 +2007,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# if building a wholly new structure
if versions_dict is None or master_branch not in versions_dict:
# create new definition and structure
- definition_id = self.create_definition_from_data(locator, definition_fields, root_category, user_id).definition_id
+ definition_id = self.create_definition_from_data(locator, definition_fields, root_category, user_id).definition_id # lint-amnesty, pylint: disable=line-too-long
draft_structure = self._new_structure(
user_id,
@@ -2087,14 +2087,14 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
locator = LibraryLocator(org=org, library=library, branch=kwargs["master_branch"])
return self._create_courselike(locator, user_id, **kwargs)
- def update_item(self, descriptor, user_id, allow_not_found=False, force=False, **kwargs):
+ def update_item(self, descriptor, user_id, allow_not_found=False, force=False, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Save the descriptor's fields. it doesn't descend the course dag to save the children.
Return the new descriptor (updated location).
raises ItemNotFoundError if the location does not exist.
- Creates a new course version. If the descriptor's location has a org and course and run, it moves the course head
+ Creates a new course version. If the descriptor's location has a org and course and run, it moves the course head # lint-amnesty, pylint: disable=line-too-long
pointer. If the version_guid of the descriptor points to a non-head version and there's been an intervening
change to this item, it raises a VersionConflictError unless force is True. In the force case, it forks
the course but leaves the head pointer where it is (this change will not be in the course head).
@@ -2153,7 +2153,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# check children
if partitioned_fields.get(Scope.children, {}): # purposely not 'is not None'
- serialized_children = [BlockKey.from_usage_key(child) for child in partitioned_fields[Scope.children]['children']]
+ serialized_children = [BlockKey.from_usage_key(child) for child in partitioned_fields[Scope.children]['children']] # lint-amnesty, pylint: disable=line-too-long
is_updated = is_updated or original_entry.fields.get('children', []) != serialized_children
if is_updated:
settings['children'] = serialized_children
@@ -2249,7 +2249,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
else:
inherited_settings = parent_xblock.xblock_kvs.inherited_settings.copy()
if fields is not None:
- for field_name in inheritance.InheritanceMixin.fields:
+ for field_name in inheritance.InheritanceMixin.fields: # lint-amnesty, pylint: disable=not-an-iterable
if field_name in fields:
inherited_settings[field_name] = fields[field_name]
@@ -2307,7 +2307,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
else:
return xblock
- def _persist_subdag(self, course_key, xblock, user_id, structure_blocks, new_id):
+ def _persist_subdag(self, course_key, xblock, user_id, structure_blocks, new_id): # lint-amnesty, pylint: disable=missing-function-docstring
# persist the definition if persisted != passed
partitioned_fields = self.partition_xblock_fields_by_scope(xblock)
new_def_data = self._serialize_fields(xblock.category, partitioned_fields[Scope.content])
@@ -2342,7 +2342,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
for child in xblock.children:
if isinstance(child.block_id, LocalId):
child_block = xblock.system.get_block(child)
- is_updated = self._persist_subdag(course_key, child_block, user_id, structure_blocks, new_id) or is_updated
+ is_updated = self._persist_subdag(course_key, child_block, user_id, structure_blocks, new_id) or is_updated # lint-amnesty, pylint: disable=line-too-long
children.append(BlockKey.from_usage_key(child_block.location))
else:
children.append(BlockKey.from_usage_key(child))
@@ -2471,7 +2471,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
BlockKey.from_usage_key(subtree_root)
)
)
- if len(parents) and not parent_found:
+ if len(parents) and not parent_found: # lint-amnesty, pylint: disable=len-as-condition
raise ItemNotFoundError(parents)
# update/create the subtree and its children in destination (skipping blacklist)
orphans.update(
@@ -2660,7 +2660,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
return new_blocks
- def delete_item(self, usage_locator, user_id, force=False):
+ def delete_item(self, usage_locator, user_id, force=False): # lint-amnesty, pylint: disable=arguments-differ
"""
Delete the block or tree rooted at block (if delete_children) and any references w/in the course to the block
from a new version of the course structure.
@@ -2670,7 +2670,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
raises ItemNotFoundError if the location does not exist.
raises ValueError if usage_locator points to the structure root
- Creates a new course version. If the descriptor's location has a org, a course, and a run, it moves the course head
+ Creates a new course version. If the descriptor's location has a org, a course, and a run, it moves the course head # lint-amnesty, pylint: disable=line-too-long
pointer. If the version_guid of the descriptor points to a non-head version and there's been an intervening
change to this item, it raises a VersionConflictError unless force is True. In the force case, it forks
the course but leaves the head pointer where it is (this change will not be in the course head).
@@ -2755,7 +2755,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
for block_key in to_delete:
del blocks[block_key]
- def delete_course(self, course_key, user_id):
+ def delete_course(self, course_key, user_id): # lint-amnesty, pylint: disable=arguments-differ
"""
Remove the given course from the course index.
@@ -2798,14 +2798,14 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# update the inheriting w/ what should pass to children
inheriting_settings = inherited_settings_map[block_key].copy()
block_fields = block_data.fields
- for field_name in inheritance.InheritanceMixin.fields:
+ for field_name in inheritance.InheritanceMixin.fields: # lint-amnesty, pylint: disable=not-an-iterable
if field_name in block_fields:
inheriting_settings[field_name] = block_fields[field_name]
for child in block_fields.get('children', []):
try:
if child in inherited_from:
- raise Exception(u'Infinite loop detected when inheriting to {}, having already inherited from {}'.format(child, inherited_from))
+ raise Exception(u'Infinite loop detected when inheriting to {}, having already inherited from {}'.format(child, inherited_from)) # lint-amnesty, pylint: disable=line-too-long
self.inherit_settings(
block_map,
BlockKey(*child),
@@ -2839,7 +2839,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
return descendent_map
- def get_modulestore_type(self, course_key=None):
+ def get_modulestore_type(self, course_key=None): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""
Returns an enumeration-like type reflecting the type of this modulestore, per ModuleStoreEnum.Type.
@@ -2854,7 +2854,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
"""
try:
course_assets = self._lookup_course(course_key).structure.get('assets', {})
- except (InsufficientSpecificationError, VersionConflictError) as err:
+ except (InsufficientSpecificationError, VersionConflictError) as err: # lint-amnesty, pylint: disable=unused-variable
log.warning(u'Error finding assets for org "%s" course "%s" on asset '
u'request. Either version of course_key is None or invalid.',
course_key.org, course_key.course)
@@ -2929,7 +2929,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
return self.save_asset_metadata_list([asset_metadata, ], user_id, import_only)
@contract(asset_key='AssetKey', attr_dict=dict)
- def set_asset_metadata_attrs(self, asset_key, attr_dict, user_id):
+ def set_asset_metadata_attrs(self, asset_key, attr_dict, user_id): # lint-amnesty, pylint: disable=arguments-differ
"""
Add/set the given dict of attrs on the asset at the given location. Value can be any type which pymongo accepts.
@@ -3032,7 +3032,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# update the index entry if appropriate
self._update_head(course_locator, index_entry, course_locator.branch, new_structure['_id'])
- def convert_references_to_keys(self, course_key, xblock_class, jsonfields, blocks):
+ def convert_references_to_keys(self, course_key, xblock_class, jsonfields, blocks): # lint-amnesty, pylint: disable=unused-argument
"""
Convert the given serialized fields to the deserialized values by finding all references
and converting them.
@@ -3106,7 +3106,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
index_entry['versions'][course_key.branch]
)
- def _find_local_root(self, element_to_find, possibility, tree):
+ def _find_local_root(self, element_to_find, possibility, tree): # lint-amnesty, pylint: disable=missing-function-docstring
if possibility not in tree:
return False
if element_to_find in tree[possibility]:
@@ -3400,7 +3400,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
tmp_new_asides_data[aside_type] = asd
result_list = []
- for i, aside in enumerate(block.asides):
+ for i, aside in enumerate(block.asides): # lint-amnesty, pylint: disable=unused-variable
if aside['aside_type'] in tmp_new_asides_data:
result_list.append(tmp_new_asides_data.pop(aside['aside_type']))
updated = True
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
index 1a27305926..13e2ab9f46 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
@@ -23,7 +23,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
A subclass of Split that supports a dual-branch fall-back versioning framework
with a Draft branch that falls back to a Published branch.
"""
- def create_course(self, org, course, run, user_id, skip_auto_publish=False, **kwargs):
+ def create_course(self, org, course, run, user_id, skip_auto_publish=False, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Creates and returns the course.
@@ -38,7 +38,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
"""
master_branch = kwargs.pop('master_branch', ModuleStoreEnum.BranchName.draft)
with self.bulk_operations(CourseLocator(org, course, run), ignore_case=True):
- item = super(DraftVersioningModuleStore, self).create_course(
+ item = super(DraftVersioningModuleStore, self).create_course( # lint-amnesty, pylint: disable=super-with-arguments
org, course, run, user_id, master_branch=master_branch, **kwargs
)
if master_branch == ModuleStoreEnum.BranchName.draft and not skip_auto_publish:
@@ -51,7 +51,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
# in this; so, this manually calls the grandparent and above methods.
with self.branch_setting(ModuleStoreEnum.Branch.draft_preferred, item.id):
# NOTE: DO NOT CHANGE THE SUPER. See comment above
- super(SplitMongoModuleStore, self).create_course(
+ super(SplitMongoModuleStore, self).create_course( # lint-amnesty, pylint: disable=bad-super-call
org, course, run, user_id, runtime=item.runtime, **kwargs
)
@@ -59,7 +59,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
def get_course(self, course_id, depth=0, **kwargs):
course_id = self._map_revision_to_branch(course_id)
- return super(DraftVersioningModuleStore, self).get_course(course_id, depth=depth, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_course(course_id, depth=depth, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
def get_library(self, library_id, depth=0, head_validation=True, **kwargs):
if not head_validation and library_id.version_guid:
@@ -67,42 +67,42 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
self, library_id, depth=depth, head_validation=head_validation, **kwargs
)
library_id = self._map_revision_to_branch(library_id)
- return super(DraftVersioningModuleStore, self).get_library(library_id, depth=depth, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_library(library_id, depth=depth, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
- def clone_course(self, source_course_id, dest_course_id, user_id, fields=None, revision=None, **kwargs):
+ def clone_course(self, source_course_id, dest_course_id, user_id, fields=None, revision=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
See :py:meth: xmodule.modulestore.split_mongo.split.SplitMongoModuleStore.clone_course
"""
dest_course_id = self._map_revision_to_branch(dest_course_id, revision=revision)
- return super(DraftVersioningModuleStore, self).clone_course(
+ return super(DraftVersioningModuleStore, self).clone_course( # lint-amnesty, pylint: disable=super-with-arguments
source_course_id, dest_course_id, user_id, fields=fields, **kwargs
)
- def get_course_summaries(self, **kwargs):
+ def get_course_summaries(self, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns course summaries on the Draft or Published branch depending on the branch setting.
"""
branch_setting = self.get_branch_setting()
if branch_setting == ModuleStoreEnum.Branch.draft_preferred:
- return super(DraftVersioningModuleStore, self).get_course_summaries(
+ return super(DraftVersioningModuleStore, self).get_course_summaries( # lint-amnesty, pylint: disable=super-with-arguments
ModuleStoreEnum.BranchName.draft, **kwargs
)
elif branch_setting == ModuleStoreEnum.Branch.published_only:
- return super(DraftVersioningModuleStore, self).get_course_summaries(
+ return super(DraftVersioningModuleStore, self).get_course_summaries( # lint-amnesty, pylint: disable=super-with-arguments
ModuleStoreEnum.BranchName.published, **kwargs
)
else:
raise InsufficientSpecificationError()
- def get_courses(self, **kwargs):
+ def get_courses(self, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns all the courses on the Draft or Published branch depending on the branch setting.
"""
branch_setting = self.get_branch_setting()
if branch_setting == ModuleStoreEnum.Branch.draft_preferred:
- return super(DraftVersioningModuleStore, self).get_courses(ModuleStoreEnum.BranchName.draft, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_courses(ModuleStoreEnum.BranchName.draft, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
elif branch_setting == ModuleStoreEnum.Branch.published_only:
- return super(DraftVersioningModuleStore, self).get_courses(ModuleStoreEnum.BranchName.published, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_courses(ModuleStoreEnum.BranchName.published, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
else:
raise InsufficientSpecificationError()
@@ -117,14 +117,14 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
# version_agnostic b/c of above assumption in docstring
self.publish(location.version_agnostic(), user_id, blacklist=EXCLUDE_ALL, **kwargs)
- def copy_from_template(self, source_keys, dest_key, user_id, **kwargs):
+ def copy_from_template(self, source_keys, dest_key, user_id, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
See :py:meth `SplitMongoModuleStore.copy_from_template`
"""
source_keys = [self._map_revision_to_branch(key) for key in source_keys]
dest_key = self._map_revision_to_branch(dest_key)
head_validation = kwargs.get('head_validation')
- new_keys = super(DraftVersioningModuleStore, self).copy_from_template(
+ new_keys = super(DraftVersioningModuleStore, self).copy_from_template( # lint-amnesty, pylint: disable=super-with-arguments
source_keys, dest_key, user_id, head_validation
)
if dest_key.branch == ModuleStoreEnum.BranchName.draft:
@@ -141,14 +141,14 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
keys_to_check.extend(children)
return new_keys
- def update_item(self, descriptor, user_id, allow_not_found=False, force=False, asides=None, **kwargs):
+ def update_item(self, descriptor, user_id, allow_not_found=False, force=False, asides=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
old_descriptor_locn = descriptor.location
descriptor.location = self._map_revision_to_branch(old_descriptor_locn)
emit_signals = descriptor.location.branch == ModuleStoreEnum.BranchName.published \
or descriptor.location.block_type in DIRECT_ONLY_CATEGORIES
with self.bulk_operations(descriptor.location.course_key, emit_signals=emit_signals):
- item = super(DraftVersioningModuleStore, self).update_item(
+ item = super(DraftVersioningModuleStore, self).update_item( # lint-amnesty, pylint: disable=super-with-arguments
descriptor,
user_id,
allow_not_found=allow_not_found,
@@ -169,7 +169,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
emit_signals = course_key.branch == ModuleStoreEnum.BranchName.published \
or block_type in DIRECT_ONLY_CATEGORIES
with self.bulk_operations(course_key, emit_signals=emit_signals):
- item = super(DraftVersioningModuleStore, self).create_item(
+ item = super(DraftVersioningModuleStore, self).create_item( # lint-amnesty, pylint: disable=super-with-arguments
user_id, course_key, block_type, block_id=block_id,
definition_locator=definition_locator, fields=fields, asides=asides,
force=force, **kwargs
@@ -184,7 +184,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
):
parent_usage_key = self._map_revision_to_branch(parent_usage_key)
with self.bulk_operations(parent_usage_key.course_key):
- item = super(DraftVersioningModuleStore, self).create_child(
+ item = super(DraftVersioningModuleStore, self).create_child( # lint-amnesty, pylint: disable=super-with-arguments
user_id, parent_usage_key, block_type, block_id=block_id,
fields=fields, asides=asides, **kwargs
)
@@ -193,7 +193,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
self._auto_publish_no_children(parent_usage_key, item.location.block_type, user_id, **kwargs)
return item
- def delete_item(self, location, user_id, revision=None, skip_auto_publish=False, **kwargs):
+ def delete_item(self, location, user_id, revision=None, skip_auto_publish=False, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Delete the given item from persistence. kwargs allow modulestore specific parameters.
@@ -218,7 +218,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
autopublish_parent = False
with self.bulk_operations(location.course_key):
if isinstance(location, LibraryUsageLocator):
- branches_to_delete = [ModuleStoreEnum.BranchName.library] # Libraries don't yet have draft/publish support
+ branches_to_delete = [ModuleStoreEnum.BranchName.library] # Libraries don't yet have draft/publish support # lint-amnesty, pylint: disable=line-too-long
elif location.block_type in DIRECT_ONLY_CATEGORIES:
branches_to_delete = [ModuleStoreEnum.BranchName.published, ModuleStoreEnum.BranchName.draft]
elif revision == ModuleStoreEnum.RevisionOption.all:
@@ -238,7 +238,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
self._flag_publish_event(location.course_key)
for branch in branches_to_delete:
branched_location = location.for_branch(branch)
- super(DraftVersioningModuleStore, self).delete_item(branched_location, user_id)
+ super(DraftVersioningModuleStore, self).delete_item(branched_location, user_id) # lint-amnesty, pylint: disable=super-with-arguments
if autopublish_parent:
self.publish(parent_loc.version_agnostic(), user_id, blacklist=EXCLUDE_ALL, **kwargs)
@@ -269,29 +269,29 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
else:
raise UnsupportedRevisionError()
- def has_item(self, usage_key, revision=None):
+ def has_item(self, usage_key, revision=None): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns True if location exists in this ModuleStore.
"""
usage_key = self._map_revision_to_branch(usage_key, revision=revision)
- return super(DraftVersioningModuleStore, self).has_item(usage_key)
+ return super(DraftVersioningModuleStore, self).has_item(usage_key) # lint-amnesty, pylint: disable=super-with-arguments
- def get_item(self, usage_key, depth=0, revision=None, **kwargs):
+ def get_item(self, usage_key, depth=0, revision=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns the item identified by usage_key and revision.
"""
usage_key = self._map_revision_to_branch(usage_key, revision=revision)
- return super(DraftVersioningModuleStore, self).get_item(usage_key, depth=depth, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_item(usage_key, depth=depth, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
- def get_items(self, course_locator, revision=None, **kwargs):
+ def get_items(self, course_locator, revision=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns a list of XModuleDescriptor instances for the matching items within the course with
the given course_locator.
"""
course_locator = self._map_revision_to_branch(course_locator, revision=revision)
- return super(DraftVersioningModuleStore, self).get_items(course_locator, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_items(course_locator, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
- def get_parent_location(self, location, revision=None, **kwargs):
+ def get_parent_location(self, location, revision=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
'''
Returns the given location's parent location in this course.
Args:
@@ -306,7 +306,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
if revision == ModuleStoreEnum.RevisionOption.draft_preferred:
revision = ModuleStoreEnum.RevisionOption.draft_only
location = self._map_revision_to_branch(location, revision=revision)
- return super(DraftVersioningModuleStore, self).get_parent_location(location, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_parent_location(location, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
def get_block_original_usage(self, usage_key):
"""
@@ -315,18 +315,18 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
copy was inherited.
"""
usage_key = self._map_revision_to_branch(usage_key)
- return super(DraftVersioningModuleStore, self).get_block_original_usage(usage_key)
+ return super(DraftVersioningModuleStore, self).get_block_original_usage(usage_key) # lint-amnesty, pylint: disable=super-with-arguments
def get_orphans(self, course_key, **kwargs):
course_key = self._map_revision_to_branch(course_key)
- return super(DraftVersioningModuleStore, self).get_orphans(course_key, **kwargs)
+ return super(DraftVersioningModuleStore, self).get_orphans(course_key, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
- def fix_not_found(self, course_key, user_id):
+ def fix_not_found(self, course_key, user_id): # lint-amnesty, pylint: disable=arguments-differ
"""
Fix any children which point to non-existent blocks in the course's published and draft branches
"""
for branch in [ModuleStoreEnum.RevisionOption.published_only, ModuleStoreEnum.RevisionOption.draft_only]:
- super(DraftVersioningModuleStore, self).fix_not_found(
+ super(DraftVersioningModuleStore, self).fix_not_found( # lint-amnesty, pylint: disable=super-with-arguments
self._map_revision_to_branch(course_key, branch),
user_id
)
@@ -368,12 +368,12 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
return has_changes_subtree(BlockKey.from_usage_key(xblock.location))
- def publish(self, location, user_id, blacklist=None, **kwargs):
+ def publish(self, location, user_id, blacklist=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Publishes the subtree under location from the draft branch to the published branch
Returns the newly published item.
"""
- super(DraftVersioningModuleStore, self).copy(
+ super(DraftVersioningModuleStore, self).copy( # lint-amnesty, pylint: disable=super-with-arguments
user_id,
# Directly using the replace function rather than the for_branch function
# because for_branch obliterates the version_guid and will lead to missed version conflicts.
@@ -492,7 +492,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
old_parent_location = original_parent_location.course_key.make_usage_key(block_key.type, block_key.id)
self.update_item_parent(item_location, original_parent_location, old_parent_location, user_id)
- def force_publish_course(self, course_locator, user_id, commit=False):
+ def force_publish_course(self, course_locator, user_id, commit=False): # lint-amnesty, pylint: disable=unused-argument
"""
Helper method to forcefully publish a course,
making the published branch point to the same structure as the draft branch.
@@ -514,19 +514,19 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
return self.get_course_index(course_locator)['versions']
return versions
- def get_course_history_info(self, course_locator):
+ def get_course_history_info(self, course_locator): # lint-amnesty, pylint: disable=arguments-differ
"""
See :py:meth `xmodule.modulestore.split_mongo.split.SplitMongoModuleStore.get_course_history_info`
"""
course_locator = self._map_revision_to_branch(course_locator)
- return super(DraftVersioningModuleStore, self).get_course_history_info(course_locator)
+ return super(DraftVersioningModuleStore, self).get_course_history_info(course_locator) # lint-amnesty, pylint: disable=super-with-arguments
def get_course_successors(self, course_locator, version_history_depth=1):
"""
See :py:meth `xmodule.modulestore.split_mongo.split.SplitMongoModuleStore.get_course_successors`
"""
course_locator = self._map_revision_to_branch(course_locator)
- return super(DraftVersioningModuleStore, self).get_course_successors(
+ return super(DraftVersioningModuleStore, self).get_course_successors( # lint-amnesty, pylint: disable=super-with-arguments
course_locator, version_history_depth=version_history_depth
)
@@ -535,7 +535,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
See :py:meth `xmodule.modulestore.split_mongo.split.SplitMongoModuleStore.get_block_generations`
"""
block_locator = self._map_revision_to_branch(block_locator)
- return super(DraftVersioningModuleStore, self).get_block_generations(block_locator)
+ return super(DraftVersioningModuleStore, self).get_block_generations(block_locator) # lint-amnesty, pylint: disable=super-with-arguments
def has_published_version(self, xblock):
"""
@@ -550,7 +550,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
:param source: the location of the source (its revision must be None)
"""
# This is a no-op in Split since a draft version of the data always remains
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
def _get_head(self, xblock, branch):
""" Gets block at the head of specified branch """
@@ -592,7 +592,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
# Importing the block and publishing the block links the draft & published blocks' version history.
draft_block = self.import_xblock(user_id, draft_course, block_type, block_id, fields,
runtime, **kwargs)
- return self.publish(draft_block.location.version_agnostic(), user_id, blacklist=EXCLUDE_ALL, **kwargs)
+ return self.publish(draft_block.location.version_agnostic(), user_id, blacklist=EXCLUDE_ALL, **kwargs) # lint-amnesty, pylint: disable=line-too-long
# do the import
partitioned_fields = self.partition_fields_by_scope(block_type, fields)
@@ -614,12 +614,12 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
@contract(asset_key='AssetKey')
def find_asset_metadata(self, asset_key, **kwargs):
- return super(DraftVersioningModuleStore, self).find_asset_metadata(
+ return super(DraftVersioningModuleStore, self).find_asset_metadata( # lint-amnesty, pylint: disable=super-with-arguments
self._map_revision_to_branch(asset_key), **kwargs
)
def get_all_asset_metadata(self, course_key, asset_type, start=0, maxresults=-1, sort=None, **kwargs):
- return super(DraftVersioningModuleStore, self).get_all_asset_metadata(
+ return super(DraftVersioningModuleStore, self).get_all_asset_metadata( # lint-amnesty, pylint: disable=super-with-arguments
self._map_revision_to_branch(course_key), asset_type, start, maxresults, sort, **kwargs
)
@@ -628,11 +628,11 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
Updates both the published and draft branches
"""
# if one call gets an exception, don't do the other call but pass on the exception
- super(DraftVersioningModuleStore, self)._update_course_assets(
+ super(DraftVersioningModuleStore, self)._update_course_assets( # lint-amnesty, pylint: disable=super-with-arguments
user_id, self._map_revision_to_branch(asset_key, ModuleStoreEnum.RevisionOption.published_only),
update_function
)
- super(DraftVersioningModuleStore, self)._update_course_assets(
+ super(DraftVersioningModuleStore, self)._update_course_assets( # lint-amnesty, pylint: disable=super-with-arguments
user_id, self._map_revision_to_branch(asset_key, ModuleStoreEnum.RevisionOption.draft_only),
update_function
)
@@ -646,17 +646,17 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
for asset_md in asset_metadata_list:
asset_key = asset_md.asset_id
asset_md.asset_id = self._map_revision_to_branch(asset_key, ModuleStoreEnum.RevisionOption.published_only)
- super(DraftVersioningModuleStore, self).save_asset_metadata_list(asset_metadata_list, user_id, import_only)
+ super(DraftVersioningModuleStore, self).save_asset_metadata_list(asset_metadata_list, user_id, import_only) # lint-amnesty, pylint: disable=super-with-arguments
for asset_md in asset_metadata_list:
asset_key = asset_md.asset_id
asset_md.asset_id = self._map_revision_to_branch(asset_key, ModuleStoreEnum.RevisionOption.draft_only)
- super(DraftVersioningModuleStore, self).save_asset_metadata_list(asset_metadata_list, user_id, import_only)
+ super(DraftVersioningModuleStore, self).save_asset_metadata_list(asset_metadata_list, user_id, import_only) # lint-amnesty, pylint: disable=super-with-arguments
# Change each asset key back to its original state.
for k in asset_keys:
asset_md.asset_id = k
def _find_course_asset(self, asset_key):
- return super(DraftVersioningModuleStore, self)._find_course_asset(
+ return super(DraftVersioningModuleStore, self)._find_course_asset( # lint-amnesty, pylint: disable=super-with-arguments
self._map_revision_to_branch(asset_key)
)
@@ -664,7 +664,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
"""
Split specific lookup
"""
- return super(DraftVersioningModuleStore, self)._find_course_assets(
+ return super(DraftVersioningModuleStore, self)._find_course_assets( # lint-amnesty, pylint: disable=super-with-arguments
self._map_revision_to_branch(course_key)
)
@@ -673,7 +673,7 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
Copies to and from both branches
"""
for revision in [ModuleStoreEnum.RevisionOption.published_only, ModuleStoreEnum.RevisionOption.draft_only]:
- super(DraftVersioningModuleStore, self).copy_all_asset_metadata(
+ super(DraftVersioningModuleStore, self).copy_all_asset_metadata( # lint-amnesty, pylint: disable=super-with-arguments
self._map_revision_to_branch(source_course_key, revision),
self._map_revision_to_branch(dest_course_key, revision),
user_id
diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py
index 93a11a6435..b82d5a6e28 100644
--- a/common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py
+++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import copy
from collections import namedtuple
@@ -37,7 +37,7 @@ class SplitMongoKVS(InheritanceKeyValueStore):
(copied from a template block with copy_from_template)
"""
# deepcopy so that manipulations of fields does not pollute the source
- super(SplitMongoKVS, self).__init__(copy.deepcopy(initial_values))
+ super(SplitMongoKVS, self).__init__(copy.deepcopy(initial_values)) # lint-amnesty, pylint: disable=super-with-arguments
self._definition = definition # either a DefinitionLazyLoader or the db id of the definition.
# if the db id, then the definition is presumed to be loaded into _fields
@@ -52,7 +52,7 @@ class SplitMongoKVS(InheritanceKeyValueStore):
self.aside_fields = aside_fields if aside_fields else {}
def get(self, key):
- if key.block_family == XBlockAside.entry_point:
+ if key.block_family == XBlockAside.entry_point: # lint-amnesty, pylint: disable=no-else-raise
if key.scope not in self.VALID_SCOPES:
raise InvalidScopeError(key, self.VALID_SCOPES)
@@ -75,7 +75,7 @@ class SplitMongoKVS(InheritanceKeyValueStore):
if key.field_name not in self._fields:
if key.scope == Scope.parent:
return self.parent
- if key.scope == Scope.children:
+ if key.scope == Scope.children: # lint-amnesty, pylint: disable=no-else-raise
# didn't find children in _fields; so, see if there's a default
raise KeyError()
elif key.scope == Scope.settings:
@@ -178,7 +178,7 @@ class SplitMongoKVS(InheritanceKeyValueStore):
if self._defaults and key.field_name in self._defaults:
return self._defaults[key.field_name]
# If not, try inheriting from a parent, then use the XBlock type's normal default value:
- return super(SplitMongoKVS, self).default(key)
+ return super(SplitMongoKVS, self).default(key) # lint-amnesty, pylint: disable=super-with-arguments
def _load_definition(self):
"""
diff --git a/common/lib/xmodule/xmodule/modulestore/store_utilities.py b/common/lib/xmodule/xmodule/modulestore/store_utilities.py
index 60f7a018c0..ea52d50509 100644
--- a/common/lib/xmodule/xmodule/modulestore/store_utilities.py
+++ b/common/lib/xmodule/xmodule/modulestore/store_utilities.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import logging
import re
@@ -50,7 +50,7 @@ def rewrite_nonportable_content_links(source_course_id, dest_course_id, text):
try:
text = _prefix_only_url_replace_regex(asset_block_pattern).sub(portable_asset_link_subtitution, text)
except Exception as exc: # pylint: disable=broad-except
- logging.warning("Error producing regex substitution %r for text = %r.\n\nError msg = %s", asset_block_pattern, text, str(exc))
+ logging.warning("Error producing regex substitution %r for text = %r.\n\nError msg = %s", asset_block_pattern, text, str(exc)) # lint-amnesty, pylint: disable=line-too-long
placeholder_category = 'cat_{}'.format(uuid.uuid4().hex)
usage_block_pattern = six.text_type(source_course_id.make_usage_key(placeholder_category, placeholder_id))
@@ -62,7 +62,7 @@ def rewrite_nonportable_content_links(source_course_id, dest_course_id, text):
try:
text = _prefix_only_url_replace_regex(jump_to_link_base).sub(portable_jump_to_link_substitution, text)
except Exception as exc: # pylint: disable=broad-except
- logging.warning("Error producing regex substitution %r for text = %r.\n\nError msg = %s", jump_to_link_base, text, str(exc))
+ logging.warning("Error producing regex substitution %r for text = %r.\n\nError msg = %s", jump_to_link_base, text, str(exc)) # lint-amnesty, pylint: disable=line-too-long
# Also, there commonly is a set of link URL's used in the format:
# /courses/// which will be broken if migrated to a different course_id
@@ -73,9 +73,9 @@ def rewrite_nonportable_content_links(source_course_id, dest_course_id, text):
if source_course_id != dest_course_id:
try:
generic_courseware_link_base = u'/courses/{}/'.format(six.text_type(source_course_id))
- text = re.sub(_prefix_only_url_replace_regex(generic_courseware_link_base), portable_asset_link_subtitution, text)
+ text = re.sub(_prefix_only_url_replace_regex(generic_courseware_link_base), portable_asset_link_subtitution, text) # lint-amnesty, pylint: disable=line-too-long
except Exception as exc: # pylint: disable=broad-except
- logging.warning("Error producing regex substitution %r for text = %r.\n\nError msg = %s", source_course_id, text, str(exc))
+ logging.warning("Error producing regex substitution %r for text = %r.\n\nError msg = %s", source_course_id, text, str(exc)) # lint-amnesty, pylint: disable=line-too-long
return text
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
index 49723673bd..5cd5f12a82 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
@@ -11,7 +11,7 @@ from contextlib import contextmanager
from enum import Enum
from django.conf import settings
-from django.contrib.auth.models import AnonymousUser, User
+from django.contrib.auth.models import AnonymousUser, User # lint-amnesty, pylint: disable=imported-auth-user
from django.db import connections
from django.test import TestCase
from django.test.utils import override_settings
@@ -245,7 +245,7 @@ class SignalIsolationMixin(object):
"You tried to enable signal '{}', but I don't recognize that "
"signal name. Did you mean one of these?: {}"
)
- raise ValueError(err_msg.format(signal_name, all_signal_names))
+ raise ValueError(err_msg.format(signal_name, all_signal_names)) # lint-amnesty, pylint: disable=raise-missing-from
signal.enable()
@@ -398,7 +398,7 @@ class SharedModuleStoreTestCase(
for Django ORM models that will get cleaned up properly.
"""
# Tell Django to clean out all databases, not just default
- databases = {alias for alias in connections}
+ databases = {alias for alias in connections} # lint-amnesty, pylint: disable=unnecessary-comprehension
@classmethod
@contextmanager
@@ -441,7 +441,7 @@ class SharedModuleStoreTestCase(
# OverrideFieldData.provider_classes is always reset to `None` so
# that they're recalculated for every test
OverrideFieldData.provider_classes = None
- super(SharedModuleStoreTestCase, self).setUp()
+ super(SharedModuleStoreTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
class ModuleStoreTestCase(
@@ -487,7 +487,7 @@ class ModuleStoreTestCase(
CREATE_USER = True
# Tell Django to clean out all databases, not just default
- databases = {alias for alias in connections}
+ databases = {alias for alias in connections} # lint-amnesty, pylint: disable=unnecessary-comprehension
@classmethod
def setUpClass(cls):
@@ -511,7 +511,7 @@ class ModuleStoreTestCase(
# that they're recalculated for every test
OverrideFieldData.provider_classes = None
- super(ModuleStoreTestCase, self).setUp()
+ super(ModuleStoreTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.store = modulestore()
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/factories.py b/common/lib/xmodule/xmodule/modulestore/tests/factories.py
index 0298efdbcb..791d238845 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/factories.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/factories.py
@@ -26,7 +26,7 @@ from xmodule.course_module import Textbook
from xmodule.modulestore import ModuleStoreEnum, prefer_xmodules
from xmodule.modulestore.tests.sample_courses import TOY_BLOCK_INFO_TREE, default_block_info_tree
from xmodule.tabs import CourseTab
-from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT
+from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT # lint-amnesty, pylint: disable=unused-import
LOG = logging.getLogger(__name__)
@@ -46,7 +46,7 @@ class XModuleFactoryLock(threading.local):
will be called.
"""
def __init__(self):
- super(XModuleFactoryLock, self).__init__()
+ super(XModuleFactoryLock, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self._enabled = False
def enable(self):
@@ -86,7 +86,7 @@ class XModuleFactory(Factory):
model = Dummy
@lazy_attribute
- def modulestore(self):
+ def modulestore(self): # lint-amnesty, pylint: disable=missing-function-docstring
msg = "XMODULE_FACTORY_LOCK not enabled. Please use ModuleStoreTestCase as your test baseclass."
assert XMODULE_FACTORY_LOCK.is_enabled(), msg
@@ -107,7 +107,7 @@ class CourseFactory(XModuleFactory):
# pylint: disable=unused-argument
@classmethod
- def _create(cls, target_class, **kwargs):
+ def _create(cls, target_class, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Create and return a new course. For performance reasons, we do not emit
signals during this process, but if you need signals to run, you can
@@ -260,7 +260,7 @@ class LibraryFactory(XModuleFactory):
# pylint: disable=unused-argument
@classmethod
- def _create(cls, target_class, **kwargs):
+ def _create(cls, target_class, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Create a library with a unique name and key.
All class attributes (from this class and base classes) are automagically
@@ -291,18 +291,18 @@ class ItemFactory(XModuleFactory):
descriptive_tag = None
@lazy_attribute_sequence
- def display_name(self, n):
+ def display_name(self, n): # lint-amnesty, pylint: disable=missing-function-docstring
if self.descriptive_tag:
return "{} {} - {}".format(self.category, n, self.descriptive_tag)
else:
return "{} {}".format(self.category, n)
@lazy_attribute
- def location(self):
+ def location(self): # lint-amnesty, pylint: disable=missing-function-docstring
if self.display_name is None:
dest_name = uuid4().hex
else:
- dest_name = self.display_name.replace(" ", "_")
+ dest_name = self.display_name.replace(" ", "_") # lint-amnesty, pylint: disable=no-member
new_location = self.parent_location.course_key.make_usage_key(
self.category,
@@ -311,7 +311,7 @@ class ItemFactory(XModuleFactory):
return new_location
@lazy_attribute
- def parent_location(self):
+ def parent_location(self): # lint-amnesty, pylint: disable=missing-function-docstring
default_location = getattr(last_course, 'loc', None)
try:
parent = self.parent
@@ -326,7 +326,7 @@ class ItemFactory(XModuleFactory):
return parent.location
@classmethod
- def _create(cls, target_class, **kwargs):
+ def _create(cls, target_class, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""
Uses ``**kwargs``:
@@ -416,7 +416,7 @@ class ItemFactory(XModuleFactory):
store.update_item(course, user_id)
# parent and publish the item, so it can be accessed
- if 'detached' not in module._class_tags:
+ if 'detached' not in module._class_tags: # lint-amnesty, pylint: disable=protected-access
parent.children.append(location)
store.update_item(parent, user_id)
if publish_item:
@@ -690,7 +690,7 @@ class CourseAboutFactory(XModuleFactory):
"""
@classmethod
- def _create(cls, target_class, **kwargs): # pylint: disable=unused-argument
+ def _create(cls, target_class, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""
Uses **kwargs:
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/sample_courses.py b/common/lib/xmodule/xmodule/modulestore/tests/sample_courses.py
index 4a9e027f6e..f2fb7ab506 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/sample_courses.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/sample_courses.py
@@ -51,7 +51,7 @@ TOY_BLOCK_INFO_TREE = [
'Overview', "chapter", {"display_name": "Overview"}, [
BlockInfo(
"Toy_Videos", "videosequence", {
- "xml_attributes": {"filename": ["", None]}, "display_name": "Toy Videos", "format": "Lecture Sequence"
+ "xml_attributes": {"filename": ["", None]}, "display_name": "Toy Videos", "format": "Lecture Sequence" # lint-amnesty, pylint: disable=line-too-long
}, [
BlockInfo(
"secret:toylab", "html", {
@@ -67,7 +67,7 @@ TOY_BLOCK_INFO_TREE = [
),
BlockInfo(
"toyjumpto", "html", {
- "data": u"This is a link to another page and some Chinese 四節比分和七年前 Some more Chinese 四節比分和七年前
\n",
+ "data": u"This is a link to another page and some Chinese 四節比分和七年前 Some more Chinese 四節比分和七年前
\n", # lint-amnesty, pylint: disable=line-too-long
"xml_attributes": {"filename": ["html/toyjumpto.xml", "html/toyjumpto.xml"]}
}, []),
BlockInfo(
@@ -92,7 +92,7 @@ TOY_BLOCK_INFO_TREE = [
}, []),
BlockInfo(
"with_styling", "html", {
- "data": "Red text here
",
+ "data": "Red text here
", # lint-amnesty, pylint: disable=line-too-long
"xml_attributes": {"filename": ["html/with_styling.xml", "html/with_styling.xml"]}
}, []),
BlockInfo(
@@ -109,7 +109,7 @@ TOY_BLOCK_INFO_TREE = [
"Welcome", "video", {"data": "", "youtube_id_1_0": "p2Q6BrNhdh8", "display_name": "Welcome"}, []
),
BlockInfo(
- "video_123456789012", "video", {"data": "", "youtube_id_1_0": "p2Q6BrNhdh8", "display_name": "Test Video"}, []
+ "video_123456789012", "video", {"data": "", "youtube_id_1_0": "p2Q6BrNhdh8", "display_name": "Test Video"}, [] # lint-amnesty, pylint: disable=line-too-long
),
BlockInfo(
"video_4f66f493ac8f", "video", {"youtube_id_1_0": "p2Q6BrNhdh8"}, []
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py
index 0df6ec1afd..f515f5d69f 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py
@@ -36,7 +36,7 @@ class AssetStoreTestData(object):
now = datetime.now(pytz.utc)
user_id = 144
if six.PY2:
- user_id_long = long(user_id)
+ user_id_long = long(user_id) # lint-amnesty, pylint: disable=undefined-variable
else:
user_id_long = int(user_id)
@@ -47,7 +47,7 @@ class AssetStoreTestData(object):
'edited_by', 'edited_by_email', 'edited_on', 'created_by', 'created_by_email', 'created_on',
'curr_version', 'prev_version'
)
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
all_asset_data = (
('pic1.jpg', 'EKMND332DDBK', 'pix/archive', False,
user_id_long, user_email, now + timedelta(seconds=10 * 1), user_id_long, user_email, now, '14', '13'),
@@ -76,8 +76,8 @@ class TestSortedAssetList(unittest.TestCase):
"""
def setUp(self):
- super(TestSortedAssetList, self).setUp()
- asset_list = [dict(list(zip(AssetStoreTestData.asset_fields, asset))) for asset in AssetStoreTestData.all_asset_data]
+ super(TestSortedAssetList, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
+ asset_list = [dict(list(zip(AssetStoreTestData.asset_fields, asset))) for asset in AssetStoreTestData.all_asset_data] # lint-amnesty, pylint: disable=line-too-long
self.sorted_asset_list_by_filename = SortedAssetList(iterable=asset_list)
self.sorted_asset_list_by_last_edit = SortedAssetList(iterable=asset_list, key=lambda x: x['edited_on'])
self.course_key = CourseLocator('org', 'course', 'run')
@@ -108,7 +108,7 @@ class TestMongoAssetMetadataStorage(TestCase):
}
def setUp(self):
- super(TestMongoAssetMetadataStorage, self).setUp()
+ super(TestMongoAssetMetadataStorage, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.addTypeEqualityFunc(datetime, self._compare_datetimes)
self.addTypeEqualityFunc(AssetMetadata, self._compare_metadata)
@@ -124,9 +124,9 @@ class TestMongoAssetMetadataStorage(TestCase):
"""
So we can use the below date comparison
"""
- if type(mdata1) != type(mdata2):
+ if type(mdata1) != type(mdata2): # lint-amnesty, pylint: disable=unidiomatic-typecheck
self.fail(self._formatMessage(msg, u"{} is not same type as {}".format(mdata1, mdata2)))
- for attr in mdata1.ATTRS_ALLOWED_TO_UPDATE:
+ for attr in mdata1.ATTRS_ALLOWED_TO_UPDATE: # lint-amnesty, pylint: disable=redefined-outer-name
self.assertEqual(getattr(mdata1, attr), getattr(mdata2, attr), msg)
def _compare_datetimes(self, datetime1, datetime2, msg=None):
@@ -451,7 +451,7 @@ class TestMongoAssetMetadataStorage(TestCase):
"""
getting all things which are of type other than 'asset'
"""
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
with storebuilder.build() as (__, store):
course = CourseFactory.create(modulestore=store)
@@ -488,7 +488,7 @@ class TestMongoAssetMetadataStorage(TestCase):
"""
Save a list of asset metadata all at once.
"""
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
with storebuilder.build() as (__, store):
course = CourseFactory.create(modulestore=store)
@@ -528,7 +528,7 @@ class TestMongoAssetMetadataStorage(TestCase):
"""
Save a list of asset metadata all at once - but with one asset's metadata from a different course.
"""
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
with storebuilder.build() as (__, store):
course1 = CourseFactory.create(modulestore=store)
course2 = CourseFactory.create(modulestore=store)
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py
index faf67c977c..44ad9f2f64 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_contentstore.py
@@ -59,17 +59,17 @@ class TestContentstore(unittest.TestCase):
"""
# since MongoModuleStore and MongoContentStore are basically assumed to be together, create this class
# as well
- self.contentstore = MongoContentStore(HOST, DB, port=PORT)
+ self.contentstore = MongoContentStore(HOST, DB, port=PORT) # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.addCleanup(self.contentstore._drop_database) # pylint: disable=protected-access
AssetLocator.deprecated = deprecated
CourseLocator.deprecated = deprecated
- self.course1_key = CourseLocator('test', 'asset_test', '2014_07')
- self.course2_key = CourseLocator('test', 'asset_test2', '2014_07')
+ self.course1_key = CourseLocator('test', 'asset_test', '2014_07') # lint-amnesty, pylint: disable=attribute-defined-outside-init
+ self.course2_key = CourseLocator('test', 'asset_test2', '2014_07') # lint-amnesty, pylint: disable=attribute-defined-outside-init
- self.course1_files = ['contains.sh', 'picture1.jpg', 'picture2.jpg']
- self.course2_files = ['picture1.jpg', 'picture3.jpg', 'door_2.ogg']
+ self.course1_files = ['contains.sh', 'picture1.jpg', 'picture2.jpg'] # lint-amnesty, pylint: disable=attribute-defined-outside-init
+ self.course2_files = ['picture1.jpg', 'picture3.jpg', 'door_2.ogg'] # lint-amnesty, pylint: disable=attribute-defined-outside-init
def load_assets(course_key, files):
locked = False
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py b/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
index 507ac30435..989dba15b3 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
@@ -55,7 +55,7 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest, PartitionTestCase):
"""
def setUp(self):
- super(CrossStoreXMLRoundtrip, self).setUp()
+ super(CrossStoreXMLRoundtrip, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.export_dir = mkdtemp()
self.addCleanup(rmtree, self.export_dir, ignore_errors=True)
@@ -164,8 +164,8 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest, PartitionTestCase):
with MongoContentstoreBuilder().build() as dest_content:
# Construct the modulestore for storing the second import (using the second contentstore)
with SPLIT_MODULESTORE_SETUP.build(contentstore=dest_content) as dest_store:
- source_course_key = source_store.make_course_key('a', 'source', '2015_Fall')
- dest_course_key = dest_store.make_course_key('a', 'dest', '2015_Fall')
+ source_course_key = source_store.make_course_key('a', 'source', '2015_Fall') # lint-amnesty, pylint: disable=no-member
+ dest_course_key = dest_store.make_course_key('a', 'dest', '2015_Fall') # lint-amnesty, pylint: disable=no-member
import_course_from_xml(
source_store,
@@ -186,7 +186,7 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest, PartitionTestCase):
EXPORTED_COURSE_DIR_NAME,
)
- source_course = source_store.get_course(source_course_key, depth=None, lazy=False)
+ source_course = source_store.get_course(source_course_key, depth=None, lazy=False) # lint-amnesty, pylint: disable=no-member
self.assertEqual(source_course.url_name, 'course')
@@ -206,6 +206,6 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest, PartitionTestCase):
create_if_not_present=True,
)
- dest_course = dest_store.get_course(dest_course_key, depth=None, lazy=False)
+ dest_course = dest_store.get_course(dest_course_key, depth=None, lazy=False) # lint-amnesty, pylint: disable=no-member
self.assertEqual(dest_course.url_name, 'course')
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_inheritance.py b/common/lib/xmodule/xmodule/modulestore/tests/test_inheritance.py
index c76c98f1e0..24234473ce 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_inheritance.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_inheritance.py
@@ -19,7 +19,7 @@ class TestXBlock:
"""
An empty Xblock, to be used, when creating a block with mixins.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@ddt.ddt
@@ -38,7 +38,7 @@ class TestInheritanceMixin(unittest.TestCase):
self.xblock = runtime.construct_xblock_from_class(
TestXBlock, ScopeIds('user', 'TestXBlock', 'def_id', 'usage_id')
)
- super(TestInheritanceMixin, self).setUp()
+ super(TestInheritanceMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
def add_submission_deadline_information(self, due_date, graceperiod, self_paced):
"""
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_libraries.py b/common/lib/xmodule/xmodule/modulestore/tests/test_libraries.py
index 202ae351da..72c0e35fa4 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_libraries.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_libraries.py
@@ -155,7 +155,7 @@ class TestLibraries(MixedSplitTestCase):
def test_get_libraries(self):
""" Test get_libraries() """
libraries = [LibraryFactory.create(modulestore=self.store) for _ in range(3)]
- lib_dict = dict([(lib.location.library_key, lib) for lib in libraries])
+ lib_dict = dict([(lib.location.library_key, lib) for lib in libraries]) # lint-amnesty, pylint: disable=consider-using-dict-comprehension
lib_list = self.store.get_libraries()
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
index 1e32991e13..74c119b051 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
@@ -128,7 +128,7 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest):
"""
Set up the database for testing
"""
- super(CommonMixedModuleStoreSetup, self).setUp()
+ super(CommonMixedModuleStoreSetup, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.exclude_field(None, 'wiki_slug')
self.exclude_field(None, 'xml_attributes')
@@ -162,7 +162,7 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest):
"""
# create course
with self.store.bulk_operations(course_key):
- self.course = self.store.create_course(course_key.org, course_key.course, course_key.run, self.user_id)
+ self.course = self.store.create_course(course_key.org, course_key.course, course_key.run, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
if isinstance(self.course.id, CourseLocator):
self.course_locations[self.MONGO_COURSEID] = self.course.location
else:
@@ -267,7 +267,7 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest):
"""
# set the default modulestore
store_configs = self.options['stores']
- for index in range(len(store_configs)):
+ for index in range(len(store_configs)): # lint-amnesty, pylint: disable=consider-using-enumerate
if store_configs[index]['NAME'] == default:
if index > 0:
store_configs[index], store_configs[0] = store_configs[0], store_configs[index]
@@ -390,7 +390,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
with check_mongo_calls(max_find.pop(0), max_send):
- self.assertTrue(self.store.has_item(self.problem_x1a_1))
+ self.assertTrue(self.store.has_item(self.problem_x1a_1)) # lint-amnesty, pylint: disable=no-member
# try negative cases
with check_mongo_calls(max_find.pop(0), max_send):
@@ -413,7 +413,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
with check_mongo_calls(max_find.pop(0), max_send):
- self.assertIsNotNone(self.store.get_item(self.problem_x1a_1))
+ self.assertIsNotNone(self.store.get_item(self.problem_x1a_1)) # lint-amnesty, pylint: disable=no-member
# try negative cases
with check_mongo_calls(max_find.pop(0), max_send):
@@ -460,7 +460,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.assertIsNone(course_version)
blocks = self.store.get_items(self.course.id, qualifiers={'category': 'problem'})
- blocks.append(self.store.get_item(self.problem_x1a_1))
+ blocks.append(self.store.get_item(self.problem_x1a_1)) # lint-amnesty, pylint: disable=no-member
self.assertEqual(len(blocks), 7)
for block in blocks:
self.assertEqual(block.course_version, course_version)
@@ -496,7 +496,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
items = self.store.get_items(course_key)
# Check items found are either course or about type
- self.assertTrue(set(['course', 'about']).issubset(set([item.location.block_type for item in items])))
+ self.assertTrue(set(['course', 'about']).issubset(set([item.location.block_type for item in items]))) # lint-amnesty, pylint: disable=consider-using-set-comprehension
# Assert that about is a detached category found in get_items
self.assertIn(
[item.location.block_type for item in items if item.location.block_type == 'about'][0],
@@ -526,7 +526,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
items_in_tree = self.store.get_items(course_key, include_orphans=False)
# Check that course and about blocks are found in get_items
- self.assertTrue(set(['course', 'about']).issubset(set([item.location.block_type for item in items_in_tree])))
+ self.assertTrue(set(['course', 'about']).issubset(set([item.location.block_type for item in items_in_tree]))) # lint-amnesty, pylint: disable=consider-using-set-comprehension
# Check orphan is found or not - this is based on mongo/split modulestore. It should be found in mongo.
self.assertEqual(orphan in [item.location for item in items_in_tree], orphan_in_items)
self.assertEqual(len(items_in_tree), expected_items_in_tree)
@@ -543,7 +543,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
"""
self.initdb(default_ms)
self._create_block_hierarchy()
- problem = self.store.get_item(self.problem_x1a_1)
+ problem = self.store.get_item(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
# if following raised, then the test is really a noop, change it
self.assertNotEqual(problem.max_attempts, 2, "Default changed making test meaningless")
problem.max_attempts = 2
@@ -750,11 +750,11 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
locations = {
- 'grandparent': self.chapter_x,
- 'parent_sibling': self.sequential_x2,
- 'parent': self.sequential_x1,
- 'child_sibling': self.vertical_x1b,
- 'child': self.vertical_x1a,
+ 'grandparent': self.chapter_x, # lint-amnesty, pylint: disable=no-member
+ 'parent_sibling': self.sequential_x2, # lint-amnesty, pylint: disable=no-member
+ 'parent': self.sequential_x1, # lint-amnesty, pylint: disable=no-member
+ 'child_sibling': self.vertical_x1b, # lint-amnesty, pylint: disable=no-member
+ 'child': self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
}
# Publish the vertical units
@@ -939,7 +939,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
if default_ms == ModuleStoreEnum.Type.mongo and mongo_uses_error_check(self.store):
max_find += 1
- with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.writable_chapter_location.course_key):
+ with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, self.writable_chapter_location.course_key): # lint-amnesty, pylint: disable=line-too-long
with check_mongo_calls(max_find, max_send):
self.store.delete_item(self.writable_chapter_location, self.user_id)
@@ -1140,8 +1140,8 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
with check_mongo_calls(max_find, max_send):
- parent = self.store.get_parent_location(self.problem_x1a_1)
- self.assertEqual(parent, self.vertical_x1a)
+ parent = self.store.get_parent_location(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
+ self.assertEqual(parent, self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
def verify_get_parent_locations_results(self, expected_results):
"""
@@ -1207,12 +1207,12 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Publish the course.
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Move child problem_x1a_1 to vertical_y1a.
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
updated_item_location = self.store.update_item_parent(
item_location, new_parent_location, old_parent_location, self.user_id
)
@@ -1234,12 +1234,12 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Publish the course
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Move child problem_x1a_1 to vertical_y1a.
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
updated_item_location = self.store.update_item_parent(
item_location, new_parent_location, old_parent_location, self.user_id
)
@@ -1271,12 +1271,12 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Publish the course
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Move child problem_x1a_1 to vertical_y1a.
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
updated_item_location = self.store.update_item_parent(
item_location, new_parent_location, old_parent_location, self.user_id
)
@@ -1312,12 +1312,12 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Publish the course
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Move child problem_x1a_1 to vertical_y1a.
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
updated_item_location = self.store.update_item_parent(
item_location, new_parent_location, old_parent_location, self.user_id
)
@@ -1361,21 +1361,21 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Publish the course.
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Move child problem_x1a_1 to vertical_y1a.
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
- problem = self.store.get_item(self.problem_x1a_1)
+ problem = self.store.get_item(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
orig_display_name = problem.display_name
# Change display name of problem and update just it.
problem.display_name = 'updated'
self.store.update_item(problem, self.user_id)
- updated_problem = self.store.get_item(self.problem_x1a_1)
+ updated_problem = self.store.get_item(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
self.assertEqual(updated_problem.display_name, 'updated')
# Now, move from x1 to y1.
@@ -1394,7 +1394,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.store.revert_to_published(old_parent_location, self.user_id)
# Check that problem has the original name back.
- reverted_problem = self.store.get_item(self.problem_x1a_1)
+ reverted_problem = self.store.get_item(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
self.assertEqual(orig_display_name, reverted_problem.display_name)
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
@@ -1407,14 +1407,14 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Create some children in vertical_x1a
- problem_item2 = self.store.create_child(self.user_id, self.vertical_x1a, 'problem', 'Problem_Item2')
+ problem_item2 = self.store.create_child(self.user_id, self.vertical_x1a, 'problem', 'Problem_Item2') # lint-amnesty, pylint: disable=no-member
# Publish the course.
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
# Move problem_x1a_1 from x1 to y1.
updated_item_location = self.store.update_item_parent(
@@ -1430,7 +1430,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# Check that problem_item2 is still present in vertical_x1a
problem_item2 = self.store.get_item(problem_item2.location)
- self.assertEqual(problem_item2.parent, self.vertical_x1a)
+ self.assertEqual(problem_item2.parent, self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
self.assertIn(problem_item2.location, problem_item2.get_parent().children)
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
@@ -1444,11 +1444,11 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Create some children in vertical_x1a
- problem_item2 = self.store.create_child(self.user_id, self.vertical_x1a, 'problem', 'Problem_Item2')
+ problem_item2 = self.store.create_child(self.user_id, self.vertical_x1a, 'problem', 'Problem_Item2') # lint-amnesty, pylint: disable=no-member
orig_display_name = problem_item2.display_name
# Publish the course.
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Edit problem_item2.
problem_item2.display_name = 'updated'
@@ -1457,9 +1457,9 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
updated_problem2 = self.store.get_item(problem_item2.location)
self.assertEqual(updated_problem2.display_name, 'updated')
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
# Move problem_x1a_1 from x1 to y1.
updated_item_location = self.store.update_item_parent(
@@ -1491,19 +1491,19 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# Create some children in vertical_x1a
- problem_item2 = self.store.create_child(self.user_id, self.vertical_x1a, 'problem', 'Problem_Item2')
- orig_display_name = problem_item2.display_name
+ problem_item2 = self.store.create_child(self.user_id, self.vertical_x1a, 'problem', 'Problem_Item2') # lint-amnesty, pylint: disable=no-member
+ orig_display_name = problem_item2.display_name # lint-amnesty, pylint: disable=unused-variable
# Publish the course.
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
# Now delete other problem problem_item2.
self.store.delete_item(problem_item2.location, self.user_id)
# Move child problem_x1a_1 to vertical_y1a.
- item_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ item_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
# Move problem_x1a_1 from x1 to y1.
updated_item_location = self.store.update_item_parent(
@@ -1522,7 +1522,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# Check that problem_item2 is also back in vertical_x1a
problem_item2 = self.store.get_item(problem_item2.location)
- self.assertEqual(problem_item2.parent, self.vertical_x1a)
+ self.assertEqual(problem_item2.parent, self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
self.assertIn(problem_item2.location, problem_item2.get_parent().children)
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
@@ -1531,17 +1531,17 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# publish the course
- self.course = self.store.publish(self.course.location, self.user_id)
+ self.course = self.store.publish(self.course.location, self.user_id) # lint-amnesty, pylint: disable=attribute-defined-outside-init
with self.store.bulk_operations(self.course.id):
# make drafts of verticals
- self.store.convert_to_draft(self.vertical_x1a, self.user_id)
- self.store.convert_to_draft(self.vertical_y1a, self.user_id)
+ self.store.convert_to_draft(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
+ self.store.convert_to_draft(self.vertical_y1a, self.user_id) # lint-amnesty, pylint: disable=no-member
# move child problem_x1a_1 to vertical_y1a
- child_to_move_location = self.problem_x1a_1
- new_parent_location = self.vertical_y1a
- old_parent_location = self.vertical_x1a
+ child_to_move_location = self.problem_x1a_1 # lint-amnesty, pylint: disable=no-member
+ new_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_x1a # lint-amnesty, pylint: disable=no-member
with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred):
old_parent = self.store.get_item(child_to_move_location).get_parent()
@@ -1585,11 +1585,11 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.store.publish(self.course.location, self.user_id)
# make draft of vertical
- self.store.convert_to_draft(self.vertical_y1a, self.user_id)
+ self.store.convert_to_draft(self.vertical_y1a, self.user_id) # lint-amnesty, pylint: disable=no-member
# delete child problem_y1a_1
- child_to_delete_location = self.problem_y1a_1
- old_parent_location = self.vertical_y1a
+ child_to_delete_location = self.problem_y1a_1 # lint-amnesty, pylint: disable=no-member
+ old_parent_location = self.vertical_y1a # lint-amnesty, pylint: disable=no-member
self.store.delete_item(child_to_delete_location, self.user_id)
self.verify_get_parent_locations_results([
@@ -1624,13 +1624,13 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
mongo_store = self.store._get_modulestore_for_courselike(course_id) # pylint: disable=protected-access
# add another parent (unit) "vertical_x1b" for problem "problem_x1a_1"
mongo_store.collection.update_one(
- self.vertical_x1b.to_deprecated_son('_id.'),
- {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}}
+ self.vertical_x1b.to_deprecated_son('_id.'), # lint-amnesty, pylint: disable=no-member
+ {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}} # lint-amnesty, pylint: disable=no-member
)
# convert first parent (unit) "vertical_x1a" of problem "problem_x1a_1" to draft
- self.store.convert_to_draft(self.vertical_x1a, self.user_id)
- item = self.store.get_item(self.vertical_x1a)
+ self.store.convert_to_draft(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
+ item = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
self.assertTrue(self.store.has_published_version(item))
# now problem "problem_x1a_1" has 3 parents [vertical_x1a (draft),
@@ -1639,8 +1639,8 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# published parent "vertical_x1a" without raising "AssertionError" for
# problem location revision
with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, course_id):
- parent = mongo_store.get_parent_location(self.problem_x1a_1)
- self.assertEqual(parent, self.vertical_x1a)
+ parent = mongo_store.get_parent_location(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
+ self.assertEqual(parent, self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
# Draft:
# Problem path:
@@ -1663,10 +1663,10 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
should_work = (
- (self.problem_x1a_2,
- (course_key, u"Chapter_x", u"Sequential_x1", u'Vertical_x1a', '1', self.problem_x1a_2)),
- (self.chapter_x,
- (course_key, "Chapter_x", None, None, None, self.chapter_x)),
+ (self.problem_x1a_2, # lint-amnesty, pylint: disable=no-member
+ (course_key, u"Chapter_x", u"Sequential_x1", u'Vertical_x1a', '1', self.problem_x1a_2)), # lint-amnesty, pylint: disable=no-member
+ (self.chapter_x, # lint-amnesty, pylint: disable=no-member
+ (course_key, "Chapter_x", None, None, None, self.chapter_x)), # lint-amnesty, pylint: disable=no-member
)
for location, expected in should_work:
@@ -1715,29 +1715,29 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.initdb(default_ms)
self._create_block_hierarchy()
- vertical = self.store.get_item(self.vertical_x1a)
+ vertical = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
vertical_children_num = len(vertical.children)
self.store.publish(self.course.location, self.user_id)
- self.assertFalse(self._has_changes(self.vertical_x1a))
+ self.assertFalse(self._has_changes(self.vertical_x1a)) # lint-amnesty, pylint: disable=no-member
# delete leaf problem (will make parent vertical a draft)
- self.store.delete_item(self.problem_x1a_1, self.user_id)
- self.assertTrue(self._has_changes(self.vertical_x1a))
+ self.store.delete_item(self.problem_x1a_1, self.user_id) # lint-amnesty, pylint: disable=no-member
+ self.assertTrue(self._has_changes(self.vertical_x1a)) # lint-amnesty, pylint: disable=no-member
- draft_parent = self.store.get_item(self.vertical_x1a)
+ draft_parent = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
self.assertEqual(vertical_children_num - 1, len(draft_parent.children))
published_parent = self.store.get_item(
- self.vertical_x1a,
+ self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
revision=ModuleStoreEnum.RevisionOption.published_only
)
self.assertEqual(vertical_children_num, len(published_parent.children))
- self.store.revert_to_published(self.vertical_x1a, self.user_id)
- reverted_parent = self.store.get_item(self.vertical_x1a)
+ self.store.revert_to_published(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
+ reverted_parent = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
self.assertEqual(vertical_children_num, len(published_parent.children))
self.assertBlocksEqualByFields(reverted_parent, published_parent)
- self.assertFalse(self._has_changes(self.vertical_x1a))
+ self.assertFalse(self._has_changes(self.vertical_x1a)) # lint-amnesty, pylint: disable=no-member
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_revert_to_published_root_published(self, default_ms):
@@ -1748,15 +1748,15 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
self.store.publish(self.course.location, self.user_id)
- problem = self.store.get_item(self.problem_x1a_1)
+ problem = self.store.get_item(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
orig_display_name = problem.display_name
# Change display name of problem and update just it (so parent remains published)
problem.display_name = "updated before calling revert"
self.store.update_item(problem, self.user_id)
- self.store.revert_to_published(self.vertical_x1a, self.user_id)
+ self.store.revert_to_published(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
- reverted_problem = self.store.get_item(self.problem_x1a_1)
+ reverted_problem = self.store.get_item(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
self.assertEqual(orig_display_name, reverted_problem.display_name)
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
@@ -1768,9 +1768,9 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
self.store.publish(self.course.location, self.user_id)
- orig_vertical = self.store.get_item(self.vertical_x1a)
- self.store.revert_to_published(self.vertical_x1a, self.user_id)
- reverted_vertical = self.store.get_item(self.vertical_x1a)
+ orig_vertical = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
+ self.store.revert_to_published(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
+ reverted_vertical = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
self.assertBlocksEqualByFields(orig_vertical, reverted_vertical)
@@ -1782,7 +1782,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.initdb(default_ms)
self._create_block_hierarchy()
with self.assertRaises(InvalidVersionError):
- self.store.revert_to_published(self.vertical_x1a, self.user_id)
+ self.store.revert_to_published(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_revert_to_published_direct_only(self, default_ms):
@@ -1791,9 +1791,9 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
"""
self.initdb(default_ms)
self._create_block_hierarchy()
- num_children = len(self.store.get_item(self.sequential_x1).children)
- self.store.revert_to_published(self.sequential_x1, self.user_id)
- reverted_parent = self.store.get_item(self.sequential_x1)
+ num_children = len(self.store.get_item(self.sequential_x1).children) # lint-amnesty, pylint: disable=no-member
+ self.store.revert_to_published(self.sequential_x1, self.user_id) # lint-amnesty, pylint: disable=no-member
+ reverted_parent = self.store.get_item(self.sequential_x1) # lint-amnesty, pylint: disable=no-member
# It does not discard the child vertical, even though that child is a draft (with no published version)
self.assertEqual(num_children, len(reverted_parent.children))
@@ -1808,7 +1808,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# Get children of a vertical as a set.
# We will use this set as a basis for content comparision in this test.
- original_vertical = self.store.get_item(self.vertical_x1a)
+ original_vertical = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
original_vertical_children = set(original_vertical.children)
# Find the version_guid of our course by diving into Split Mongo.
@@ -1823,16 +1823,16 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
original_version_guid,
self.user_id,
)
- noop_reset_vertical = self.store.get_item(self.vertical_x1a)
+ noop_reset_vertical = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
assert set(noop_reset_vertical.children) == original_vertical_children
# Delete a problem from the vertical and publish.
# Vertical should have one less problem than before.
- self.store.delete_item(self.problem_x1a_1, self.user_id)
+ self.store.delete_item(self.problem_x1a_1, self.user_id) # lint-amnesty, pylint: disable=no-member
self.store.publish(self.course.location, self.user_id)
- modified_vertical = self.store.get_item(self.vertical_x1a)
+ modified_vertical = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
assert set(modified_vertical.children) == (
- original_vertical_children - {self.problem_x1a_1}
+ original_vertical_children - {self.problem_x1a_1} # lint-amnesty, pylint: disable=no-member
)
# Add a couple more children to the vertical.
@@ -1840,14 +1840,14 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# We want to make sure we can restore from something a few versions back.
self.store.create_child(
self.user_id,
- self.vertical_x1a,
+ self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
'problem',
block_id='new_child1',
)
self.store.publish(self.course.location, self.user_id)
self.store.create_child(
self.user_id,
- self.vertical_x1a,
+ self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
'problem',
block_id='new_child2',
)
@@ -1857,7 +1857,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# We want to make sure that this works with a dirty draft branch.
self.store.create_child(
self.user_id,
- self.vertical_x1a,
+ self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
'problem',
block_id='new_child3',
)
@@ -1869,7 +1869,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
original_version_guid,
self.user_id,
)
- restored_vertical = self.store.get_item(self.vertical_x1a)
+ restored_vertical = self.store.get_item(self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
assert set(restored_vertical.children) == original_vertical_children
def _get_split_modulestore(self):
@@ -1942,8 +1942,8 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# test that problem "problem_x1a_1" has only one published parent
mongo_store = self.store._get_modulestore_for_courselike(course_id) # pylint: disable=protected-access
with self.store.branch_setting(ModuleStoreEnum.Branch.published_only, course_id):
- parent = mongo_store.get_parent_location(self.problem_x1a_1)
- self.assertEqual(parent, self.vertical_x1a)
+ parent = mongo_store.get_parent_location(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
+ self.assertEqual(parent, self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
# add some published orphans
orphan_sequential = course_id.make_usage_key('sequential', 'OrphanSequential')
@@ -1965,29 +1965,29 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# add orphan vertical and sequential as another parents of problem "problem_x1a_1"
mongo_store.collection.update_one(
orphan_sequential.to_deprecated_son('_id.'),
- {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}}
+ {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}} # lint-amnesty, pylint: disable=no-member
)
mongo_store.collection.update_one(
orphan_vertical.to_deprecated_son('_id.'),
- {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}}
+ {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}} # lint-amnesty, pylint: disable=no-member
)
# test that "get_parent_location" method of published branch still returns the correct non-orphan parent for
# problem "problem_x1a_1" since the two other parents are orphans
with self.store.branch_setting(ModuleStoreEnum.Branch.published_only, course_id):
- parent = mongo_store.get_parent_location(self.problem_x1a_1)
- self.assertEqual(parent, self.vertical_x1a)
+ parent = mongo_store.get_parent_location(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
+ self.assertEqual(parent, self.vertical_x1a) # lint-amnesty, pylint: disable=no-member
# now add valid published vertical as another parent of problem
mongo_store.collection.update_one(
- self.sequential_x1.to_deprecated_son('_id.'),
- {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}}
+ self.sequential_x1.to_deprecated_son('_id.'), # lint-amnesty, pylint: disable=no-member
+ {'$push': {'definition.children': six.text_type(self.problem_x1a_1)}} # lint-amnesty, pylint: disable=no-member
)
# now check that "get_parent_location" method of published branch raises "ReferentialIntegrityError" for
# problem "problem_x1a_1" since it has now 2 valid published parents
with self.store.branch_setting(ModuleStoreEnum.Branch.published_only, course_id):
- self.assertTrue(self.store.has_item(self.problem_x1a_1))
+ self.assertTrue(self.store.has_item(self.problem_x1a_1)) # lint-amnesty, pylint: disable=no-member
with self.assertRaises(ReferentialIntegrityError):
- self.store.get_parent_location(self.problem_x1a_1)
+ self.store.get_parent_location(self.problem_x1a_1) # lint-amnesty, pylint: disable=no-member
@ddt.data(ModuleStoreEnum.Type.mongo)
def test_create_item_from_parent_location(self, default_ms):
@@ -2072,24 +2072,24 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# publish
self.store.publish(self.course.location, self.user_id)
published_xblock = self.store.get_item(
- self.vertical_x1a,
+ self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
revision=ModuleStoreEnum.RevisionOption.published_only
)
self.assertIsNotNone(published_xblock)
# unpublish
with check_mongo_calls(max_find, max_send):
- self.store.unpublish(self.vertical_x1a, self.user_id)
+ self.store.unpublish(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
with self.assertRaises(ItemNotFoundError):
self.store.get_item(
- self.vertical_x1a,
+ self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
revision=ModuleStoreEnum.RevisionOption.published_only
)
# make sure draft version still exists
draft_xblock = self.store.get_item(
- self.vertical_x1a,
+ self.vertical_x1a, # lint-amnesty, pylint: disable=no-member
revision=ModuleStoreEnum.RevisionOption.draft_only
)
self.assertIsNotNone(draft_xblock)
@@ -2106,7 +2106,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self._create_block_hierarchy()
# start off as Private
- item = self.store.create_child(self.user_id, self.writable_chapter_location, 'problem', 'test_compute_publish_state')
+ item = self.store.create_child(self.user_id, self.writable_chapter_location, 'problem', 'test_compute_publish_state') # lint-amnesty, pylint: disable=line-too-long
item_location = item.location
with check_mongo_calls(max_find, max_send):
self.assertFalse(self.store.has_published_version(item))
@@ -2405,7 +2405,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.initdb(default_ms)
self._create_block_hierarchy()
- problem_location = self.problem_x1a_1.for_branch(None)
+ problem_location = self.problem_x1a_1.for_branch(None) # lint-amnesty, pylint: disable=no-member
problem_original_name = 'Problem_x1a_1'
course_key = problem_location.course_key
@@ -2443,7 +2443,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
self.store.get_item(problem_location)
# PUBLISH the problem
- self.store.publish(self.vertical_x1a, self.user_id)
+ self.store.publish(self.vertical_x1a, self.user_id) # lint-amnesty, pylint: disable=no-member
self.store.publish(problem_location, self.user_id)
# verify Published problem
@@ -3048,7 +3048,7 @@ class TestPublishOverExportImport(CommonMixedModuleStoreSetup):
"""
Set up the database for testing
"""
- super(TestPublishOverExportImport, self).setUp()
+ super(TestPublishOverExportImport, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user_id = ModuleStoreEnum.UserID.test
self.export_dir = mkdtemp()
@@ -3657,7 +3657,7 @@ class TestAsidesWithMixedModuleStore(CommonMixedModuleStoreSetup):
"""
Setup environment for testing
"""
- super(TestAsidesWithMixedModuleStore, self).setUp()
+ super(TestAsidesWithMixedModuleStore, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
key_store = DictKeyValueStore()
field_data = KvsFieldData(key_store)
self.runtime = TestRuntime(services={'field-data': field_data})
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
index 9ad1f88f0d..bd197b4308 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore.py
@@ -5,7 +5,7 @@ This file should potentially be renamed "utilties" since this file contains no t
"""
-def check_has_course_method(modulestore, locator, locator_key_fields):
+def check_has_course_method(modulestore, locator, locator_key_fields): # lint-amnesty, pylint: disable=missing-function-docstring
error_message = "Called has_course with query {0} and ignore_case is {1}."
for ignore_case in [True, False]:
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore_settings.py b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore_settings.py
index 1846fd8ba8..79b25f12ce 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore_settings.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_modulestore_settings.py
@@ -149,7 +149,7 @@ class ModuleStoreSettingsMigration(TestCase):
"""
stores = get_mixed_stores(mixed_setting)
split_settings = [store for store in stores if store['ENGINE'].endswith('.DraftVersioningModuleStore')]
- if len(split_settings):
+ if len(split_settings): # lint-amnesty, pylint: disable=len-as-condition
# there should only be one setting for split
self.assertEqual(len(split_settings), 1)
# verify name
@@ -193,7 +193,7 @@ class ModuleStoreSettingsMigration(TestCase):
def test_no_conversion(self):
# make sure there is no migration done on an already updated config
old_mixed_setting = self.ALREADY_UPDATED_MIXED_CONFIG
- new_mixed_setting, new_default_store_setting = self.assertMigrated(old_mixed_setting)
+ new_mixed_setting, new_default_store_setting = self.assertMigrated(old_mixed_setting) # lint-amnesty, pylint: disable=unused-variable
self.assertTrue(self.is_split_configured(new_mixed_setting))
self.assertEqual(old_mixed_setting, new_mixed_setting)
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
index a381d2f63f..d1c6bd2c73 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
@@ -13,7 +13,7 @@ import pymongo
import pytest
import six
-# pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
# pylint: disable=protected-access
from django.test import TestCase
# pylint: enable=E0611
@@ -80,7 +80,7 @@ class TestMongoModuleStoreBase(TestCase):
courses = ['toy', 'simple', 'simple_with_draft', 'test_unicode']
@classmethod
- def setUpClass(cls):
+ def setUpClass(cls): # lint-amnesty, pylint: disable=super-method-not-called
cls.connection = pymongo.MongoClient(
host=HOST,
port=PORT,
@@ -95,7 +95,7 @@ class TestMongoModuleStoreBase(TestCase):
cls.content_store, cls.draft_store = cls.initdb()
@classmethod
- def tearDownClass(cls):
+ def tearDownClass(cls): # lint-amnesty, pylint: disable=super-method-not-called
if cls.connection:
cls.connection.drop_database(DB)
cls.connection.close()
@@ -105,10 +105,10 @@ class TestMongoModuleStoreBase(TestCase):
"""
No asset collection.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@classmethod
- def initdb(cls):
+ def initdb(cls): # lint-amnesty, pylint: disable=missing-function-docstring
# connect to the db
doc_store_config = {
'host': HOST,
@@ -173,7 +173,7 @@ class TestMongoModuleStoreBase(TestCase):
connection.drop_database(DB)
def setUp(self):
- super(TestMongoModuleStoreBase, self).setUp()
+ super(TestMongoModuleStoreBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.dummy_user = ModuleStoreEnum.UserID.test
@@ -185,7 +185,7 @@ class TestMongoModuleStore(TestMongoModuleStoreBase):
"""
No asset collection - it's not used in the tests below.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@classmethod
def setUpClass(cls):
@@ -496,7 +496,7 @@ class TestMongoModuleStore(TestMongoModuleStoreBase):
block_id='p2',
runtime=course.runtime
)
- self.refloc = course.id.make_usage_key('ref_test', 'ref_test')
+ self.refloc = course.id.make_usage_key('ref_test', 'ref_test') # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.draft_store.create_item(
99,
self.refloc.course_key,
@@ -616,7 +616,7 @@ class TestMongoModuleStore(TestMongoModuleStoreBase):
course = 'tree{}'.format(name)
run = name
- if not self.draft_store.has_course(CourseKey.from_string('/'.join[org, course, run])):
+ if not self.draft_store.has_course(CourseKey.from_string('/'.join[org, course, run])): # lint-amnesty, pylint: disable=unsubscriptable-object
self.draft_store.create_course(org, course, run, user_id)
locations = {
@@ -718,7 +718,7 @@ class TestMongoModuleStore(TestMongoModuleStoreBase):
self.assertEqual(root_block_key.block_id, "2015")
-class TestMongoModuleStoreWithNoAssetCollection(TestMongoModuleStore):
+class TestMongoModuleStoreWithNoAssetCollection(TestMongoModuleStore): # lint-amnesty, pylint: disable=test-inherits-tests
'''
Tests a situation where no asset_collection is specified.
'''
@@ -728,7 +728,7 @@ class TestMongoModuleStoreWithNoAssetCollection(TestMongoModuleStore):
"""
No asset collection.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@classmethod
def setUpClass(cls):
@@ -756,7 +756,7 @@ class TestMongoKeyValueStore(TestCase):
"""
def setUp(self):
- super(TestMongoKeyValueStore, self).setUp()
+ super(TestMongoKeyValueStore, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.data = {'foo': 'foo_value'}
self.course_id = CourseKey.from_string('org/course/run')
self.parent = self.course_id.make_usage_key('parent', 'p')
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py
index 36d4962c43..deb0b78a54 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py
@@ -10,7 +10,7 @@ from unittest import TestCase, skip
import ddt
import six
-from django.test import TestCase
+from django.test import TestCase # lint-amnesty, pylint: disable=reimported
from xmodule.modulestore.tests.factories import check_mongo_calls
from xmodule.modulestore.tests.utils import (
@@ -35,7 +35,7 @@ class CountMongoCallsXMLRoundtrip(TestCase):
"""
def setUp(self):
- super(CountMongoCallsXMLRoundtrip, self).setUp()
+ super(CountMongoCallsXMLRoundtrip, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.export_dir = mkdtemp()
self.addCleanup(rmtree, self.export_dir, ignore_errors=True)
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_publish.py b/common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
index ef24f19f4b..d7be15c5d3 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_publish.py
@@ -38,7 +38,7 @@ class TestPublish(SplitWMongoCourseBootstrapper):
"""
Test the publish code (primary causing orphans)
"""
- def _create_course(self):
+ def _create_course(self): # lint-amnesty, pylint: disable=arguments-differ
"""
Create the course, publish all verticals
* some detached items
@@ -47,17 +47,17 @@ class TestPublish(SplitWMongoCourseBootstrapper):
# create course: finds: 1 to verify uniqueness, 1 to find parents
# sends: 1 to create course, 1 to create overview
with check_mongo_calls(4, 2):
- super(TestPublish, self)._create_course(split=False) # 2 inserts (course and overview)
+ super(TestPublish, self)._create_course(split=False) # 2 inserts (course and overview) # lint-amnesty, pylint: disable=super-with-arguments
# with bulk will delay all inheritance computations which won't be added into the mongo_calls
with self.draft_mongo.bulk_operations(self.old_course_key):
# finds: 1 for parent to add child and 2 to get ancestors
# sends: 1 for insert, 1 for parent (add child)
with check_mongo_calls(3, 2):
- self._create_item('chapter', 'Chapter1', {}, {'display_name': 'Chapter 1'}, 'course', 'runid', split=False)
+ self._create_item('chapter', 'Chapter1', {}, {'display_name': 'Chapter 1'}, 'course', 'runid', split=False) # lint-amnesty, pylint: disable=line-too-long
with check_mongo_calls(4, 2):
- self._create_item('chapter', 'Chapter2', {}, {'display_name': 'Chapter 2'}, 'course', 'runid', split=False)
+ self._create_item('chapter', 'Chapter2', {}, {'display_name': 'Chapter 2'}, 'course', 'runid', split=False) # lint-amnesty, pylint: disable=line-too-long
# For each vertical (2) created:
# - load draft
# - load non-draft
@@ -66,8 +66,8 @@ class TestPublish(SplitWMongoCourseBootstrapper):
# - get ancestors
# - load inheritable data
with check_mongo_calls(15, 6):
- self._create_item('vertical', 'Vert1', {}, {'display_name': 'Vertical 1'}, 'chapter', 'Chapter1', split=False)
- self._create_item('vertical', 'Vert2', {}, {'display_name': 'Vertical 2'}, 'chapter', 'Chapter1', split=False)
+ self._create_item('vertical', 'Vert1', {}, {'display_name': 'Vertical 1'}, 'chapter', 'Chapter1', split=False) # lint-amnesty, pylint: disable=line-too-long
+ self._create_item('vertical', 'Vert2', {}, {'display_name': 'Vertical 2'}, 'chapter', 'Chapter1', split=False) # lint-amnesty, pylint: disable=line-too-long
# For each (4) item created
# - try to find draft
# - try to find non-draft
@@ -75,10 +75,10 @@ class TestPublish(SplitWMongoCourseBootstrapper):
# - load draft parent again & compute its parent chain up to course
# count for updates increased to 16 b/c of edit_info updating
with check_mongo_calls(36, 16):
- self._create_item('html', 'Html1', "Goodbye
", {'display_name': 'Parented Html'}, 'vertical', 'Vert1', split=False)
+ self._create_item('html', 'Html1', "Goodbye
", {'display_name': 'Parented Html'}, 'vertical', 'Vert1', split=False) # lint-amnesty, pylint: disable=line-too-long
self._create_item(
'discussion', 'Discussion1',
- "discussion discussion_category=\"Lecture 1\" discussion_id=\"a08bfd89b2aa40fa81f2c650a9332846\" discussion_target=\"Lecture 1\"/>\n",
+ "discussion discussion_category=\"Lecture 1\" discussion_id=\"a08bfd89b2aa40fa81f2c650a9332846\" discussion_target=\"Lecture 1\"/>\n", # lint-amnesty, pylint: disable=line-too-long
{
"discussion_category": "Lecture 1",
"discussion_target": "Lecture 1",
@@ -88,10 +88,10 @@ class TestPublish(SplitWMongoCourseBootstrapper):
'vertical', 'Vert1',
split=False
)
- self._create_item('html', 'Html2', "Hello
", {'display_name': 'Hollow Html'}, 'vertical', 'Vert1', split=False)
+ self._create_item('html', 'Html2', "Hello
", {'display_name': 'Hollow Html'}, 'vertical', 'Vert1', split=False) # lint-amnesty, pylint: disable=line-too-long
self._create_item(
'discussion', 'Discussion2',
- "discussion discussion_category=\"Lecture 2\" discussion_id=\"b08bfd89b2aa40fa81f2c650a9332846\" discussion_target=\"Lecture 2\"/>\n",
+ "discussion discussion_category=\"Lecture 2\" discussion_id=\"b08bfd89b2aa40fa81f2c650a9332846\" discussion_target=\"Lecture 2\"/>\n", # lint-amnesty, pylint: disable=line-too-long
{
"discussion_category": "Lecture 2",
"discussion_target": "Lecture 2",
@@ -104,8 +104,8 @@ class TestPublish(SplitWMongoCourseBootstrapper):
with check_mongo_calls(2, 2):
# 2 finds b/c looking for non-existent parents
- self._create_item('static_tab', 'staticuno', "tab
", {'display_name': 'Tab uno'}, None, None, split=False)
- self._create_item('course_info', 'updates', "Sep 22
test
", {}, None, None, split=False)
+ self._create_item('static_tab', 'staticuno', "tab
", {'display_name': 'Tab uno'}, None, None, split=False) # lint-amnesty, pylint: disable=line-too-long
+ self._create_item('course_info', 'updates', "Sep 22
test
", {}, None, None, split=False) # lint-amnesty, pylint: disable=line-too-long
def test_publish_draft_delete(self):
"""
@@ -275,7 +275,7 @@ class DraftPublishedOpTestCourseSetup(unittest.TestCase):
# data needed to check the OLX.
self.course_db = {}
- super(DraftPublishedOpTestCourseSetup, self).setUp()
+ super(DraftPublishedOpTestCourseSetup, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
class OLXFormatChecker(unittest.TestCase):
@@ -508,7 +508,7 @@ class DraftPublishedOpBaseTestSetup(OLXFormatChecker, DraftPublishedOpTestCourse
EXPORTED_COURSE_AFTER_DIR_NAME = u'exported_course_after_{}'
def setUp(self):
- super(DraftPublishedOpBaseTestSetup, self).setUp()
+ super(DraftPublishedOpBaseTestSetup, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.export_dir = self.EXPORTED_COURSE_BEFORE_DIR_NAME
self.root_export_dir = None
self.contentstore = None
@@ -1024,7 +1024,7 @@ class ElementalDeleteItemTests(DraftPublishedOpBaseTestSetup):
# Weirdly, this is a difference between old Mongo -and- old Mongo wrapped with a mixed modulestore.
# When the code attempts and fails to delete the draft vertical using the published_only revision,
# the draft children are still around in one case and not in the other? Needs investigation.
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
if (
isinstance(modulestore_builder, MongoModulestoreBuilder) and
revision == ModuleStoreEnum.RevisionOption.published_only
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_semantics.py b/common/lib/xmodule/xmodule/modulestore/tests/test_semantics.py
index a8bc3c3554..e432aef030 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_semantics.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_semantics.py
@@ -58,7 +58,7 @@ class DirectOnlyCategorySemantics(PureModulestoreTestCase):
ASIDE_DATA_FIELD = TestField('content', 'aside test data
', 'aside different test data
')
def setUp(self):
- super(DirectOnlyCategorySemantics, self).setUp()
+ super(DirectOnlyCategorySemantics, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.course = CourseFactory.create(
org='test_org',
number='999',
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_migrator.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_migrator.py
index 32680a7e06..89d1e0c2f9 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_migrator.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_migrator.py
@@ -24,10 +24,10 @@ class TestMigration(SplitWMongoCourseBootstrapper):
"""
def setUp(self):
- super(TestMigration, self).setUp()
+ super(TestMigration, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.migrator = SplitMigrator(self.split_mongo, self.draft_mongo)
- def _create_course(self):
+ def _create_course(self): # lint-amnesty, pylint: disable=arguments-differ
"""
A course testing all of the conversion mechanisms:
* some inheritable settings
@@ -35,7 +35,7 @@ class TestMigration(SplitWMongoCourseBootstrapper):
only the live ones get to published. Some are only draft, some are both, some are only live.
* about, static_tab, and conditional documents
"""
- super(TestMigration, self)._create_course(split=False)
+ super(TestMigration, self)._create_course(split=False) # lint-amnesty, pylint: disable=super-with-arguments
# chapters
chapter1_name = uuid.uuid4().hex
@@ -54,7 +54,7 @@ class TestMigration(SplitWMongoCourseBootstrapper):
# vertical in both live and draft
both_vert_loc = self.old_course_key.make_usage_key('vertical', uuid.uuid4().hex)
self._create_item(
- both_vert_loc.block_type, both_vert_loc.block_id, {}, {'display_name': 'Both vertical'}, 'chapter', chapter1_name,
+ both_vert_loc.block_type, both_vert_loc.block_id, {}, {'display_name': 'Both vertical'}, 'chapter', chapter1_name, # lint-amnesty, pylint: disable=line-too-long
draft=False, split=False
)
self.create_random_units(False, both_vert_loc)
@@ -65,13 +65,13 @@ class TestMigration(SplitWMongoCourseBootstrapper):
# vertical in draft only (x2)
draft_vert_loc = self.old_course_key.make_usage_key('vertical', uuid.uuid4().hex)
self._create_item(
- draft_vert_loc.block_type, draft_vert_loc.block_id, {}, {'display_name': 'Draft vertical'}, 'chapter', chapter1_name,
+ draft_vert_loc.block_type, draft_vert_loc.block_id, {}, {'display_name': 'Draft vertical'}, 'chapter', chapter1_name, # lint-amnesty, pylint: disable=line-too-long
draft=True, split=False
)
self.create_random_units(True, draft_vert_loc)
draft_vert_loc = self.old_course_key.make_usage_key('vertical', uuid.uuid4().hex)
self._create_item(
- draft_vert_loc.block_type, draft_vert_loc.block_id, {}, {'display_name': 'Draft vertical2'}, 'chapter', chapter1_name,
+ draft_vert_loc.block_type, draft_vert_loc.block_id, {}, {'display_name': 'Draft vertical2'}, 'chapter', chapter1_name, # lint-amnesty, pylint: disable=line-too-long
draft=True, split=False
)
self.create_random_units(True, draft_vert_loc)
@@ -79,7 +79,7 @@ class TestMigration(SplitWMongoCourseBootstrapper):
# and finally one in live only (so published has to skip 2 preceding sibs)
live_vert_loc = self.old_course_key.make_usage_key('vertical', uuid.uuid4().hex)
self._create_item(
- live_vert_loc.block_type, live_vert_loc.block_id, {}, {'display_name': 'Live vertical end'}, 'chapter', chapter1_name,
+ live_vert_loc.block_type, live_vert_loc.block_id, {}, {'display_name': 'Live vertical end'}, 'chapter', chapter1_name, # lint-amnesty, pylint: disable=line-too-long
draft=False, split=False
)
self.create_random_units(False, live_vert_loc)
@@ -151,7 +151,7 @@ class TestMigration(SplitWMongoCourseBootstrapper):
draft=draft, split=False
)
- def compare_courses(self, presplit, new_course_key, published):
+ def compare_courses(self, presplit, new_course_key, published): # lint-amnesty, pylint: disable=missing-function-docstring
# descend via children to do comparison
old_root = presplit.get_course(self.old_course_key)
new_root = self.split_mongo.get_course(new_course_key)
@@ -163,7 +163,7 @@ class TestMigration(SplitWMongoCourseBootstrapper):
locator = new_course_key.make_usage_key(category, conditional.location.block_id)
self.compare_dags(presplit, conditional, self.split_mongo.get_item(locator), published)
- def compare_dags(self, presplit, presplit_dag_root, split_dag_root, published):
+ def compare_dags(self, presplit, presplit_dag_root, split_dag_root, published): # lint-amnesty, pylint: disable=missing-function-docstring
if split_dag_root.category != 'course':
self.assertEqual(presplit_dag_root.location.block_id, split_dag_root.location.block_id)
# compare all fields but references
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
index c0559a4c64..cf8991044a 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
@@ -531,7 +531,7 @@ class SplitModuleTest(unittest.TestCase):
elif spec['parent'] == course.location.block_id:
parent = course
else:
- block_usage = BlockUsageLocator.make_relative(course.location, spec['parent_type'], spec['parent'])
+ block_usage = BlockUsageLocator.make_relative(course.location, spec['parent_type'], spec['parent']) # lint-amnesty, pylint: disable=line-too-long
parent = split_store.get_item(block_usage)
block_id = LocalId(spec['id'])
child = split_store.create_xblock(
@@ -550,7 +550,7 @@ class SplitModuleTest(unittest.TestCase):
split_store.copy("test@edx.org", source_course, destination, [to_publish], None)
def setUp(self):
- super(SplitModuleTest, self).setUp()
+ super(SplitModuleTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user_id = random.getrandbits(32)
def tearDown(self):
@@ -561,7 +561,7 @@ class SplitModuleTest(unittest.TestCase):
modulestore()._drop_database(database=False, connections=False) # pylint: disable=protected-access
# drop the modulestore to force re init
SplitModuleTest.modulestore = None
- super(SplitModuleTest, self).tearDown()
+ super(SplitModuleTest, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
def findByIdInResult(self, collection, _id): # pylint: disable=invalid-name
"""
@@ -758,9 +758,9 @@ class SplitModuleCourseTests(SplitModuleTest):
with self.assertRaises(InsufficientSpecificationError):
modulestore().get_course(CourseLocator(org='edu', course='meh', run='blah'))
with self.assertRaises(ItemNotFoundError):
- modulestore().get_course(CourseLocator(org='edu', course='nosuchthing', run="run", branch=BRANCH_NAME_DRAFT))
+ modulestore().get_course(CourseLocator(org='edu', course='nosuchthing', run="run", branch=BRANCH_NAME_DRAFT)) # lint-amnesty, pylint: disable=line-too-long
with self.assertRaises(ItemNotFoundError):
- modulestore().get_course(CourseLocator(org='testx', course='GreekHero', run="run", branch=BRANCH_NAME_PUBLISHED))
+ modulestore().get_course(CourseLocator(org='testx', course='GreekHero', run="run", branch=BRANCH_NAME_PUBLISHED)) # lint-amnesty, pylint: disable=line-too-long
@patch('xmodule.tabs.CourseTab.from_json', side_effect=mock_tab_from_json)
def test_cache(self, _from_json):
@@ -959,7 +959,7 @@ class TestCourseStructureCache(SplitModuleTest):
'org', 'course', 'test_run', self.user, BRANCH_NAME_DRAFT,
)
- super(TestCourseStructureCache, self).setUp()
+ super(TestCourseStructureCache, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
@patch('xmodule.modulestore.split_mongo.mongo_connection.get_cache')
def test_course_structure_cache(self, mock_get_cache):
@@ -1144,7 +1144,7 @@ class SplitModuleItemTests(SplitModuleTest):
# in published course
locator = BlockUsageLocator(
- CourseLocator(org='testx', course='wonderful', run="run", branch=BRANCH_NAME_PUBLISHED), 'course', 'head23456'
+ CourseLocator(org='testx', course='wonderful', run="run", branch=BRANCH_NAME_PUBLISHED), 'course', 'head23456' # lint-amnesty, pylint: disable=line-too-long
)
self.assertIsInstance(
modulestore().get_item(locator),
@@ -1154,7 +1154,7 @@ class SplitModuleItemTests(SplitModuleTest):
# negative tests--not found
# no such course or block
locator = BlockUsageLocator(
- CourseLocator(org='doesnotexist', course='doesnotexist', run="run", branch=BRANCH_NAME_DRAFT), 'course', 'head23456'
+ CourseLocator(org='doesnotexist', course='doesnotexist', run="run", branch=BRANCH_NAME_DRAFT), 'course', 'head23456' # lint-amnesty, pylint: disable=line-too-long
)
with self.assertRaises(ItemNotFoundError):
modulestore().get_item(locator)
@@ -1325,7 +1325,7 @@ class TestItemCrud(SplitModuleTest):
# check that course version changed and course's previous is the other one
self.assertEqual(new_module.location.course, "GreekHero")
self.assertNotEqual(new_module.location.version_guid, premod_course.location.version_guid)
- self.assertIsNone(locator.version_guid, "Version inadvertently filled in")
+ self.assertIsNone(locator.version_guid, "Version inadvertently filled in") # lint-amnesty, pylint: disable=no-member
current_course = modulestore().get_course(locator)
self.assertEqual(new_module.location.version_guid, current_course.location.version_guid)
@@ -1449,7 +1449,7 @@ class TestItemCrud(SplitModuleTest):
user = random.getrandbits(32)
course_key = CourseLocator('test_org', 'test_transaction', 'test_run')
with modulestore().bulk_operations(course_key):
- new_course = modulestore().create_course('test_org', 'test_transaction', 'test_run', user, BRANCH_NAME_DRAFT)
+ new_course = modulestore().create_course('test_org', 'test_transaction', 'test_run', user, BRANCH_NAME_DRAFT) # lint-amnesty, pylint: disable=line-too-long
new_course_locator = new_course.id
index_history_info = modulestore().get_course_history_info(new_course.location.course_key)
course_block_prev_version = new_course.previous_version
@@ -2005,12 +2005,12 @@ class TestInheritance(SplitModuleTest):
# set on parent, retrieve child, verify setting
chapter = modulestore().get_item(
BlockUsageLocator(
- CourseLocator(org='testx', course='GreekHero', run="run", branch=BRANCH_NAME_DRAFT), 'chapter', 'chapter3'
+ CourseLocator(org='testx', course='GreekHero', run="run", branch=BRANCH_NAME_DRAFT), 'chapter', 'chapter3' # lint-amnesty, pylint: disable=line-too-long
)
)
problem = modulestore().get_item(
BlockUsageLocator(
- CourseLocator(org='testx', course='GreekHero', run="run", branch=BRANCH_NAME_DRAFT), 'problem', 'problem3_2'
+ CourseLocator(org='testx', course='GreekHero', run="run", branch=BRANCH_NAME_DRAFT), 'problem', 'problem3_2' # lint-amnesty, pylint: disable=line-too-long
)
)
self.assertFalse(problem.visible_to_staff_only)
@@ -2038,7 +2038,7 @@ class TestInheritance(SplitModuleTest):
chapter.visible_to_staff_only = True
orphan_problem = modulestore().create_item(self.user_id, course_key, 'problem')
self.assertFalse(orphan_problem.visible_to_staff_only)
- parented_problem = modulestore().create_child(self.user_id, chapter.location.version_agnostic(), 'problem')
+ parented_problem = modulestore().create_child(self.user_id, chapter.location.version_agnostic(), 'problem') # lint-amnesty, pylint: disable=unused-variable
# FIXME LMS-11376
# self.assertTrue(parented_problem.visible_to_staff_only)
@@ -2155,7 +2155,7 @@ class TestPublish(SplitModuleTest):
BlockKey("chapter", "chapter3"),
BlockKey("problem", "problem1")
]
- self._check_course(source_course, dest_course, expected, [BlockKey("chapter", "chapter2"), BlockKey("problem", "problem3_2")])
+ self._check_course(source_course, dest_course, expected, [BlockKey("chapter", "chapter2"), BlockKey("problem", "problem3_2")]) # lint-amnesty, pylint: disable=line-too-long
@contract(expected_blocks="list(BlockKey)", unexpected_blocks="list(BlockKey)")
def _check_course(self, source_course_loc, dest_course_loc, expected_blocks, unexpected_blocks):
@@ -2190,7 +2190,7 @@ class TestPublish(SplitModuleTest):
with self.assertRaises(ItemNotFoundError):
modulestore().get_item(dest_course_loc.make_usage_key(unexp.type, unexp.id))
- def assertReferenceEqual(self, expected, actual):
+ def assertReferenceEqual(self, expected, actual): # lint-amnesty, pylint: disable=missing-function-docstring
if isinstance(expected, BlockUsageLocator):
expected = BlockKey.from_usage_key(expected)
actual = BlockKey.from_usage_key(actual)
@@ -2266,7 +2266,7 @@ def modulestore():
options.update(SplitModuleTest.MODULESTORE['OPTIONS'])
options['render_template'] = render_to_template_mock
- # pylint: disable=star-args
+ # lint-amnesty, pylint: disable=bad-option-value, star-args
SplitModuleTest.modulestore = class_(
None, # contentstore
SplitModuleTest.MODULESTORE['DOC_STORE_CONFIG'],
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py
index 627c9f1e59..128b9324bc 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore_bulk_operations.py
@@ -25,10 +25,10 @@ VERSION_GUID_DICT = {
SAMPLE_GUIDS_LIST = ['SAMPLE_VERSION_GUID', 'SAMPLE_UNICODE_VERSION_GUID', 'BSON_OBJECTID']
-class TestBulkWriteMixin(unittest.TestCase):
+class TestBulkWriteMixin(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def setUp(self):
- super(TestBulkWriteMixin, self).setUp()
+ super(TestBulkWriteMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.bulk = SplitBulkWriteMixin()
self.bulk.SCHEMA_VERSION = 1
self.clear_cache = self.bulk._clear_cache = Mock(name='_clear_cache')
@@ -53,7 +53,7 @@ class TestBulkWriteMixinPreviousTransaction(TestBulkWriteMixin):
Verify that opening and closing a transaction doesn't affect later behaviour.
"""
def setUp(self):
- super(TestBulkWriteMixinPreviousTransaction, self).setUp()
+ super(TestBulkWriteMixinPreviousTransaction, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.bulk._begin_bulk_operation(self.course_key)
self.bulk.insert_course_index(self.course_key, MagicMock('prev-index-entry'))
self.bulk.update_structure(self.course_key, {'this': 'is', 'the': 'previous structure', '_id': ObjectId()})
@@ -185,13 +185,13 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
self.bulk._begin_bulk_operation(self.course_key)
self.conn.reset_mock()
self.bulk.update_definition(self.course_key, self.definition)
- self.bulk.insert_course_index(self.course_key, {'versions': {self.course_key.branch: self.definition['_id']}})
+ self.bulk.insert_course_index(self.course_key, {'versions': {self.course_key.branch: self.definition['_id']}}) # lint-amnesty, pylint: disable=no-member
self.assertConnCalls()
self.bulk._end_bulk_operation(self.course_key)
self.assertConnCalls(
call.insert_definition(self.definition, self.course_key),
call.update_course_index(
- {'versions': {self.course_key.branch: self.definition['_id']}},
+ {'versions': {self.course_key.branch: self.definition['_id']}}, # lint-amnesty, pylint: disable=no-member
from_index=original_index,
course_context=self.course_key
)
@@ -205,7 +205,7 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
self.bulk.update_definition(self.course_key.replace(branch='a'), self.definition)
other_definition = {'another': 'definition', '_id': ObjectId()}
self.bulk.update_definition(self.course_key.replace(branch='b'), other_definition)
- self.bulk.insert_course_index(self.course_key, {'versions': {'a': self.definition['_id'], 'b': other_definition['_id']}})
+ self.bulk.insert_course_index(self.course_key, {'versions': {'a': self.definition['_id'], 'b': other_definition['_id']}}) # lint-amnesty, pylint: disable=line-too-long
self.bulk._end_bulk_operation(self.course_key)
six.assertCountEqual(
self,
@@ -254,13 +254,13 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
self.bulk._begin_bulk_operation(self.course_key)
self.conn.reset_mock()
self.bulk.update_structure(self.course_key, self.structure)
- self.bulk.insert_course_index(self.course_key, {'versions': {self.course_key.branch: self.structure['_id']}})
+ self.bulk.insert_course_index(self.course_key, {'versions': {self.course_key.branch: self.structure['_id']}}) # lint-amnesty, pylint: disable=no-member
self.assertConnCalls()
self.bulk._end_bulk_operation(self.course_key)
self.assertConnCalls(
call.insert_structure(self.structure, self.course_key),
call.update_course_index(
- {'versions': {self.course_key.branch: self.structure['_id']}},
+ {'versions': {self.course_key.branch: self.structure['_id']}}, # lint-amnesty, pylint: disable=no-member
from_index=original_index,
course_context=self.course_key,
)
@@ -274,7 +274,7 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
self.bulk.update_structure(self.course_key.replace(branch='a'), self.structure)
other_structure = {'another': 'structure', '_id': ObjectId()}
self.bulk.update_structure(self.course_key.replace(branch='b'), other_structure)
- self.bulk.insert_course_index(self.course_key, {'versions': {'a': self.structure['_id'], 'b': other_structure['_id']}})
+ self.bulk.insert_course_index(self.course_key, {'versions': {'a': self.structure['_id'], 'b': other_structure['_id']}}) # lint-amnesty, pylint: disable=line-too-long
self.bulk._end_bulk_operation(self.course_key)
six.assertCountEqual(
self,
@@ -304,11 +304,11 @@ class TestBulkWriteMixinClosed(TestBulkWriteMixin):
self.assertEqual(version_result, get_result)
-class TestBulkWriteMixinClosedAfterPrevTransaction(TestBulkWriteMixinClosed, TestBulkWriteMixinPreviousTransaction):
+class TestBulkWriteMixinClosedAfterPrevTransaction(TestBulkWriteMixinClosed, TestBulkWriteMixinPreviousTransaction): # lint-amnesty, pylint: disable=test-inherits-tests
"""
Test that operations on with a closed transaction aren't affected by a previously executed transaction
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@ddt.ddt
@@ -535,7 +535,7 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin):
for structure in db_structures:
if (
structure['previous_version'] in search_ids and # We're searching for this document
- not any(active.endswith(structure['_id']) for active in active_ids) # This document doesn't match any active _ids
+ not any(active.endswith(structure['_id']) for active in active_ids) # This document doesn't match any active _ids # lint-amnesty, pylint: disable=line-too-long
):
self.assertIn(structure, results)
else:
@@ -558,11 +558,11 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin):
# - non-matching documents in the cache
# - expected documents returned from the db
# - unexpected documents returned from the db
- ('ov', 'bi', [{'original_version': 'ov', 'blocks': {'bi': {'edit_info': {'update_version': 'foo'}}}}], [], [], []),
- ('ov', 'bi', [{'original_version': 'ov', 'blocks': {'bi': {'edit_info': {'update_version': 'foo'}}}, '_id': 'foo'}], [], [], [{'_id': 'foo'}]),
+ ('ov', 'bi', [{'original_version': 'ov', 'blocks': {'bi': {'edit_info': {'update_version': 'foo'}}}}], [], [], []), # lint-amnesty, pylint: disable=line-too-long
+ ('ov', 'bi', [{'original_version': 'ov', 'blocks': {'bi': {'edit_info': {'update_version': 'foo'}}}, '_id': 'foo'}], [], [], [{'_id': 'foo'}]), # lint-amnesty, pylint: disable=line-too-long
('ov', 'bi', [], [{'blocks': {'bi': {'edit_info': {'update_version': 'foo'}}}}], [], []),
('ov', 'bi', [], [{'original_version': 'ov'}], [], []),
- ('ov', 'bi', [], [], [{'original_version': 'ov', 'blocks': {'bi': {'edit_info': {'update_version': 'foo'}}}}], []),
+ ('ov', 'bi', [], [], [{'original_version': 'ov', 'blocks': {'bi': {'edit_info': {'update_version': 'foo'}}}}], []), # lint-amnesty, pylint: disable=line-too-long
(
'ov',
'bi',
@@ -573,7 +573,7 @@ class TestBulkWriteMixinFindMethods(TestBulkWriteMixin):
),
)
@ddt.unpack
- def test_find_ancestor_structures(self, original_version, block_id, active_match, active_unmatch, db_match, db_unmatch):
+ def test_find_ancestor_structures(self, original_version, block_id, active_match, active_unmatch, db_match, db_unmatch): # lint-amnesty, pylint: disable=line-too-long
for structure in active_match + active_unmatch + db_match + db_unmatch:
structure.setdefault('_id', ObjectId())
@@ -595,7 +595,7 @@ class TestBulkWriteMixinOpen(TestBulkWriteMixin):
"""
def setUp(self):
- super(TestBulkWriteMixinOpen, self).setUp()
+ super(TestBulkWriteMixinOpen, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.bulk._begin_bulk_operation(self.course_key)
@ddt.data(*SAMPLE_GUIDS_LIST)
@@ -758,8 +758,8 @@ class TestBulkWriteMixinOpen(TestBulkWriteMixin):
self.conn.get_course_index.assert_called_once_with(self.course_key, ignore_case=False)
-class TestBulkWriteMixinOpenAfterPrevTransaction(TestBulkWriteMixinOpen, TestBulkWriteMixinPreviousTransaction):
+class TestBulkWriteMixinOpenAfterPrevTransaction(TestBulkWriteMixinOpen, TestBulkWriteMixinPreviousTransaction): # lint-amnesty, pylint: disable=test-inherits-tests
"""
Test that operations on with an open transaction aren't affected by a previously executed transaction
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
index d557456de1..b4bb4ba448 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import datetime
import os
@@ -22,7 +22,7 @@ from xmodule.x_module import XModuleMixin
@pytest.mark.mongo
class SplitWMongoCourseBootstrapper(unittest.TestCase):
"""
- Helper for tests which need to construct split mongo & old mongo based courses to get interesting internal structure.
+ Helper for tests which need to construct split mongo & old mongo based courses to get interesting internal structure. # lint-amnesty, pylint: disable=line-too-long
Override _create_course and after invoking the super() _create_course, have it call _create_item for
each xblock you want in the course.
This class ensures the db gets created, opened, and cleaned up in addition to creating the course
@@ -53,7 +53,7 @@ class SplitWMongoCourseBootstrapper(unittest.TestCase):
def setUp(self):
self.user_id = random.getrandbits(32)
- super(SplitWMongoCourseBootstrapper, self).setUp()
+ super(SplitWMongoCourseBootstrapper, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.split_mongo = SplitMongoModuleStore(
None,
self.db_config,
@@ -144,8 +144,8 @@ class SplitWMongoCourseBootstrapper(unittest.TestCase):
if split:
# split requires the course to be created separately from creating items
self.split_mongo.create_course(
- self.split_course_key.org, self.split_course_key.course, self.split_course_key.run, self.user_id, fields=fields, root_block_id='runid'
+ self.split_course_key.org, self.split_course_key.course, self.split_course_key.run, self.user_id, fields=fields, root_block_id='runid' # lint-amnesty, pylint: disable=line-too-long
)
- old_course = self.draft_mongo.create_course(self.split_course_key.org, 'test_course', 'runid', self.user_id, fields=fields)
+ old_course = self.draft_mongo.create_course(self.split_course_key.org, 'test_course', 'runid', self.user_id, fields=fields) # lint-amnesty, pylint: disable=line-too-long
self.old_course_key = old_course.id
self.runtime = old_course.runtime
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_xml.py b/common/lib/xmodule/xmodule/modulestore/tests/test_xml.py
index d2fcfb74ae..d20f9e4194 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_xml.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_xml.py
@@ -141,11 +141,11 @@ class TestXMLModuleStore(TestCase):
self.assertIn(shared_item_loc, other_parent.children)
-class TestModuleStoreIgnore(TestXMLModuleStore):
+class TestModuleStoreIgnore(TestXMLModuleStore): # lint-amnesty, pylint: disable=missing-class-docstring, test-inherits-tests
course_dir = DATA_DIR / "course_ignore"
def setUp(self):
- super(TestModuleStoreIgnore, self).setUp()
+ super(TestModuleStoreIgnore, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.addCleanup(remove_temp_files_from_list, list(TILDA_FILES_DICT.keys()), self.course_dir / "static")
add_temp_files_from_dict(TILDA_FILES_DICT, self.course_dir / "static")
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py b/common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py
index 9d9f4a8d82..ce9a8776e7 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py
@@ -72,7 +72,7 @@ class ModuleStoreNoSettings(unittest.TestCase):
Add cleanups
"""
self.addCleanup(self.cleanup_modulestore)
- super(ModuleStoreNoSettings, self).setUp()
+ super(ModuleStoreNoSettings, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
#===========================================
@@ -95,7 +95,7 @@ def modulestore():
options.update(ModuleStoreNoSettings.MODULESTORE['OPTIONS'])
options['render_template'] = render_to_template_mock
- # pylint: disable=star-args
+ # lint-amnesty, pylint: disable=bad-option-value, star-args
ModuleStoreNoSettings.modulestore = class_(
None, # contentstore
ModuleStoreNoSettings.MODULESTORE['DOC_STORE_CONFIG'],
@@ -141,7 +141,7 @@ class RemapNamespaceTest(ModuleStoreNoSettings):
self.field_data = KvsFieldData(kvs=DictKeyValueStore())
self.scope_ids = ScopeIds('Bob', 'stubxblock', '123', 'import')
self.xblock = StubXBlock(self.runtime, self.field_data, self.scope_ids)
- super(RemapNamespaceTest, self).setUp()
+ super(RemapNamespaceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
def test_remap_namespace_native_xblock(self):
@@ -254,7 +254,7 @@ class RemapNamespaceTest(ModuleStoreNoSettings):
# clearing the dirty fields and removing value from cache will fetch the value from field-data.
self.xblock._dirty_fields = {} # pylint: disable=protected-access
- self.xblock.fields['test_content_field']._del_cached_value(self.xblock) # pylint: disable=protected-access
+ self.xblock.fields['test_content_field']._del_cached_value(self.xblock) # lint-amnesty, pylint: disable=protected-access, unsubscriptable-object
with self.assertRaises(TypeError):
self.xblock.get_explicitly_set_fields_by_scope(scope=Scope.content)
@@ -298,7 +298,7 @@ class UpdateLocationTest(ModuleStoreNoSettings):
BlockUsageLocator(CourseLocator('org', 'course', 'run'), 'mutablestubxblock', 'child2'),
]
- super(UpdateLocationTest, self).setUp()
+ super(UpdateLocationTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
def _check_explicitly_set(self, block, scope, expected_explicitly_set_fields, should_be_set=False):
""" Gets fields that are explicitly set on block and checks if they are marked as explicitly set or not """
@@ -343,12 +343,12 @@ class UpdateLocationTest(ModuleStoreNoSettings):
# Expect these fields pass "is_set_on" test
for field in self.CONTENT_FIELDS + self.SETTINGS_FIELDS + self.CHILDREN_FIELDS:
- self.assertTrue(new_version.fields[field].is_set_on(new_version))
+ self.assertTrue(new_version.fields[field].is_set_on(new_version)) # lint-amnesty, pylint: disable=unsubscriptable-object
-class StaticContentImporterTest(unittest.TestCase):
+class StaticContentImporterTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
- def setUp(self):
+ def setUp(self): # lint-amnesty, pylint: disable=super-method-not-called
self.course_data_path = path('/path')
self.mocked_content_store = mock.Mock()
self.static_content_importer = StaticContentImporter(
diff --git a/common/lib/xmodule/xmodule/modulestore/tests/utils.py b/common/lib/xmodule/xmodule/modulestore/tests/utils.py
index 91f141d17c..deda16f3e2 100644
--- a/common/lib/xmodule/xmodule/modulestore/tests/utils.py
+++ b/common/lib/xmodule/xmodule/modulestore/tests/utils.py
@@ -33,7 +33,7 @@ from xmodule.tests import DATA_DIR
from xmodule.x_module import XModuleMixin
-def load_function(path):
+def load_function(path): # lint-amnesty, pylint: disable=redefined-outer-name
"""
Load a function by name.
@@ -79,7 +79,7 @@ def mock_tab_from_json(tab_dict):
return tab_dict
-def add_temp_files_from_dict(file_dict, dir):
+def add_temp_files_from_dict(file_dict, dir): # lint-amnesty, pylint: disable=redefined-builtin
"""
Takes in a dict formatted as: { file_name: content }, and adds files to directory
"""
@@ -90,7 +90,7 @@ def add_temp_files_from_dict(file_dict, dir):
opened_file.write(six.text_type(content))
-def remove_temp_files_from_list(file_list, dir):
+def remove_temp_files_from_list(file_list, dir): # lint-amnesty, pylint: disable=redefined-builtin
"""
Takes in a list of file names and removes them from dir if they exist
"""
@@ -134,7 +134,7 @@ class MixedSplitTestCase(TestCase):
"""
Set up requirements for testing: a user ID and a modulestore
"""
- super(MixedSplitTestCase, self).setUp()
+ super(MixedSplitTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.user_id = ModuleStoreEnum.UserID.test
self.store = MixedModuleStore(
@@ -421,7 +421,7 @@ class MixedModulestoreBuilder(StoreBuilderBase):
names, generators = list(zip(*self.store_builders))
with ExitStack() as stack:
- modulestores = [stack.enter_context(gen.build_with_contentstore(contentstore, **kwargs)) for gen in generators]
+ modulestores = [stack.enter_context(gen.build_with_contentstore(contentstore, **kwargs)) for gen in generators] # lint-amnesty, pylint: disable=line-too-long
# Make the modulestore creation function just return the already-created modulestores
store_iterator = iter(modulestores)
next_modulestore = lambda *args, **kwargs: next(store_iterator)
@@ -519,7 +519,7 @@ class PureModulestoreTestCase(TestCase):
MODULESTORE = None
def setUp(self):
- super(PureModulestoreTestCase, self).setUp()
+ super(PureModulestoreTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
builder = self.MODULESTORE.build()
self.assets, self.store = builder.__enter__()
diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py
index ddf627b89c..3fce39810f 100644
--- a/common/lib/xmodule/xmodule/modulestore/xml.py
+++ b/common/lib/xmodule/xmodule/modulestore/xml.py
@@ -1,6 +1,6 @@
+ # lint-amnesty, pylint: disable=missing-module-docstring
-
-import codecs
+import codecs # lint-amnesty, pylint: disable=unused-import
import glob
import hashlib
import io
@@ -33,7 +33,7 @@ from xmodule.mako_module import MakoDescriptorSystem
from xmodule.modulestore import COURSE_ROOT, LIBRARY_ROOT, ModuleStoreEnum, ModuleStoreReadBase
from xmodule.modulestore.xml_exporter import DEFAULT_CONTENT_FIELDS
from xmodule.tabs import CourseTabList
-from xmodule.x_module import (
+from xmodule.x_module import ( # lint-amnesty, pylint: disable=unused-import
DEPRECATION_VSCOMPAT_EVENT,
AsideKeyGenerator,
OpaqueKeyReader,
@@ -52,8 +52,8 @@ etree.set_default_parser(edx_xml_parser)
log = logging.getLogger(__name__)
-class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
- def __init__(self, xmlstore, course_id, course_dir,
+class ImportSystem(XMLParsingSystem, MakoDescriptorSystem): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
+ def __init__(self, xmlstore, course_id, course_dir, # lint-amnesty, pylint: disable=too-many-statements
error_tracker,
load_error_modules=True, target_course_id=None, **kwargs):
"""
@@ -71,7 +71,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
self.load_error_modules = load_error_modules
self.modulestore = xmlstore
- def process_xml(xml):
+ def process_xml(xml): # lint-amnesty, pylint: disable=too-many-statements
"""Takes an xml string, and returns a XBlock created from
that xml.
"""
@@ -91,7 +91,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
attr = xml_data.attrib
tag = xml_data.tag
- id = lambda x: x
+ id = lambda x: x # lint-amnesty, pylint: disable=redefined-builtin
# Things to try to get a name, in order (key, cleaning function, remove key after reading?)
lookups = [('url_name', id, False),
('slug', id, True),
@@ -236,7 +236,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
id_manager = CourseImportLocationManager(course_id, target_course_id)
- super(ImportSystem, self).__init__(
+ super(ImportSystem, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
load_item=load_item,
resources_fs=resources_fs,
render_template=render_template,
@@ -249,7 +249,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
# id_generator is ignored, because each ImportSystem is already local to
# a course, and has it's own id_generator already in place
- def add_node_as_child(self, block, node, id_generator):
+ def add_node_as_child(self, block, node, id_generator): # lint-amnesty, pylint: disable=signature-differs
child_block = self.process_xml(etree.tostring(node))
block.children.append(child_block.scope_ids.usage_id)
@@ -260,7 +260,7 @@ class CourseLocationManager(OpaqueKeyReader, AsideKeyGenerator):
based within a course
"""
def __init__(self, course_id):
- super(CourseLocationManager, self).__init__()
+ super(CourseLocationManager, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.course_id = course_id
self.autogen_ids = itertools.count(0)
@@ -300,7 +300,7 @@ class CourseImportLocationManager(CourseLocationManager):
see https://openedx.atlassian.net/browse/MA-417 as a pending TODO.
"""
def __init__(self, course_id, target_course_id):
- super(CourseImportLocationManager, self).__init__(course_id=course_id)
+ super(CourseImportLocationManager, self).__init__(course_id=course_id) # lint-amnesty, pylint: disable=super-with-arguments
self.target_course_id = target_course_id
@@ -328,7 +328,7 @@ class XMLModuleStore(ModuleStoreReadBase):
source_dirs or course_ids (list of str): If specified, the list of source_dirs or course_ids to load.
Otherwise, load all courses. Note, providing both
"""
- super(XMLModuleStore, self).__init__(**kwargs)
+ super(XMLModuleStore, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.data_dir = path(data_dir)
self.modules = defaultdict(dict) # course_id -> dict(location -> XBlock)
@@ -429,7 +429,7 @@ class XMLModuleStore(ModuleStoreReadBase):
except (IOError, ValueError) as err:
msg = "ERROR: loading courselike policy from {0}".format(policy_path)
tracker(msg)
- log.warning(msg + " " + str(err))
+ log.warning(msg + " " + str(err)) # lint-amnesty, pylint: disable=logging-not-lazy
return {}
def load_course(self, course_dir, course_ids, tracker, target_course_id=None):
@@ -587,7 +587,7 @@ class XMLModuleStore(ModuleStoreReadBase):
# always used, preventing duplicate keys.
return CourseKey.from_string('/'.join([org, course, url_name]))
- def load_extra_content(self, system, course_descriptor, category, base_dir, course_dir, url_name):
+ def load_extra_content(self, system, course_descriptor, category, base_dir, course_dir, url_name): # lint-amnesty, pylint: disable=missing-function-docstring
self._load_extra_content(system, course_descriptor, category, base_dir, course_dir)
# then look in a override folder based on the course run
@@ -670,7 +670,7 @@ class XMLModuleStore(ModuleStoreReadBase):
DictFieldData(data_content),
)
# VS[compat]:
- # Hack because we need to pull in the 'display_name' for static tabs (because we need to edit them)
+ # Hack because we need to pull in the 'display_name' for static tabs (because we need to edit them) # lint-amnesty, pylint: disable=line-too-long
# from the course policy
if category == "static_tab":
tab = CourseTabList.get_tab_by_slug(tab_list=course_descriptor.tabs, url_slug=slug)
@@ -692,7 +692,7 @@ class XMLModuleStore(ModuleStoreReadBase):
"""
return usage_key in self.modules[usage_key.course_key]
- def get_item(self, usage_key, depth=0, **kwargs):
+ def get_item(self, usage_key, depth=0, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns an XBlock instance for the item for this UsageKey.
@@ -707,9 +707,9 @@ class XMLModuleStore(ModuleStoreReadBase):
try:
return self.modules[usage_key.course_key][usage_key]
except KeyError:
- raise ItemNotFoundError(usage_key)
+ raise ItemNotFoundError(usage_key) # lint-amnesty, pylint: disable=raise-missing-from
- def get_items(self, course_id, settings=None, content=None, revision=None, qualifiers=None, **kwargs):
+ def get_items(self, course_id, settings=None, content=None, revision=None, qualifiers=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ
"""
Returns:
list of XModuleDescriptor instances for the matching items within the course with
@@ -816,7 +816,7 @@ class XMLModuleStore(ModuleStoreReadBase):
block = self.get_item(location, 0)
return block.parent
- def get_modulestore_type(self, course_key=None):
+ def get_modulestore_type(self, course_key=None): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""
Returns an enumeration-like type reflecting the type of this modulestore, per ModuleStoreEnum.Type
Args:
@@ -844,7 +844,7 @@ class XMLModuleStore(ModuleStoreReadBase):
return {'xml': True}
@contextmanager
- def branch_setting(self, branch_setting, course_id=None):
+ def branch_setting(self, branch_setting, course_id=None): # lint-amnesty, pylint: disable=unused-argument
"""
A context manager for temporarily setting the branch value for the store to the given branch_setting.
"""
@@ -860,7 +860,7 @@ class XMLModuleStore(ModuleStoreReadBase):
log.warning("_find_course_asset request of XML modulestore - not implemented.")
return (None, None)
- def find_asset_metadata(self, asset_key, **kwargs):
+ def find_asset_metadata(self, asset_key, **kwargs): # lint-amnesty, pylint: disable=useless-return
"""
For now this is not implemented, but others should feel free to implement using the asset.json
which export produces.
@@ -892,7 +892,7 @@ class LibraryXMLModuleStore(XMLModuleStore):
parent_xml = LIBRARY_ROOT
@staticmethod
- def get_id(org, library, url_name):
+ def get_id(org, library, url_name): # lint-amnesty, pylint: disable=arguments-differ
"""
Create a LibraryLocator given an org and library. url_name is ignored, but left in
for compatibility with the parent signature.
diff --git a/common/lib/xmodule/xmodule/modulestore/xml_exporter.py b/common/lib/xmodule/xmodule/modulestore/xml_exporter.py
index 745c82fbc5..cfbfa810d6 100644
--- a/common/lib/xmodule/xmodule/modulestore/xml_exporter.py
+++ b/common/lib/xmodule/xmodule/modulestore/xml_exporter.py
@@ -365,7 +365,7 @@ def adapt_references(subtree, destination_course_key, export_fs):
field.write_to(subtree, field.read_from(subtree).map_into_course(destination_course_key))
elif field_name == 'children':
# don't change the children field but do recurse over the children
- [adapt_references(child, destination_course_key, export_fs) for child in subtree.get_children()]
+ [adapt_references(child, destination_course_key, export_fs) for child in subtree.get_children()] # lint-amnesty, pylint: disable=expression-not-assigned
elif isinstance(field, ReferenceList):
field.write_to(
subtree,
@@ -374,7 +374,7 @@ def adapt_references(subtree, destination_course_key, export_fs):
elif isinstance(field, ReferenceValueDict):
field.write_to(
subtree, {
- key: ele.map_into_course(destination_course_key) for key, ele in six.iteritems(field.read_from(subtree))
+ key: ele.map_into_course(destination_course_key) for key, ele in six.iteritems(field.read_from(subtree)) # lint-amnesty, pylint: disable=line-too-long
}
)
@@ -394,7 +394,7 @@ def _export_field_content(xblock_item, item_dir):
sort_keys=True, indent=4).encode('utf-8'))
-def export_extra_content(export_fs, modulestore, source_course_key, dest_course_key, category_type, dirname, file_suffix=''):
+def export_extra_content(export_fs, modulestore, source_course_key, dest_course_key, category_type, dirname, file_suffix=''): # lint-amnesty, pylint: disable=line-too-long, missing-function-docstring
items = modulestore.get_items(source_course_key, qualifiers={'category': category_type})
if len(items) > 0:
diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py
index 4d6bb72aac..3e586728ec 100644
--- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py
+++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py
@@ -84,7 +84,7 @@ class LocationMixin(XBlockMixin):
)
-class StaticContentImporter:
+class StaticContentImporter: # lint-amnesty, pylint: disable=missing-class-docstring
def __init__(self, static_content_store, course_data_path, target_id):
self.static_content_store = static_content_store
self.target_id = target_id
@@ -92,7 +92,7 @@ class StaticContentImporter:
try:
with open(course_data_path / 'policies/assets.json') as f:
self.policy = json.load(f)
- except (IOError, ValueError) as err:
+ except (IOError, ValueError) as err: # lint-amnesty, pylint: disable=unused-variable
# xml backed courses won't have this file, only exported courses;
# so, its absence is not really an exception.
self.policy = {}
@@ -101,7 +101,7 @@ class StaticContentImporter:
mimetypes.add_type('application/octet-stream', '.srt')
self.mimetypes_list = list(mimetypes.types_map.values())
- def import_static_content_directory(self, content_subdir=DEFAULT_STATIC_CONTENT_SUBDIR, verbose=False):
+ def import_static_content_directory(self, content_subdir=DEFAULT_STATIC_CONTENT_SUBDIR, verbose=False): # lint-amnesty, pylint: disable=missing-function-docstring
remap_dict = {}
static_dir = self.course_data_path / content_subdir
@@ -127,7 +127,7 @@ class StaticContentImporter:
return remap_dict
- def import_static_file(self, full_file_path, base_dir):
+ def import_static_file(self, full_file_path, base_dir): # lint-amnesty, pylint: disable=missing-function-docstring
filename = os.path.basename(full_file_path)
try:
with open(full_file_path, 'rb') as f:
@@ -173,7 +173,7 @@ class StaticContentImporter:
# then commit the content
try:
self.static_content_store.save(content)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
msg = "Error importing {0}, error={1}".format(file_subpath, err)
log.exception(msg)
set_custom_attribute('course_import_failure', "Static Content Save Failure: {}".format(msg))
@@ -357,7 +357,7 @@ class ImportManager(object):
return
except Exception: # pylint: disable=W0703
logging.exception('Error while parsing asset xml.')
- if self.raise_on_failure:
+ if self.raise_on_failure: # lint-amnesty, pylint: disable=no-else-raise
raise
else:
return
@@ -406,7 +406,7 @@ class ImportManager(object):
"""
Updates any special static items, such as PDF coursebooks.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@abstractmethod
def get_dest_id(self, courselike_key):
@@ -711,7 +711,7 @@ class LibraryImportManager(ImportManager):
"""
Libraries have no special static items to import.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
def import_children(self, source_courselike, courselike, courselike_key, dest_id):
"""
@@ -1090,7 +1090,7 @@ def create_xml_attributes(module, xml):
module.xml_attributes = xml_attrs
-def validate_no_non_editable_metadata(module_store, course_id, category):
+def validate_no_non_editable_metadata(module_store, course_id, category): # lint-amnesty, pylint: disable=missing-function-docstring
err_cnt = 0
for module_loc in module_store.modules[course_id]:
module = module_store.modules[course_id][module_loc]
@@ -1100,7 +1100,7 @@ def validate_no_non_editable_metadata(module_store, course_id, category):
return err_cnt
-def validate_category_hierarchy(
+def validate_category_hierarchy( # lint-amnesty, pylint: disable=missing-function-docstring
module_store, course_id, parent_category, expected_child_category):
err_cnt = 0
@@ -1126,7 +1126,7 @@ def validate_category_hierarchy(
return err_cnt
-def validate_data_source_path_existence(path, is_err=True, extra_msg=None):
+def validate_data_source_path_existence(path, is_err=True, extra_msg=None): # lint-amnesty, pylint: disable=missing-function-docstring, redefined-outer-name
_cnt = 0
if not os.path.exists(path):
print(
@@ -1140,7 +1140,7 @@ def validate_data_source_path_existence(path, is_err=True, extra_msg=None):
return _cnt
-def validate_data_source_paths(data_dir, course_dir):
+def validate_data_source_paths(data_dir, course_dir): # lint-amnesty, pylint: disable=missing-function-docstring
# check that there is a '/static/' directory
course_path = data_dir / course_dir
err_cnt = 0
@@ -1164,14 +1164,14 @@ def validate_course_policy(module_store, course_id):
warn_cnt = 0
for module in six.itervalues(module_store.modules[course_id]):
if module.location.block_type == 'course':
- if not module._field_data.has(module, 'rerandomize'):
+ if not module._field_data.has(module, 'rerandomize'): # lint-amnesty, pylint: disable=protected-access
warn_cnt += 1
print(
'WARN: course policy does not specify value for '
'"rerandomize" whose default is now "never". '
'The behavior of your course may change.'
)
- if not module._field_data.has(module, 'showanswer'):
+ if not module._field_data.has(module, 'showanswer'): # lint-amnesty, pylint: disable=protected-access
warn_cnt += 1
print(
'WARN: course policy does not specify value for '
@@ -1181,7 +1181,7 @@ def validate_course_policy(module_store, course_id):
return warn_cnt
-def perform_xlint(
+def perform_xlint( # lint-amnesty, pylint: disable=missing-function-docstring
data_dir, source_dirs,
default_class='xmodule.raw_module.RawDescriptor',
load_error_modules=True,
diff --git a/common/lib/xmodule/xmodule/mongo_utils.py b/common/lib/xmodule/xmodule/mongo_utils.py
index 76f476bd43..97514891e5 100644
--- a/common/lib/xmodule/xmodule/mongo_utils.py
+++ b/common/lib/xmodule/xmodule/mongo_utils.py
@@ -7,7 +7,7 @@ import logging
import pymongo
from mongodb_proxy import MongoProxy
-from pymongo.read_preferences import (
+from pymongo.read_preferences import ( # lint-amnesty, pylint: disable=unused-import
ReadPreference,
read_pref_mode_from_name,
_MONGOS_MODES,
@@ -21,7 +21,7 @@ logger = logging.getLogger(__name__) # pylint: disable=invalid-name
MONGO_READ_PREFERENCE_MAP = dict(zip(_MONGOS_MODES, _MODES))
-# pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
def connect_to_mongodb(
db, host,
port=27017, tz_aware=True, user=None, password=None,
diff --git a/common/lib/xmodule/xmodule/partitions/partitions.py b/common/lib/xmodule/xmodule/partitions/partitions.py
index 61f6000d2e..0b40ef2421 100644
--- a/common/lib/xmodule/xmodule/partitions/partitions.py
+++ b/common/lib/xmodule/xmodule/partitions/partitions.py
@@ -24,28 +24,28 @@ class UserPartitionError(Exception):
"""
Base Exception for when an error was found regarding user partitions.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class NoSuchUserPartitionError(UserPartitionError):
"""
Exception to be raised when looking up a UserPartition by its ID fails.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class NoSuchUserPartitionGroupError(UserPartitionError):
"""
Exception to be raised when looking up a UserPartition Group by its ID fails.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class ReadOnlyUserPartitionError(UserPartitionError):
"""
Exception to be raised when attempting to modify a read only partition.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class Group(namedtuple("Group", "id name")):
@@ -145,9 +145,9 @@ class UserPartition(namedtuple("UserPartition", "id name description groups sche
if not UserPartition.scheme_extensions:
UserPartition.scheme_extensions = ExtensionManager(namespace=USER_PARTITION_SCHEME_NAMESPACE)
try:
- scheme = UserPartition.scheme_extensions[name].plugin
+ scheme = UserPartition.scheme_extensions[name].plugin # lint-amnesty, pylint: disable=unsubscriptable-object
except KeyError:
- raise UserPartitionError("Unrecognized scheme '{0}'".format(name))
+ raise UserPartitionError("Unrecognized scheme '{0}'".format(name)) # lint-amnesty, pylint: disable=raise-missing-from
scheme.name = name
return scheme
@@ -209,7 +209,7 @@ class UserPartition(namedtuple("UserPartition", "id name description groups sche
raise TypeError("UserPartition dict {0} has unrecognized scheme {1}".format(value, scheme_id))
if getattr(scheme, 'read_only', False):
- raise ReadOnlyUserPartitionError("UserPartition dict {0} uses scheme {1} which is read only".format(value, scheme_id))
+ raise ReadOnlyUserPartitionError("UserPartition dict {0} uses scheme {1} which is read only".format(value, scheme_id)) # lint-amnesty, pylint: disable=line-too-long
if hasattr(scheme, "create_user_partition"):
return scheme.create_user_partition(
@@ -252,7 +252,7 @@ class UserPartition(namedtuple("UserPartition", "id name description groups sche
)
)
- def access_denied_message(self, block_key, user, user_group, allowed_groups):
+ def access_denied_message(self, block_key, user, user_group, allowed_groups): # lint-amnesty, pylint: disable=unused-argument
"""
Return a message that should be displayed to the user when they are not allowed to access
content managed by this partition, or None if there is no applicable message.
@@ -267,7 +267,7 @@ class UserPartition(namedtuple("UserPartition", "id name description groups sche
"""
return None
- def access_denied_fragment(self, block, user, user_group, allowed_groups):
+ def access_denied_fragment(self, block, user, user_group, allowed_groups): # lint-amnesty, pylint: disable=unused-argument
"""
Return an html fragment that should be displayed to the user when they are not allowed to access
content managed by this partition, or None if there is no applicable message.
diff --git a/common/lib/xmodule/xmodule/partitions/partitions_service.py b/common/lib/xmodule/xmodule/partitions/partitions_service.py
index 4db503eaa8..62fc4a2807 100644
--- a/common/lib/xmodule/xmodule/partitions/partitions_service.py
+++ b/common/lib/xmodule/xmodule/partitions/partitions_service.py
@@ -7,7 +7,7 @@ persist the assignments.
import logging
-import six
+import six # lint-amnesty, pylint: disable=unused-import
from django.conf import settings
from openedx.core.lib.cache_utils import request_cached
diff --git a/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py b/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py
index f2a57ede35..c171494700 100644
--- a/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py
+++ b/common/lib/xmodule/xmodule/partitions/tests/test_partitions.py
@@ -8,7 +8,7 @@ from datetime import datetime
import six
from django.test import TestCase
-from mock import Mock, patch
+from mock import Mock, patch # lint-amnesty, pylint: disable=unused-import
from opaque_keys.edx.locator import CourseLocator
from stevedore.extension import Extension, ExtensionManager
@@ -100,7 +100,7 @@ class MockUserPartitionScheme(object):
Mock user partition scheme
"""
def __init__(self, name="mock", current_group=None, **kwargs):
- super(MockUserPartitionScheme, self).__init__(**kwargs)
+ super(MockUserPartitionScheme, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.name = name
self.current_group = current_group
@@ -116,7 +116,7 @@ class MockUserPartitionScheme(object):
return groups[0]
-class MockEnrollmentTrackUserPartitionScheme(MockUserPartitionScheme):
+class MockEnrollmentTrackUserPartitionScheme(MockUserPartitionScheme): # lint-amnesty, pylint: disable=missing-class-docstring
def create_user_partition(self, id, name, description, groups=None, parameters=None, active=True): # pylint: disable=redefined-builtin, invalid-name
"""
@@ -136,7 +136,7 @@ class PartitionTestCase(TestCase):
ENROLLMENT_TRACK_SCHEME_NAME = "enrollment_track"
def setUp(self):
- super(PartitionTestCase, self).setUp()
+ super(PartitionTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# Set up two user partition schemes: mock and random
self.non_random_scheme = MockUserPartitionScheme(self.TEST_SCHEME_NAME)
self.random_scheme = MockUserPartitionScheme("random")
@@ -424,7 +424,7 @@ class MockPartitionService(PartitionService):
Mock PartitionService for testing.
"""
def __init__(self, course, **kwargs):
- super(MockPartitionService, self).__init__(**kwargs)
+ super(MockPartitionService, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self._course = course
def get_course(self):
@@ -437,7 +437,7 @@ class PartitionServiceBaseClass(PartitionTestCase):
"""
def setUp(self):
- super(PartitionServiceBaseClass, self).setUp()
+ super(PartitionServiceBaseClass, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
ContentTypeGatingConfig.objects.create(
enabled=True,
@@ -560,7 +560,7 @@ class TestGetCourseUserPartitions(PartitionServiceBaseClass):
"""
def setUp(self):
- super(TestGetCourseUserPartitions, self).setUp()
+ super(TestGetCourseUserPartitions, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
TestGetCourseUserPartitions._enable_enrollment_track_partition(True)
@staticmethod
diff --git a/common/lib/xmodule/xmodule/poll_module.py b/common/lib/xmodule/xmodule/poll_module.py
index d8b2e078b1..21f8d64509 100644
--- a/common/lib/xmodule/xmodule/poll_module.py
+++ b/common/lib/xmodule/xmodule/poll_module.py
@@ -15,10 +15,10 @@ from copy import deepcopy
from pkg_resources import resource_string
-import six
+import six # lint-amnesty, pylint: disable=unused-import
from lxml import etree
from openedx.core.djangolib.markup import Text, HTML
-from xblock.fields import Boolean, Dict, List, Scope, String
+from xblock.fields import Boolean, Dict, List, Scope, String # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.mako_module import MakoModuleDescriptor
from xmodule.stringify import stringify_children
from xmodule.x_module import XModule
@@ -28,7 +28,7 @@ log = logging.getLogger(__name__)
_ = lambda text: text
-class PollFields(object):
+class PollFields(object): # lint-amnesty, pylint: disable=missing-class-docstring
# Name of poll to use in links to this poll
display_name = String(
help=_("The display name for this component."),
@@ -76,7 +76,7 @@ class PollModule(PollFields, XModule):
css = {'scss': [resource_string(__name__, 'css/poll/display.scss')]}
js_module_name = "Poll"
- def handle_ajax(self, dispatch, data):
+ def handle_ajax(self, dispatch, data): # lint-amnesty, pylint: disable=unused-argument
"""Ajax handler.
Args:
@@ -127,7 +127,7 @@ class PollModule(PollFields, XModule):
'ajax_url': self.system.ajax_url,
'configuration_json': self.dump_poll(),
}
- self.content = self.system.render_template('poll.html', params)
+ self.content = self.system.render_template('poll.html', params) # lint-amnesty, pylint: disable=attribute-defined-outside-init
return self.content
def dump_poll(self):
@@ -166,7 +166,7 @@ class PollModule(PollFields, XModule):
})
-class PollDescriptor(PollFields, MakoModuleDescriptor, XmlDescriptor):
+class PollDescriptor(PollFields, MakoModuleDescriptor, XmlDescriptor): # lint-amnesty, pylint: disable=missing-class-docstring
_tag_name = 'poll_question'
_child_tag_name = 'answer'
@@ -220,7 +220,7 @@ class PollDescriptor(PollFields, MakoModuleDescriptor, XmlDescriptor):
xml_object = etree.fromstring(poll_str)
xml_object.set('display_name', self.display_name)
- def add_child(xml_obj, answer):
+ def add_child(xml_obj, answer): # lint-amnesty, pylint: disable=unused-argument
# Escape answer text before adding to xml tree.
answer_text = str(answer['text'])
child_str = Text('{tag_begin}{text}{tag_end}').format(
diff --git a/common/lib/xmodule/xmodule/progress.py b/common/lib/xmodule/xmodule/progress.py
index e43e6df085..60923d498c 100644
--- a/common/lib/xmodule/xmodule/progress.py
+++ b/common/lib/xmodule/xmodule/progress.py
@@ -71,7 +71,7 @@ class Progress(object):
checking is done at construction time.
'''
(a, b) = self.frac()
- return a > 0 and a < b
+ return a > 0 and a < b # lint-amnesty, pylint: disable=chained-comparison
def done(self):
''' Return True if this represents done.
diff --git a/common/lib/xmodule/xmodule/randomize_module.py b/common/lib/xmodule/xmodule/randomize_module.py
index a97996508f..5ce7e17336 100644
--- a/common/lib/xmodule/xmodule/randomize_module.py
+++ b/common/lib/xmodule/xmodule/randomize_module.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import logging
import random
diff --git a/common/lib/xmodule/xmodule/raw_module.py b/common/lib/xmodule/xmodule/raw_module.py
index 9f5b3c9b56..97b376368f 100644
--- a/common/lib/xmodule/xmodule/raw_module.py
+++ b/common/lib/xmodule/xmodule/raw_module.py
@@ -1,4 +1,4 @@
-import logging
+import logging # lint-amnesty, pylint: disable=missing-module-docstring
import re
from lxml import etree
@@ -22,7 +22,7 @@ class RawMixin(object):
data = String(help="XML data for the module", default="", scope=Scope.content)
@classmethod
- def definition_from_xml(cls, xml_object, system):
+ def definition_from_xml(cls, xml_object, system): # lint-amnesty, pylint: disable=missing-function-docstring, unused-argument
try:
data = etree.tostring(xml_object, pretty_print=True, encoding='unicode')
pre_tag_data = []
@@ -39,7 +39,7 @@ class RawMixin(object):
except etree.XMLSyntaxError:
return {'data': etree.tostring(xml_object, pretty_print=True, encoding='unicode')}, []
- def definition_to_xml(self, resource_fs):
+ def definition_to_xml(self, resource_fs): # lint-amnesty, pylint: disable=unused-argument
"""
Return an Element if we've kept the import OLX, or None otherwise.
"""
@@ -73,7 +73,7 @@ class RawMixin(object):
context=lines[line - 1][offset - 40:offset + 40],
loc=self.location,
)
- raise SerializationError(self.location, msg)
+ raise SerializationError(self.location, msg) # lint-amnesty, pylint: disable=raise-missing-from
@classmethod
def parse_xml_new_runtime(cls, node, runtime, keys):
@@ -103,7 +103,7 @@ class RawDescriptor(RawMixin, XmlDescriptor, XMLEditingDescriptor):
Module that provides a raw editing view of its data and children. It
requires that the definition xml is valid.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class EmptyDataRawMixin(object):
@@ -115,12 +115,12 @@ class EmptyDataRawMixin(object):
data = String(default='', scope=Scope.content)
@classmethod
- def definition_from_xml(cls, xml_object, system):
+ def definition_from_xml(cls, xml_object, system): # lint-amnesty, pylint: disable=unused-argument
if len(xml_object) == 0 and len(list(xml_object.items())) == 0:
return {'data': ''}, []
return {'data': etree.tostring(xml_object, pretty_print=True, encoding='unicode')}, []
- def definition_to_xml(self, resource_fs):
+ def definition_to_xml(self, resource_fs): # lint-amnesty, pylint: disable=unused-argument
if self.data:
return etree.fromstring(self.data)
return etree.Element(self.category)
@@ -131,4 +131,4 @@ class EmptyDataRawDescriptor(EmptyDataRawMixin, XmlDescriptor, XMLEditingDescrip
Version of RawDescriptor for modules which may have no XML data,
but use XMLEditingDescriptor for import/export handling.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
diff --git a/common/lib/xmodule/xmodule/seq_module.py b/common/lib/xmodule/xmodule/seq_module.py
index 5f56f0da17..70111dd622 100644
--- a/common/lib/xmodule/xmodule/seq_module.py
+++ b/common/lib/xmodule/xmodule/seq_module.py
@@ -25,7 +25,7 @@ from xblock.exceptions import NoSuchServiceError
from xblock.fields import Boolean, Integer, List, Scope, String
from edx_toggles.toggles import LegacyWaffleFlag
-from edx_toggles.toggles import WaffleFlag
+from edx_toggles.toggles import WaffleFlag # lint-amnesty, pylint: disable=unused-import
from lms.djangoapps.courseware.toggles import COURSEWARE_PROCTORING_IMPROVEMENTS
from openedx.core.lib.graph_traversals import get_children, leaf_filter, traverse_pre_order
@@ -58,7 +58,7 @@ TIMED_EXAM_GATING_WAFFLE_FLAG = LegacyWaffleFlag(
)
-class SequenceFields(object):
+class SequenceFields(object): # lint-amnesty, pylint: disable=missing-class-docstring
has_children = True
completion_mode = XBlockCompletionMode.AGGREGATOR
@@ -206,7 +206,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
js_module_name = "Sequence"
def __init__(self, *args, **kwargs):
- super(SequenceModule, self).__init__(*args, **kwargs)
+ super(SequenceModule, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.gated_sequence_paywall = None
# If position is specified in system, then use that instead.
@@ -225,7 +225,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
progress = reduce(Progress.add_counts, progresses, None)
return progress
- def handle_ajax(self, dispatch, data, view=STUDENT_VIEW): # TODO: bounds checking
+ def handle_ajax(self, dispatch, data, view=STUDENT_VIEW): # TODO: bounds checking # lint-amnesty, pylint: disable=arguments-differ
''' get = request.POST instance '''
if dispatch == 'goto_position':
# set position to default value if either 'position' argument not
@@ -260,7 +260,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
if self._required_prereq():
if self.runtime.user_is_staff:
- banner_text = _('This subsection is unlocked for learners when they meet the prerequisite requirements.')
+ banner_text = _('This subsection is unlocked for learners when they meet the prerequisite requirements.') # lint-amnesty, pylint: disable=line-too-long
else:
# check if prerequisite has been met
prereq_met, prereq_meta_info = self._compute_is_prereq_met(True)
@@ -355,7 +355,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
prereq_meta_info = {}
if self._required_prereq():
if self.runtime.user_is_staff:
- banner_text = _('This subsection is unlocked for learners when they meet the prerequisite requirements.')
+ banner_text = _('This subsection is unlocked for learners when they meet the prerequisite requirements.') # lint-amnesty, pylint: disable=line-too-long
else:
# check if prerequisite has been met
prereq_met, prereq_meta_info = self._compute_is_prereq_met(True)
@@ -380,7 +380,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
prereq_met, prereq_meta_info = self._compute_is_prereq_met(True)
return self._student_or_public_view(context or {}, prereq_met, prereq_meta_info, None, PUBLIC_VIEW)
- def author_view(self, context):
+ def author_view(self, context): # lint-amnesty, pylint: disable=missing-function-docstring
context = context or {}
context['exclude_units'] = True
if 'position' in context:
@@ -444,7 +444,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
# NOTE (CCB): We default to true to maintain the behavior in place prior to allowing anonymous access access.
return context.get('user_authenticated', True)
- def _get_render_metadata(self, context, display_items, prereq_met, prereq_meta_info, banner_text=None, view=STUDENT_VIEW, fragment=None):
+ def _get_render_metadata(self, context, display_items, prereq_met, prereq_meta_info, banner_text=None, view=STUDENT_VIEW, fragment=None): # lint-amnesty, pylint: disable=line-too-long, missing-function-docstring
if prereq_met and not self._is_gate_fulfilled():
banner_text = _(
'This section is a prerequisite. You must complete this section in order to unlock additional content.'
@@ -484,7 +484,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
self._update_position(context, len(display_items))
fragment = Fragment()
- params = self._get_render_metadata(context, display_items, prereq_met, prereq_meta_info, banner_text, view, fragment)
+ params = self._get_render_metadata(context, display_items, prereq_met, prereq_meta_info, banner_text, view, fragment) # lint-amnesty, pylint: disable=line-too-long
fragment.add_content(self.system.render_template("seq_module.html", params))
self._capture_full_seq_item_metrics(display_items)
@@ -800,7 +800,7 @@ class SequenceModule(SequenceFields, ProctoringFields, XModule):
'is_practice_exam': self.is_practice_exam,
'allow_proctoring_opt_out': self.allow_proctoring_opt_out,
'due_date': self.due,
- 'grace_period': self.graceperiod,
+ 'grace_period': self.graceperiod, # lint-amnesty, pylint: disable=no-member
'experimental_proctoring_features': COURSEWARE_PROCTORING_IMPROVEMENTS.is_enabled(course_id),
}
@@ -853,13 +853,13 @@ class SequenceMixin(SequenceFields):
converted from XModules which inherited from SequenceDescriptor.
"""
@classmethod
- def definition_from_xml(cls, xml_object, system):
+ def definition_from_xml(cls, xml_object, system): # lint-amnesty, pylint: disable=missing-function-docstring
children = []
for child in xml_object:
try:
child_block = system.process_xml(etree.tostring(child, encoding='unicode'))
children.append(child_block.scope_ids.usage_id)
- except Exception as e:
+ except Exception as e: # lint-amnesty, pylint: disable=broad-except
log.exception("Unable to load child when parsing Sequence. Continuing...")
if system.error_tracker is not None:
system.error_tracker(u"ERROR: {0}".format(e))
@@ -873,7 +873,7 @@ class SequenceMixin(SequenceFields):
# return key/value fields in a Python dict object
# values may be numeric / string or dict
# default implementation is an empty dict
- xblock_body = super(SequenceMixin, self).index_dictionary()
+ xblock_body = super(SequenceMixin, self).index_dictionary() # lint-amnesty, pylint: disable=super-with-arguments
html_body = {
"display_name": self.display_name,
}
@@ -913,7 +913,7 @@ class SequenceDescriptor(SequenceMixin, ProctoringFields, MakoModuleDescriptor,
"""
`is_entrance_exam` should not be editable in the Studio settings editor.
"""
- non_editable_fields = super(SequenceDescriptor, self).non_editable_metadata_fields
+ non_editable_fields = super(SequenceDescriptor, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.append(self.fields['is_entrance_exam']) # pylint:disable=unsubscriptable-object
return non_editable_fields
diff --git a/common/lib/xmodule/xmodule/split_test_module.py b/common/lib/xmodule/xmodule/split_test_module.py
index 60c7f7fede..24cd69e4b3 100644
--- a/common/lib/xmodule/xmodule/split_test_module.py
+++ b/common/lib/xmodule/xmodule/split_test_module.py
@@ -95,7 +95,7 @@ class SplitTestFields(object):
)
user_partition_id = Integer(
- help=_("The configuration defines how users are grouped for this content experiment. Caution: Changing the group configuration of a student-visible experiment will impact the experiment data."),
+ help=_("The configuration defines how users are grouped for this content experiment. Caution: Changing the group configuration of a student-visible experiment will impact the experiment data."), # lint-amnesty, pylint: disable=line-too-long
scope=Scope.content,
display_name=_("Group Configuration"),
default=no_partition_selected["value"],
@@ -226,7 +226,7 @@ class SplitTestBlock(
child_descriptor = self.get_child_descriptor_by_location(child_location)
else:
# Oops. Config error.
- log.debug("configuration error in split test module: invalid group_id %r (not one of %r). Showing error", str_group_id, list(self.group_id_to_child.keys()))
+ log.debug("configuration error in split test module: invalid group_id %r (not one of %r). Showing error", str_group_id, list(self.group_id_to_child.keys())) # lint-amnesty, pylint: disable=line-too-long
if child_descriptor is None:
# Peak confusion is great. Now that we set child_descriptor,
@@ -381,7 +381,7 @@ class SplitTestBlock(
return fragment
@XBlock.handler
- def log_child_render(self, request, suffix=''):
+ def log_child_render(self, request, suffix=''): # lint-amnesty, pylint: disable=unused-argument
"""
Record in the tracking logs which child was rendered
"""
@@ -453,7 +453,7 @@ class SplitTestBlock(
try:
descriptor = system.process_xml(etree.tostring(child))
children.append(descriptor.scope_ids.usage_id)
- except Exception:
+ except Exception: # lint-amnesty, pylint: disable=broad-except
msg = "Unable to load child when parsing split_test module."
log.exception(msg)
system.error_tracker(msg)
@@ -477,7 +477,7 @@ class SplitTestBlock(
"""
return True
- def editor_saved(self, user, old_metadata, old_content):
+ def editor_saved(self, user, old_metadata, old_content): # lint-amnesty, pylint: disable=unused-argument
"""
Used to create default verticals for the groups.
@@ -530,7 +530,7 @@ class SplitTestBlock(
Returns the partition that this split module is currently using, or None
if the currently selected partition ID does not match any of the defined partitions.
"""
- for user_partition in self.user_partitions:
+ for user_partition in self.user_partitions: # lint-amnesty, pylint: disable=not-an-iterable
if user_partition.id == self.user_partition_id:
return user_partition
@@ -620,7 +620,7 @@ class SplitTestBlock(
split_validation.add(
StudioValidationMessage(
StudioValidationMessage.ERROR,
- _(u"The experiment uses a deleted group configuration. Select a valid group configuration or delete this experiment.")
+ _(u"The experiment uses a deleted group configuration. Select a valid group configuration or delete this experiment.") # lint-amnesty, pylint: disable=line-too-long
)
)
else:
@@ -673,7 +673,7 @@ class SplitTestBlock(
return None
@XBlock.handler
- def add_missing_groups(self, request, suffix=''):
+ def add_missing_groups(self, request, suffix=''): # lint-amnesty, pylint: disable=unused-argument
"""
Create verticals for any missing groups in the split test instance.
@@ -695,7 +695,7 @@ class SplitTestBlock(
return Response()
@property
- def group_configuration_url(self):
+ def group_configuration_url(self): # lint-amnesty, pylint: disable=missing-function-docstring
assert hasattr(self.system, 'modulestore') and hasattr(self.system.modulestore, 'get_course'), \
"modulestore has to be available"
diff --git a/common/lib/xmodule/xmodule/static_content.py b/common/lib/xmodule/xmodule/static_content.py
index d537b0cd8d..666552366e 100755
--- a/common/lib/xmodule/xmodule/static_content.py
+++ b/common/lib/xmodule/xmodule/static_content.py
@@ -31,7 +31,7 @@ from xmodule.x_module import XModuleDescriptor, HTMLSnippet
LOG = logging.getLogger(__name__)
-class VideoBlock(HTMLSnippet):
+class VideoBlock(HTMLSnippet): # lint-amnesty, pylint: disable=abstract-method
"""
Static assets for VideoBlock.
Kept here because importing VideoBlock code requires Django to be setup.
@@ -148,7 +148,7 @@ def _write_styles(selector, output_root, classes, css_attribute):
for idx, fragment in enumerate(class_css.get(filetype, [])):
css_fragments[idx, filetype, fragment].add(class_.__name__)
css_imports = defaultdict(set)
- for (idx, filetype, fragment), classes in sorted(css_fragments.items()):
+ for (idx, filetype, fragment), classes in sorted(css_fragments.items()): # lint-amnesty, pylint: disable=redefined-argument-from-local
fragment_name = "{idx:0=3d}-{hash}.{type}".format(
idx=idx,
hash=hashlib.md5(fragment).hexdigest(),
@@ -275,7 +275,7 @@ def write_webpack(output_file, module_files, descriptor_files):
unique_files = unique_files[0]
config['entry'][owner] = unique_files
# config['entry']['modules/js/all'] = sorted(set('./{}'.format(file) for file in sum(module_files.values(), [])))
- # config['entry']['descriptors/js/all'] = sorted(set('./{}'.format(file) for file in sum(descriptor_files.values(), [])))
+ # config['entry']['descriptors/js/all'] = sorted(set('./{}'.format(file) for file in sum(descriptor_files.values(), []))) # lint-amnesty, pylint: disable=line-too-long
with output_file.open('w') as outfile:
outfile.write(
@@ -306,7 +306,7 @@ def main():
'openedx.core.djangoapps.video_pipeline',
)
try:
- import edxval
+ import edxval # lint-amnesty, pylint: disable=unused-import
installed_apps += ('edxval',)
except ImportError:
pass
diff --git a/common/lib/xmodule/xmodule/stringify.py b/common/lib/xmodule/xmodule/stringify.py
index 3393a1107e..d3547e7d99 100644
--- a/common/lib/xmodule/xmodule/stringify.py
+++ b/common/lib/xmodule/xmodule/stringify.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring
from lxml import etree
diff --git a/common/lib/xmodule/xmodule/tabs.py b/common/lib/xmodule/xmodule/tabs.py
index a1aa8065e4..343931a8a3 100644
--- a/common/lib/xmodule/xmodule/tabs.py
+++ b/common/lib/xmodule/xmodule/tabs.py
@@ -85,7 +85,7 @@ class CourseTab(six.with_metaclass(ABCMeta, object)):
Args:
tab_dict (dict) - a dictionary of parameters used to build the tab.
"""
- super(CourseTab, self).__init__()
+ super(CourseTab, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self.name = tab_dict.get('name', self.title)
self.tab_id = tab_dict.get('tab_id', getattr(self, 'tab_id', self.type))
self.course_staff_only = tab_dict.get('course_staff_only', False)
@@ -252,7 +252,7 @@ class TabFragmentViewMixin(object):
fragment_view_name = None
def __init__(self, tab_dict):
- super(TabFragmentViewMixin, self).__init__(tab_dict)
+ super(TabFragmentViewMixin, self).__init__(tab_dict) # lint-amnesty, pylint: disable=super-with-arguments
self._fragment_view = None
@property
@@ -261,7 +261,7 @@ class TabFragmentViewMixin(object):
# If a view_name is specified, then use the default link function
if self.view_name:
- return super(TabFragmentViewMixin, self).link_func
+ return super(TabFragmentViewMixin, self).link_func # lint-amnesty, pylint: disable=super-with-arguments
# If not, then use the generic course tab URL
def link_func(course, reverse_func):
@@ -321,7 +321,7 @@ class StaticTab(CourseTab):
tab_dict['link_func'] = link_func
tab_dict['tab_id'] = 'static_tab_{0}'.format(self.url_slug)
- super(StaticTab, self).__init__(tab_dict)
+ super(StaticTab, self).__init__(tab_dict) # lint-amnesty, pylint: disable=super-with-arguments
@classmethod
def is_enabled(cls, course, user=None):
@@ -342,22 +342,22 @@ class StaticTab(CourseTab):
if key == 'url_slug':
return self.url_slug
else:
- return super(StaticTab, self).__getitem__(key)
+ return super(StaticTab, self).__getitem__(key) # lint-amnesty, pylint: disable=super-with-arguments
def __setitem__(self, key, value):
if key == 'url_slug':
self.url_slug = value
else:
- super(StaticTab, self).__setitem__(key, value)
+ super(StaticTab, self).__setitem__(key, value) # lint-amnesty, pylint: disable=super-with-arguments
def to_json(self):
""" Return a dictionary representation of this tab. """
- to_json_val = super(StaticTab, self).to_json()
+ to_json_val = super(StaticTab, self).to_json() # lint-amnesty, pylint: disable=super-with-arguments
to_json_val.update({'url_slug': self.url_slug})
return to_json_val
def __eq__(self, other):
- if not super(StaticTab, self).__eq__(other):
+ if not super(StaticTab, self).__eq__(other): # lint-amnesty, pylint: disable=super-with-arguments
return False
return self.url_slug == other.get('url_slug')
@@ -528,7 +528,7 @@ class CourseTabList(List):
)
raise InvalidTabsException(msg)
- def to_json(self, values):
+ def to_json(self, values): # lint-amnesty, pylint: disable=arguments-differ
"""
Overrides the to_json method to serialize all the CourseTab objects to a json-serializable representation.
"""
@@ -543,7 +543,7 @@ class CourseTabList(List):
continue
return json_data
- def from_json(self, values):
+ def from_json(self, values): # lint-amnesty, pylint: disable=arguments-differ
"""
Overrides the from_json method to de-serialize the CourseTab objects from a json-like representation.
"""
@@ -572,7 +572,7 @@ def key_checker(expected_keys):
missing = set(expected_keys) - set(actual_dict.keys())
if not missing:
return True
- if raise_error:
+ if raise_error: # lint-amnesty, pylint: disable=no-else-raise
raise InvalidTabsException(
"Expected keys '{0}' are not present in the given dict: {1}".format(expected_keys, actual_dict)
)
@@ -635,11 +635,11 @@ class InvalidTabsException(Exception):
"""
A complaint about invalid tabs.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class UnequalTabsException(Exception):
"""
A complaint about tab lists being unequal
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
diff --git a/common/lib/xmodule/xmodule/template_module.py b/common/lib/xmodule/xmodule/template_module.py
index 3474186ca5..6acb400246 100644
--- a/common/lib/xmodule/xmodule/template_module.py
+++ b/common/lib/xmodule/xmodule/template_module.py
@@ -6,7 +6,7 @@ from string import Template
from lxml import etree
from xmodule.raw_module import RawDescriptor
-from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, XModule
+from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, XModule # lint-amnesty, pylint: disable=unused-import
class CustomTagModule(XModule):
diff --git a/common/lib/xmodule/xmodule/tests/__init__.py b/common/lib/xmodule/xmodule/tests/__init__.py
index 24b6b50bf0..79fe8ff2fd 100644
--- a/common/lib/xmodule/xmodule/tests/__init__.py
+++ b/common/lib/xmodule/xmodule/tests/__init__.py
@@ -52,9 +52,9 @@ class TestModuleSystem(ModuleSystem): # pylint: disable=abstract-method
kwargs.setdefault('id_reader', id_manager)
kwargs.setdefault('id_generator', id_manager)
kwargs.setdefault('services', {}).setdefault('field-data', DictFieldData({}))
- super(TestModuleSystem, self).__init__(**kwargs)
+ super(TestModuleSystem, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
- def handler_url(self, block, handler, suffix='', query='', thirdparty=False):
+ def handler_url(self, block, handler, suffix='', query='', thirdparty=False): # lint-amnesty, pylint: disable=arguments-differ
return '{usage_id}/{handler}{suffix}?{query}'.format(
usage_id=six.text_type(block.scope_ids.usage_id),
handler=handler,
@@ -83,7 +83,7 @@ class TestModuleSystem(ModuleSystem): # pylint: disable=abstract-method
if hasattr(self, '_view_name'):
orig_view_name = self._view_name
self._view_name = None
- rt_repr = super(TestModuleSystem, self).__repr__()
+ rt_repr = super(TestModuleSystem, self).__repr__() # lint-amnesty, pylint: disable=super-with-arguments
self._view_name = orig_view_name
return rt_repr
@@ -182,7 +182,7 @@ def mock_render_template(*args, **kwargs):
return pprint.pformat((args, kwargs)).encode().decode()
-class ModelsTest(unittest.TestCase):
+class ModelsTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_load_class(self):
vc = XModuleDescriptor.load_class('sequential')
@@ -196,7 +196,7 @@ class LogicTest(unittest.TestCase):
raw_field_data = {}
def setUp(self):
- super(LogicTest, self).setUp()
+ super(LogicTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.system = get_test_system()
self.descriptor = Mock(name="descriptor", url_name='', category='test')
@@ -262,7 +262,7 @@ class CourseComparisonTest(TestCase):
"""
def setUp(self):
- super(CourseComparisonTest, self).setUp()
+ super(CourseComparisonTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.field_exclusions = set()
self.ignored_asset_keys = set()
@@ -362,8 +362,8 @@ class CourseComparisonTest(TestCase):
# compare published
with expected_store.branch_setting(ModuleStoreEnum.Branch.published_only, expected_course_key):
with actual_store.branch_setting(ModuleStoreEnum.Branch.published_only, actual_course_key):
- expected_items = expected_store.get_items(expected_course_key, revision=ModuleStoreEnum.RevisionOption.published_only)
- actual_items = actual_store.get_items(actual_course_key, revision=ModuleStoreEnum.RevisionOption.published_only)
+ expected_items = expected_store.get_items(expected_course_key, revision=ModuleStoreEnum.RevisionOption.published_only) # lint-amnesty, pylint: disable=line-too-long
+ actual_items = actual_store.get_items(actual_course_key, revision=ModuleStoreEnum.RevisionOption.published_only) # lint-amnesty, pylint: disable=line-too-long
self.assertGreater(len(expected_items), 0)
self._assertCoursesEqual(expected_items, actual_items, actual_course_key)
@@ -384,7 +384,7 @@ class CourseComparisonTest(TestCase):
actual_items = actual_store.get_items(actual_course_key, revision=revision)
self._assertCoursesEqual(expected_items, actual_items, actual_course_key, expect_drafts=True)
- def _assertCoursesEqual(self, expected_items, actual_items, actual_course_key, expect_drafts=False):
+ def _assertCoursesEqual(self, expected_items, actual_items, actual_course_key, expect_drafts=False): # lint-amnesty, pylint: disable=unused-argument
"""
Actual algorithm to compare courses.
"""
@@ -405,7 +405,7 @@ class CourseComparisonTest(TestCase):
[key for key in actual_item_map.keys() if key[0] != 'course'],
)
for expected_item in expected_items:
- actual_item_location = actual_course_key.make_usage_key(expected_item.category, expected_item.location.block_id)
+ actual_item_location = actual_course_key.make_usage_key(expected_item.category, expected_item.location.block_id) # lint-amnesty, pylint: disable=line-too-long
# split and old mongo use different names for the course root but we don't know which
# modulestore actual's come from here; so, assume old mongo and if that fails, assume split
if expected_item.location.block_type == 'course':
@@ -492,7 +492,7 @@ class CourseComparisonTest(TestCase):
actual_thumbs = actual_store.get_all_content_thumbnails_for_course(actual_course_key)
self._assertAssetsEqual(expected_course_key, expected_thumbs, actual_course_key, actual_thumbs)
- def assertAssetsMetadataEqual(self, expected_modulestore, expected_course_key, actual_modulestore, actual_course_key):
+ def assertAssetsMetadataEqual(self, expected_modulestore, expected_course_key, actual_modulestore, actual_course_key): # lint-amnesty, pylint: disable=line-too-long
"""
Assert that the modulestore asset metdata for the ``expected_course_key`` and the ``actual_course_key``
are equivalent.
diff --git a/common/lib/xmodule/xmodule/tests/helpers.py b/common/lib/xmodule/xmodule/tests/helpers.py
index 21ec72ec0c..63d8c0bdd4 100644
--- a/common/lib/xmodule/xmodule/tests/helpers.py
+++ b/common/lib/xmodule/xmodule/tests/helpers.py
@@ -36,7 +36,7 @@ class StubUserService(UserService):
def __init__(self, is_anonymous=False, **kwargs):
self.is_anonymous = is_anonymous
- super(StubUserService, self).__init__(**kwargs)
+ super(StubUserService, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
def get_current_user(self):
"""
diff --git a/common/lib/xmodule/xmodule/tests/rendering/core.py b/common/lib/xmodule/xmodule/tests/rendering/core.py
index ce40bbe942..1dd5ccd9aa 100644
--- a/common/lib/xmodule/xmodule/tests/rendering/core.py
+++ b/common/lib/xmodule/xmodule/tests/rendering/core.py
@@ -43,7 +43,7 @@ from singledispatch import singledispatch
@singledispatch
-def assert_student_view_valid_html(block, html):
+def assert_student_view_valid_html(block, html): # lint-amnesty, pylint: disable=unused-argument
"""
Asserts that the html generated by the `student_view` view is correct for
the supplied block
@@ -51,11 +51,11 @@ def assert_student_view_valid_html(block, html):
:param block: The :class:`XBlock` that generated the html
:param html: The generated html as parsed by lxml.html
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@singledispatch
-def assert_studio_view_valid_html(block, html):
+def assert_studio_view_valid_html(block, html): # lint-amnesty, pylint: disable=unused-argument
"""
Asserts that the html generated by the `studio_view` view is correct for
the supplied block
@@ -63,11 +63,11 @@ def assert_studio_view_valid_html(block, html):
:param block: The :class:`XBlock` that generated the html
:param html: The generated html as parsed by lxml.html
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@singledispatch
-def assert_student_view_invalid_html(block, html):
+def assert_student_view_invalid_html(block, html): # lint-amnesty, pylint: disable=unused-argument
"""
Asserts that the html generated by the `student_view` view is correct for
the supplied block, given that html wasn't parsable
@@ -79,7 +79,7 @@ def assert_student_view_invalid_html(block, html):
@singledispatch
-def assert_studio_view_invalid_html(block, html):
+def assert_studio_view_invalid_html(block, html): # lint-amnesty, pylint: disable=unused-argument
"""
Asserts that the html generated by the `studio_view` view is correct for
the supplied block
diff --git a/common/lib/xmodule/xmodule/tests/test_annotatable_module.py b/common/lib/xmodule/xmodule/tests/test_annotatable_module.py
index b2f1a61e6f..26787c90c7 100644
--- a/common/lib/xmodule/xmodule/tests/test_annotatable_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_annotatable_module.py
@@ -4,7 +4,7 @@
import unittest
from lxml import etree
-from mock import Mock
+from mock import Mock # lint-amnesty, pylint: disable=unused-import
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from xblock.field_data import DictFieldData
from xblock.fields import ScopeIds
@@ -14,7 +14,7 @@ from xmodule.annotatable_module import AnnotatableBlock
from . import get_test_system
-class AnnotatableBlockTestCase(unittest.TestCase):
+class AnnotatableBlockTestCase(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
sample_xml = '''
Read the text.
@@ -49,7 +49,7 @@ class AnnotatableBlockTestCase(unittest.TestCase):
'data-problem-id': {'value': '0', '_delete': 'problem'}
}
- actual_attr = self.annotatable._get_annotation_data_attr(0, el)
+ actual_attr = self.annotatable._get_annotation_data_attr(0, el) # lint-amnesty, pylint: disable=protected-access
self.assertIsInstance(actual_attr, dict)
self.assertDictEqual(expected_attr, actual_attr)
@@ -59,7 +59,7 @@ class AnnotatableBlockTestCase(unittest.TestCase):
el = etree.fromstring(xml)
expected_attr = {'class': {'value': 'annotatable-span highlight'}}
- actual_attr = self.annotatable._get_annotation_class_attr(0, el)
+ actual_attr = self.annotatable._get_annotation_class_attr(0, el) # lint-amnesty, pylint: disable=protected-access
self.assertIsInstance(actual_attr, dict)
self.assertDictEqual(expected_attr, actual_attr)
@@ -77,7 +77,7 @@ class AnnotatableBlockTestCase(unittest.TestCase):
'_delete': 'highlight'
}
}
- actual_attr = self.annotatable._get_annotation_class_attr(0, el)
+ actual_attr = self.annotatable._get_annotation_class_attr(0, el) # lint-amnesty, pylint: disable=protected-access
self.assertIsInstance(actual_attr, dict)
self.assertDictEqual(expected_attr, actual_attr)
@@ -93,24 +93,24 @@ class AnnotatableBlockTestCase(unittest.TestCase):
'_delete': 'highlight'
}
}
- actual_attr = self.annotatable._get_annotation_class_attr(0, el)
+ actual_attr = self.annotatable._get_annotation_class_attr(0, el) # lint-amnesty, pylint: disable=protected-access
self.assertIsInstance(actual_attr, dict)
self.assertDictEqual(expected_attr, actual_attr)
def test_render_annotation(self):
- expected_html = 'z'
+ expected_html = 'z' # lint-amnesty, pylint: disable=line-too-long
expected_el = etree.fromstring(expected_html)
actual_el = etree.fromstring('z')
- self.annotatable._render_annotation(0, actual_el)
+ self.annotatable._render_annotation(0, actual_el) # lint-amnesty, pylint: disable=protected-access
self.assertEqual(expected_el.tag, actual_el.tag)
self.assertEqual(expected_el.text, actual_el.text)
self.assertDictEqual(dict(expected_el.attrib), dict(actual_el.attrib))
def test_render_content(self):
- content = self.annotatable._render_content()
+ content = self.annotatable._render_content() # lint-amnesty, pylint: disable=protected-access
el = etree.fromstring(content)
self.assertEqual('div', el.tag, 'root tag is a div')
@@ -128,10 +128,10 @@ class AnnotatableBlockTestCase(unittest.TestCase):
xmltree = etree.fromstring(self.sample_xml)
expected_xml = u"Read the text.
"
- actual_xml = self.annotatable._extract_instructions(xmltree)
+ actual_xml = self.annotatable._extract_instructions(xmltree) # lint-amnesty, pylint: disable=protected-access
self.assertIsNotNone(actual_xml)
self.assertEqual(expected_xml.strip(), actual_xml.strip())
xmltree = etree.fromstring('foo')
- actual = self.annotatable._extract_instructions(xmltree)
+ actual = self.annotatable._extract_instructions(xmltree) # lint-amnesty, pylint: disable=protected-access
self.assertIsNone(actual)
diff --git a/common/lib/xmodule/xmodule/tests/test_capa_module.py b/common/lib/xmodule/xmodule/tests/test_capa_module.py
index c0e52f2aaf..0587ecf5ef 100644
--- a/common/lib/xmodule/xmodule/tests/test_capa_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py
@@ -178,10 +178,10 @@ if submission[0] == '':
@ddt.ddt
-class ProblemBlockTest(unittest.TestCase):
+class ProblemBlockTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def setUp(self):
- super(ProblemBlockTest, self).setUp()
+ super(ProblemBlockTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
now = datetime.datetime.now(UTC)
day_delta = datetime.timedelta(days=1)
@@ -662,7 +662,7 @@ class ProblemBlockTest(unittest.TestCase):
# Expect that we get a dict with "input" stripped from key names
# and that we get the same values back
- for key in result.keys():
+ for key in result.keys(): # lint-amnesty, pylint: disable=consider-iterating-dictionary
original_key = "input_" + key
self.assertIn(original_key, valid_get_dict, "Output dict should have key %s" % original_key)
self.assertEqual(valid_get_dict[original_key], result[key])
@@ -1642,7 +1642,7 @@ class ProblemBlockTest(unittest.TestCase):
self.assertFalse(result['should_enable_next_hint'])
def test_demand_hint_logging(self):
- def mock_location_text(self):
+ def mock_location_text(self): # lint-amnesty, pylint: disable=unused-argument
"""
Mock implementation of __unicode__ or __str__ for the module's location.
"""
@@ -2045,7 +2045,7 @@ class ProblemBlockTest(unittest.TestCase):
module.submit_problem(get_request_dict)
# On rescore, state/student_answers should use unmasked names
with patch.object(module.runtime, 'track_function') as mock_track_function:
- module.rescore_problem(only_if_higher=False)
+ module.rescore_problem(only_if_higher=False) # lint-amnesty, pylint: disable=no-member
mock_call = mock_track_function.mock_calls[0]
event_info = mock_call[1][1]
self.assertEqual(mock_call[1][0], 'problem_rescore')
@@ -2108,7 +2108,7 @@ class ProblemBlockTest(unittest.TestCase):
@ddt.ddt
-class ProblemBlockXMLTest(unittest.TestCase):
+class ProblemBlockXMLTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
sample_checkbox_problem_xml = textwrap.dedent("""
Title
@@ -2930,7 +2930,7 @@ class ProblemBlockXMLTest(unittest.TestCase):
CapaFactory.create(xml=problem_xml)
-class ComplexEncoderTest(unittest.TestCase):
+class ComplexEncoderTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_default(self):
"""
@@ -2948,7 +2948,7 @@ class ProblemCheckTrackingTest(unittest.TestCase):
"""
def setUp(self):
- super(ProblemCheckTrackingTest, self).setUp()
+ super(ProblemCheckTrackingTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.maxDiff = None
def test_choice_answer_text(self):
@@ -3023,7 +3023,7 @@ class ProblemCheckTrackingTest(unittest.TestCase):
},
})
- def capa_factory_for_problem_xml(self, xml):
+ def capa_factory_for_problem_xml(self, xml): # lint-amnesty, pylint: disable=missing-function-docstring
class CustomCapaFactory(CapaFactory):
"""
A factory for creating a Capa problem with arbitrary xml.
@@ -3032,7 +3032,7 @@ class ProblemCheckTrackingTest(unittest.TestCase):
return CustomCapaFactory
- def get_event_for_answers(self, module, answer_input_dict):
+ def get_event_for_answers(self, module, answer_input_dict): # lint-amnesty, pylint: disable=missing-function-docstring
with patch.object(module.runtime, 'publish') as mock_track_function:
module.submit_problem(answer_input_dict)
@@ -3270,7 +3270,7 @@ class ProblemBlockReportGenerationTest(unittest.TestCase):
Ensure that Capa report generation works correctly
"""
- def setUp(self):
+ def setUp(self): # lint-amnesty, pylint: disable=super-method-not-called
self.find_question_label_patcher = patch(
'capa.capa_problem.LoncapaProblem.find_question_label',
lambda self, answer_id: answer_id
@@ -3304,7 +3304,7 @@ class ProblemBlockReportGenerationTest(unittest.TestCase):
scope=None,
)
- def _get_descriptor(self):
+ def _get_descriptor(self): # lint-amnesty, pylint: disable=missing-function-docstring
scope_ids = Mock(block_type='problem')
descriptor = ProblemBlock(get_test_system(), scope_ids=scope_ids)
descriptor.runtime = Mock()
diff --git a/common/lib/xmodule/xmodule/tests/test_conditional.py b/common/lib/xmodule/xmodule/tests/test_conditional.py
index d2616fc647..b6a2b172c6 100644
--- a/common/lib/xmodule/xmodule/tests/test_conditional.py
+++ b/common/lib/xmodule/xmodule/tests/test_conditional.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import json
import unittest
@@ -26,14 +26,14 @@ ORG = 'test_org'
COURSE = 'conditional' # name of directory with course data
-class DummySystem(ImportSystem):
+class DummySystem(ImportSystem): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
@patch('xmodule.modulestore.xml.OSFS', lambda directory: MemoryFS())
def __init__(self, load_error_modules):
xmlstore = XMLModuleStore("data_dir", source_dirs=[], load_error_modules=load_error_modules)
- super(DummySystem, self).__init__(
+ super(DummySystem, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
xmlstore=xmlstore,
course_id=CourseKey.from_string('/'.join([ORG, COURSE, 'test_run'])),
course_dir='test_dir',
@@ -41,7 +41,7 @@ class DummySystem(ImportSystem):
load_error_modules=load_error_modules,
)
- def render_template(self, template, context):
+ def render_template(self, template, context): # lint-amnesty, pylint: disable=method-hidden
raise Exception("Shouldn't be called")
@@ -89,8 +89,8 @@ class ConditionalFactory(object):
# construct other descriptors:
child_descriptor = Mock(name='child_descriptor')
child_descriptor.visible_to_staff_only = False
- child_descriptor._xmodule.student_view.return_value = Fragment(content=u'This is a secret
')
- child_descriptor.student_view = child_descriptor._xmodule.student_view
+ child_descriptor._xmodule.student_view.return_value = Fragment(content=u'This is a secret
') # lint-amnesty, pylint: disable=protected-access
+ child_descriptor.student_view = child_descriptor._xmodule.student_view # lint-amnesty, pylint: disable=protected-access
child_descriptor.displayable_items.return_value = [child_descriptor]
child_descriptor.runtime = descriptor_system
child_descriptor.xmodule_runtime = get_test_system()
@@ -149,7 +149,7 @@ class ConditionalBlockBasicTest(unittest.TestCase):
"""
def setUp(self):
- super(ConditionalBlockBasicTest, self).setUp()
+ super(ConditionalBlockBasicTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.test_system = get_test_system()
def test_icon_class(self):
@@ -158,7 +158,7 @@ class ConditionalBlockBasicTest(unittest.TestCase):
for attempted in ["false", "true"]:
for icon_class in ['other', 'problem', 'video']:
modules['source_module'].is_attempted = attempted
- modules['child_module'].get_icon_class = lambda: icon_class
+ modules['child_module'].get_icon_class = lambda: icon_class # lint-amnesty, pylint: disable=cell-var-from-loop
self.assertEqual(modules['cond_module'].get_icon_class(), icon_class)
def test_get_html(self):
@@ -226,7 +226,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
return DummySystem(load_error_modules)
def setUp(self):
- super(ConditionalBlockXmlTest, self).setUp()
+ super(ConditionalBlockXmlTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.test_system = get_test_system()
def get_course(self, name):
@@ -235,7 +235,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
modulestore = XMLModuleStore(DATA_DIR, source_dirs=[name])
courses = modulestore.get_courses()
- self.modulestore = modulestore
+ self.modulestore = modulestore # lint-amnesty, pylint: disable=attribute-defined-outside-init
self.assertEqual(len(courses), 1)
return courses[0]
@@ -263,7 +263,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
location = BlockUsageLocator(CourseLocator("HarvardX", "ER22x", "2013_Spring", deprecated=True),
"conditional", "condone", deprecated=True)
- def replace_urls(text, staticfiles_prefix=None, replace_prefix='/static/', course_namespace=None):
+ def replace_urls(text, staticfiles_prefix=None, replace_prefix='/static/', course_namespace=None): # lint-amnesty, pylint: disable=unused-argument
return text
self.test_system.replace_urls = replace_urls
self.test_system.get_module = inner_get_module
@@ -330,7 +330,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
dummy_scope_ids,
)
- new_run = conditional.location.course_key.run
+ new_run = conditional.location.course_key.run # lint-amnesty, pylint: disable=unused-variable
self.assertEqual(
conditional.sources_list[0],
BlockUsageLocator.from_string(
@@ -345,7 +345,7 @@ class ConditionalBlockXmlTest(unittest.TestCase):
dummy_scope_ids = ScopeIds(None, None, dummy_location, dummy_location)
dummy_field_data = DictFieldData({
'data': '',
- 'xml_attributes': {'sources': 'i4x://HarvardX/ER22x/poll_question/T15_poll;i4x://HarvardX/ER22x/poll_question/T16_poll'},
+ 'xml_attributes': {'sources': 'i4x://HarvardX/ER22x/poll_question/T15_poll;i4x://HarvardX/ER22x/poll_question/T16_poll'}, # lint-amnesty, pylint: disable=line-too-long
'children': None,
})
conditional = ConditionalBlock(
diff --git a/common/lib/xmodule/xmodule/tests/test_content.py b/common/lib/xmodule/xmodule/tests/test_content.py
index 64293b4419..bbeff49346 100644
--- a/common/lib/xmodule/xmodule/tests/test_content.py
+++ b/common/lib/xmodule/xmodule/tests/test_content.py
@@ -100,7 +100,7 @@ class MockImage(Mock):
@ddt.ddt
-class ContentTest(unittest.TestCase):
+class ContentTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_thumbnail_none(self):
# We had a bug where a thumbnail location of None was getting transformed into a Location tuple, with
@@ -222,6 +222,6 @@ class ContentTest(unittest.TestCase):
"""
output_root = path(u'common/static/xmodule/descriptors/js')
file_owners = _write_js(output_root, _list_descriptors(), 'get_studio_view_js')
- js_file_paths = set(file_path for file_path in sum(list(file_owners.values()), []) if os.path.basename(file_path).startswith('000-'))
+ js_file_paths = set(file_path for file_path in sum(list(file_owners.values()), []) if os.path.basename(file_path).startswith('000-')) # lint-amnesty, pylint: disable=line-too-long
self.assertEqual(len(js_file_paths), 1)
self.assertIn("XModule.Descriptor = (function() {", open(js_file_paths.pop()).read())
diff --git a/common/lib/xmodule/xmodule/tests/test_course_metadata_utils.py b/common/lib/xmodule/xmodule/tests/test_course_metadata_utils.py
index b4dacc2475..f5ca1f4c23 100644
--- a/common/lib/xmodule/xmodule/tests/test_course_metadata_utils.py
+++ b/common/lib/xmodule/xmodule/tests/test_course_metadata_utils.py
@@ -44,7 +44,7 @@ class CourseMetadataUtilsTestCase(TestCase):
"""
Set up module store testing capabilities and initialize test courses.
"""
- super(CourseMetadataUtilsTestCase, self).setUp()
+ super(CourseMetadataUtilsTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
mongo_builder = MongoModulestoreBuilder()
split_builder = VersioningModulestoreBuilder()
@@ -105,7 +105,7 @@ class CourseMetadataUtilsTestCase(TestCase):
else:
raise ValueError("Invalid format string :" + format_string)
- def noop_gettext(text):
+ def noop_gettext(text): # lint-amnesty, pylint: disable=unused-variable
"""Dummy implementation of gettext, so we don't need Django."""
return text
diff --git a/common/lib/xmodule/xmodule/tests/test_course_module.py b/common/lib/xmodule/xmodule/tests/test_course_module.py
index bb726bb3c3..82f196c285 100644
--- a/common/lib/xmodule/xmodule/tests/test_course_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_course_module.py
@@ -38,7 +38,7 @@ class CourseFieldsTestCase(unittest.TestCase):
)
-class DummySystem(ImportSystem):
+class DummySystem(ImportSystem): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
@patch('xmodule.modulestore.xml.OSFS', lambda dir: MemoryFS())
def __init__(self, load_error_modules, course_id=None):
@@ -49,7 +49,7 @@ class DummySystem(ImportSystem):
course_dir = "test_dir"
error_tracker = Mock()
- super(DummySystem, self).__init__(
+ super(DummySystem, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
xmlstore=xmlstore,
course_id=course_id,
course_dir=course_dir,
@@ -103,11 +103,11 @@ class HasEndedMayCertifyTestCase(unittest.TestCase):
"""Double check the semantics around when to finalize courses."""
def setUp(self):
- super(HasEndedMayCertifyTestCase, self).setUp()
+ super(HasEndedMayCertifyTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
- system = DummySystem(load_error_modules=True)
+ system = DummySystem(load_error_modules=True) # lint-amnesty, pylint: disable=unused-variable
#sample_xml = """
- # Test Template HTML")
self.tabs = [
diff --git a/common/lib/xmodule/xmodule/tests/test_error_module.py b/common/lib/xmodule/xmodule/tests/test_error_module.py
index dce77fcf3f..512a9f9aa7 100644
--- a/common/lib/xmodule/xmodule/tests/test_error_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_error_module.py
@@ -104,23 +104,23 @@ class TestNonStaffErrorBlock(SetupTestErrorBlock):
self.assertNotIn(str(descriptor), context_repr)
-class BrokenModule(XModule):
+class BrokenModule(XModule): # lint-amnesty, pylint: disable=abstract-method
def __init__(self, *args, **kwargs):
- super(BrokenModule, self).__init__(*args, **kwargs)
+ super(BrokenModule, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
raise Exception("This is a broken xmodule")
-class BrokenDescriptor(XModuleDescriptor):
+class BrokenDescriptor(XModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method
module_class = BrokenModule
class TestException(Exception):
"""An exception type to use to verify raises in tests"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@unabc("Tests should not call {}")
-class TestRuntime(Runtime):
+class TestRuntime(Runtime): # lint-amnesty, pylint: disable=abstract-method
pass
@@ -148,7 +148,7 @@ class TestErrorBlockConstruction(unittest.TestCase):
Test that when an XModule throws an block during __init__, we
get an ErrorBlock back from XModuleDescriptor._xmodule
"""
- module = self.descriptor._xmodule
+ module = self.descriptor._xmodule # lint-amnesty, pylint: disable=protected-access
self.assertIsInstance(module, ErrorBlock)
@patch.object(ErrorBlock, '__init__', Mock(side_effect=TestException))
@@ -157,7 +157,7 @@ class TestErrorBlockConstruction(unittest.TestCase):
Test that a broken block descriptor doesn't cause an infinite loop
"""
with self.assertRaises(TestException):
- module = self.descriptor._xmodule
+ module = self.descriptor._xmodule # lint-amnesty, pylint: disable=protected-access, unused-variable
@patch.object(ErrorBlock, '__init__', Mock(side_effect=TestException))
def test_broken_error_block(self):
@@ -165,4 +165,4 @@ class TestErrorBlockConstruction(unittest.TestCase):
Test that a broken block module doesn't cause an infinite loop
"""
with self.assertRaises(TestException):
- module = self.descriptor._xmodule
+ module = self.descriptor._xmodule # lint-amnesty, pylint: disable=protected-access, unused-variable
diff --git a/common/lib/xmodule/xmodule/tests/test_export.py b/common/lib/xmodule/xmodule/tests/test_export.py
index 56e14855a0..37bf301cd5 100644
--- a/common/lib/xmodule/xmodule/tests/test_export.py
+++ b/common/lib/xmodule/xmodule/tests/test_export.py
@@ -35,8 +35,8 @@ def strip_filenames(descriptor):
Recursively strips 'filename' from all children's definitions.
"""
print("strip filename from {desc}".format(desc=text_type(descriptor.location)))
- if descriptor._field_data.has(descriptor, 'filename'):
- descriptor._field_data.delete(descriptor, 'filename')
+ if descriptor._field_data.has(descriptor, 'filename'): # lint-amnesty, pylint: disable=protected-access
+ descriptor._field_data.delete(descriptor, 'filename') # lint-amnesty, pylint: disable=protected-access
if hasattr(descriptor, 'xml_attributes'):
if 'filename' in descriptor.xml_attributes:
@@ -67,7 +67,7 @@ class RoundTripTestCase(unittest.TestCase):
"""
def setUp(self):
- super(RoundTripTestCase, self).setUp()
+ super(RoundTripTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.maxDiff = None
self.temp_dir = mkdtemp()
self.addCleanup(shutil.rmtree, self.temp_dir)
@@ -158,18 +158,18 @@ class TestEdxJsonEncoder(unittest.TestCase):
"""
def setUp(self):
- super(TestEdxJsonEncoder, self).setUp()
+ super(TestEdxJsonEncoder, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.encoder = EdxJSONEncoder()
- class OffsetTZ(tzinfo):
+ class OffsetTZ(tzinfo): # lint-amnesty, pylint: disable=abstract-method
"""A timezone with non-None utcoffset"""
def utcoffset(self, _dt):
return timedelta(hours=4)
self.offset_tz = OffsetTZ()
- class NullTZ(tzinfo):
+ class NullTZ(tzinfo): # lint-amnesty, pylint: disable=abstract-method
"""A timezone with None as its utcoffset"""
def utcoffset(self, _dt):
return None
@@ -222,7 +222,7 @@ class TestEdxJsonEncoder(unittest.TestCase):
# Initializing a lazy text object with Unicode
unicode_text = u"Your 𝓟𝓵𝓪𝓽𝓯𝓸𝓻𝓶 Name Here"
- lazy_text = ugettext_lazy(unicode_text)
+ lazy_text = ugettext_lazy(unicode_text) # lint-amnesty, pylint: disable=translation-of-non-string
self.assertEqual(
unicode_text,
diff --git a/common/lib/xmodule/xmodule/tests/test_fields.py b/common/lib/xmodule/xmodule/tests/test_fields.py
index 58a0b9b5b8..bcdc61635f 100644
--- a/common/lib/xmodule/xmodule/tests/test_fields.py
+++ b/common/lib/xmodule/xmodule/tests/test_fields.py
@@ -10,7 +10,7 @@ from xmodule.fields import Date, RelativeTime, Timedelta
from xmodule.timeinfo import TimeInfo
-class DateTest(unittest.TestCase):
+class DateTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
date = Date()
def compare_dates(self, dt1, dt2, expected_delta):
@@ -122,7 +122,7 @@ class DateTest(unittest.TestCase):
DateTest.date.to_json('2012-12-31T23:00:01-01:00')
-class TimedeltaTest(unittest.TestCase):
+class TimedeltaTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
delta = Timedelta()
def test_from_json(self):
@@ -156,7 +156,7 @@ class TimedeltaTest(unittest.TestCase):
)
-class TimeInfoTest(unittest.TestCase):
+class TimeInfoTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_time_info(self):
due_date = datetime.datetime(2000, 4, 14, 10, tzinfo=UTC)
@@ -168,7 +168,7 @@ class TimeInfoTest(unittest.TestCase):
)
-class RelativeTimeTest(unittest.TestCase):
+class RelativeTimeTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
delta = RelativeTime()
diff --git a/common/lib/xmodule/xmodule/tests/test_graders.py b/common/lib/xmodule/xmodule/tests/test_graders.py
index c71b7e2d66..3e24e8ab12 100644
--- a/common/lib/xmodule/xmodule/tests/test_graders.py
+++ b/common/lib/xmodule/xmodule/tests/test_graders.py
@@ -368,7 +368,7 @@ class ShowCorrectnessTest(unittest.TestCase):
"""
def setUp(self):
- super(ShowCorrectnessTest, self).setUp()
+ super(ShowCorrectnessTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
now = datetime.now(UTC)
day_delta = timedelta(days=1)
diff --git a/common/lib/xmodule/xmodule/tests/test_html_module.py b/common/lib/xmodule/xmodule/tests/test_html_module.py
index 4176c0943d..3966c5f559 100644
--- a/common/lib/xmodule/xmodule/tests/test_html_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_html_module.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import unittest
@@ -96,7 +96,7 @@ class HtmlBlockCourseApiTestCase(unittest.TestCase):
self.assertIn(html, rendered)
-class HtmlBlockSubstitutionTestCase(unittest.TestCase):
+class HtmlBlockSubstitutionTestCase(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
def test_substitution_user_id(self):
sample_xml = '''%%USER_ID%%'''
diff --git a/common/lib/xmodule/xmodule/tests/test_import.py b/common/lib/xmodule/xmodule/tests/test_import.py
index 1b98052398..e13f8f11e9 100644
--- a/common/lib/xmodule/xmodule/tests/test_import.py
+++ b/common/lib/xmodule/xmodule/tests/test_import.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring
import datetime
@@ -30,7 +30,7 @@ COURSE = 'test_course'
RUN = 'test_run'
-class DummySystem(ImportSystem):
+class DummySystem(ImportSystem): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
@patch('xmodule.modulestore.xml.OSFS', lambda dir: OSFS(mkdtemp()))
def __init__(self, load_error_modules, library=False):
@@ -43,7 +43,7 @@ class DummySystem(ImportSystem):
course_dir = "test_dir"
error_tracker = Mock()
- super(DummySystem, self).__init__(
+ super(DummySystem, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
xmlstore=xmlstore,
course_id=course_id,
course_dir=course_dir,
@@ -53,7 +53,7 @@ class DummySystem(ImportSystem):
field_data=KvsFieldData(DictKeyValueStore()),
)
- def render_template(self, _template, _context):
+ def render_template(self, _template, _context): # lint-amnesty, pylint: disable=method-hidden
raise Exception("Shouldn't be called")
@@ -118,7 +118,7 @@ class PureXBlockImportTest(BaseCourseTestCase):
self.assertFalse(mock_location.called)
-class ImportTestCase(BaseCourseTestCase):
+class ImportTestCase(BaseCourseTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
date = Date()
def test_fallback(self):
@@ -564,7 +564,7 @@ class ImportTestCase(BaseCourseTestCase):
expect = "InvalidKeyError"
errors = [
(msg, err)
- for msg, err
+ for msg, err # lint-amnesty, pylint: disable=unnecessary-comprehension
in modulestore.get_course_errors(course.id)
]
diff --git a/common/lib/xmodule/xmodule/tests/test_import_static.py b/common/lib/xmodule/xmodule/tests/test_import_static.py
index df6830f453..ef06cacfaa 100644
--- a/common/lib/xmodule/xmodule/tests/test_import_static.py
+++ b/common/lib/xmodule/xmodule/tests/test_import_static.py
@@ -26,7 +26,7 @@ class IgnoredFilesTestCase(unittest.TestCase):
dict_list = [DOT_FILES_DICT, TILDA_FILES_DICT]
def setUp(self):
- super(IgnoredFilesTestCase, self).setUp()
+ super(IgnoredFilesTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
for dictionary in self.dict_list:
self.addCleanup(remove_temp_files_from_list, list(dictionary.keys()), self.course_dir / "static")
add_temp_files_from_dict(dictionary, self.course_dir / "static")
diff --git a/common/lib/xmodule/xmodule/tests/test_library_content.py b/common/lib/xmodule/xmodule/tests/test_library_content.py
index 8049f1a9fe..cabc1c1a12 100644
--- a/common/lib/xmodule/xmodule/tests/test_library_content.py
+++ b/common/lib/xmodule/xmodule/tests/test_library_content.py
@@ -35,7 +35,7 @@ class LibraryContentTest(MixedSplitTestCase):
Base class for tests of LibraryContentBlock (library_content_block.py)
"""
def setUp(self):
- super(LibraryContentTest, self).setUp()
+ super(LibraryContentTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.tools = LibraryToolsService(self.store, self.user_id)
self.library = LibraryFactory.create(modulestore=self.store)
@@ -378,7 +378,7 @@ class TestLibraryContentBlockWithSearchIndex(LibraryContentBlockTestMixin, Libra
def setUp(self):
""" Sets up search engine mock """
- super(TestLibraryContentBlockWithSearchIndex, self).setUp()
+ super(TestLibraryContentBlockWithSearchIndex, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
search_index_mock.search = Mock(side_effect=self._get_search_response)
@@ -418,7 +418,7 @@ class TestLibraryContentAnalytics(LibraryContentTest):
"""
def setUp(self):
- super(TestLibraryContentAnalytics, self).setUp()
+ super(TestLibraryContentAnalytics, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.publisher = Mock()
self.lc_block.refresh_children()
self.lc_block = self.store.get_item(self.lc_block.location)
diff --git a/common/lib/xmodule/xmodule/tests/test_library_sourced_block.py b/common/lib/xmodule/xmodule/tests/test_library_sourced_block.py
index 5445993068..061eec68f4 100644
--- a/common/lib/xmodule/xmodule/tests/test_library_sourced_block.py
+++ b/common/lib/xmodule/xmodule/tests/test_library_sourced_block.py
@@ -1,15 +1,15 @@
"""
Tests for Source from Library XBlock
"""
-from xblockutils.resources import ResourceLoader
+from xblockutils.resources import ResourceLoader # lint-amnesty, pylint: disable=unused-import
from openedx.core.djangoapps.content_libraries.tests.base import ContentLibrariesRestApiTest
from common.djangoapps.student.roles import CourseInstructorRole
-from cms.lib.xblock.runtime import handler_url
+from cms.lib.xblock.runtime import handler_url # lint-amnesty, pylint: disable=unused-import
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.tests import get_test_system
-from xmodule.x_module import AUTHOR_VIEW, STUDENT_VIEW
+from xmodule.x_module import AUTHOR_VIEW, STUDENT_VIEW # lint-amnesty, pylint: disable=unused-import
class LibrarySourcedBlockTestCase(ContentLibrariesRestApiTest):
diff --git a/common/lib/xmodule/xmodule/tests/test_lti20_unit.py b/common/lib/xmodule/xmodule/tests/test_lti20_unit.py
index a88582eb63..8d0adba57a 100644
--- a/common/lib/xmodule/xmodule/tests/test_lti20_unit.py
+++ b/common/lib/xmodule/xmodule/tests/test_lti20_unit.py
@@ -19,7 +19,7 @@ class LTI20RESTResultServiceTest(LogicTest):
descriptor_class = LTIDescriptor
def setUp(self):
- super(LTI20RESTResultServiceTest, self).setUp()
+ super(LTI20RESTResultServiceTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.environ = {'wsgi.url_scheme': 'http', 'REQUEST_METHOD': 'POST'}
self.system.get_real_user = Mock()
self.system.publish = Mock()
@@ -253,7 +253,7 @@ class LTI20RESTResultServiceTest(LogicTest):
self.assertEqual(response.status_code, 200)
self.assertIsNone(self.xmodule.module_score)
self.assertEqual(self.xmodule.score_comment, u"")
- (_, evt_type, called_grade_obj), _ = self.system.publish.call_args
+ (_, evt_type, called_grade_obj), _ = self.system.publish.call_args # lint-amnesty, pylint: disable=unpacking-non-sequence
self.assertEqual(
called_grade_obj,
{'user_id': self.USER_STANDIN.id, 'value': None, 'max_value': None, 'score_deleted': True},
@@ -276,7 +276,7 @@ class LTI20RESTResultServiceTest(LogicTest):
self.assertEqual(response.status_code, 200)
self.assertIsNone(self.xmodule.module_score)
self.assertEqual(self.xmodule.score_comment, u"")
- (_, evt_type, called_grade_obj), _ = self.system.publish.call_args
+ (_, evt_type, called_grade_obj), _ = self.system.publish.call_args # lint-amnesty, pylint: disable=unpacking-non-sequence
self.assertEqual(
called_grade_obj,
{'user_id': self.USER_STANDIN.id, 'value': None, 'max_value': None, 'score_deleted': True},
@@ -295,7 +295,7 @@ class LTI20RESTResultServiceTest(LogicTest):
self.assertEqual(response.status_code, 200)
self.assertEqual(self.xmodule.module_score, 0.1)
self.assertEqual(self.xmodule.score_comment, u"ಠ益ಠ")
- (_, evt_type, called_grade_obj), _ = self.system.publish.call_args
+ (_, evt_type, called_grade_obj), _ = self.system.publish.call_args # lint-amnesty, pylint: disable=unpacking-non-sequence
self.assertEqual(evt_type, 'grade')
self.assertEqual(
called_grade_obj,
diff --git a/common/lib/xmodule/xmodule/tests/test_lti_unit.py b/common/lib/xmodule/xmodule/tests/test_lti_unit.py
index 0c18c5bea7..142f9927c4 100644
--- a/common/lib/xmodule/xmodule/tests/test_lti_unit.py
+++ b/common/lib/xmodule/xmodule/tests/test_lti_unit.py
@@ -25,7 +25,7 @@ class LTIModuleTest(LogicTest):
descriptor_class = LTIDescriptor
def setUp(self):
- super(LTIModuleTest, self).setUp()
+ super(LTIModuleTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.environ = {'wsgi.url_scheme': 'http', 'REQUEST_METHOD': 'POST'}
self.request_body_xml_template = textwrap.dedent(u"""
@@ -63,7 +63,7 @@ class LTIModuleTest(LogicTest):
self.xmodule.runtime.hostname
)
- sourced_id = u':'.join(six.moves.urllib.parse.quote(i) for i in (self.lti_id, self.unquoted_resource_link_id, self.user_id))
+ sourced_id = u':'.join(six.moves.urllib.parse.quote(i) for i in (self.lti_id, self.unquoted_resource_link_id, self.user_id)) # lint-amnesty, pylint: disable=line-too-long
self.defaults = {
'namespace': "http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0",
diff --git a/common/lib/xmodule/xmodule/tests/test_progress.py b/common/lib/xmodule/xmodule/tests/test_progress.py
index 2a06b87a33..f5e070c751 100644
--- a/common/lib/xmodule/xmodule/tests/test_progress.py
+++ b/common/lib/xmodule/xmodule/tests/test_progress.py
@@ -122,5 +122,5 @@ class ModuleProgressTest(unittest.TestCase):
def test_xmodule_default(self):
'''Make sure default get_progress exists, returns None'''
xmod = x_module.XModule(Mock(), get_test_system(), DictFieldData({'location': 'a://b/c/d/e'}), Mock())
- prg = xmod.get_progress()
+ prg = xmod.get_progress() # lint-amnesty, pylint: disable=assignment-from-none
self.assertEqual(prg, None)
diff --git a/common/lib/xmodule/xmodule/tests/test_sequence.py b/common/lib/xmodule/xmodule/tests/test_sequence.py
index 00bfbd3d4e..955542ccb4 100644
--- a/common/lib/xmodule/xmodule/tests/test_sequence.py
+++ b/common/lib/xmodule/xmodule/tests/test_sequence.py
@@ -40,7 +40,7 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
"""
def setUp(self):
- super(SequenceBlockTestCase, self).setUp()
+ super(SequenceBlockTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
course_xml = self._set_up_course_xml()
self.course = self.process_xml(course_xml)
@@ -430,7 +430,7 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
{'usage_key': usage_key}
))
self.assertIsNot(completion_return, None)
- self.assertTrue('complete' in completion_return)
+ self.assertTrue('complete' in completion_return) # lint-amnesty, pylint: disable=wrong-assert-type
self.assertEqual(completion_return['complete'], True)
def test_handle_ajax_get_completion_return_none(self):
@@ -453,7 +453,7 @@ class SequenceBlockTestCase(XModuleXmlImportTest):
"""
# rather than dealing with json serialization of the Mock object,
# let's just disable the bookmarks service
- self.sequence_3_1.xmodule_runtime._services['bookmarks'] = None
+ self.sequence_3_1.xmodule_runtime._services['bookmarks'] = None # lint-amnesty, pylint: disable=protected-access
metadata = json.loads(self.sequence_3_1.handle_ajax('metadata', {}))
self.assertEqual(len(metadata['items']), 3)
self.assertEqual(metadata['tag'], 'sequential')
diff --git a/common/lib/xmodule/xmodule/tests/test_services.py b/common/lib/xmodule/xmodule/tests/test_services.py
index e7ab75c5c1..836110191d 100644
--- a/common/lib/xmodule/xmodule/tests/test_services.py
+++ b/common/lib/xmodule/xmodule/tests/test_services.py
@@ -21,7 +21,7 @@ from openedx.core.lib.teams_config import TeamsConfig
class _DummyBlock(object):
""" Dummy Xblock class """
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class DummyConfig(ConfigurationModel):
@@ -36,7 +36,7 @@ class DummyUnexpected(object):
"""
Dummy Unexpected Class
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
@ddt.ddt
@@ -48,7 +48,7 @@ class TestSettingsService(unittest.TestCase):
def setUp(self):
""" Setting up tests """
- super(TestSettingsService, self).setUp()
+ super(TestSettingsService, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.settings_service = SettingsService()
self.xblock_mock = mock.Mock()
self.xblock_mock.block_settings_key = self.xblock_setting_key1
@@ -124,8 +124,8 @@ class MockConfigurationService(TeamsConfigurationService):
"""
Mock ConfigurationService for testing.
"""
- def __init__(self, course, **kwargs):
- super(MockConfigurationService, self).__init__()
+ def __init__(self, course, **kwargs): # lint-amnesty, pylint: disable=unused-argument
+ super(MockConfigurationService, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
self._course = course
def get_course(self, course_id):
@@ -138,7 +138,7 @@ class ConfigurationServiceBaseClass(TestCase):
"""
def setUp(self):
- super(ConfigurationServiceBaseClass, self).setUp()
+ super(ConfigurationServiceBaseClass, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.teams_config = TeamsConfig(
{'max_size': 2, 'topics': [{'id': 'topic', 'name': 'Topic', 'description': 'A Topic'}]}
diff --git a/common/lib/xmodule/xmodule/tests/test_split_test_module.py b/common/lib/xmodule/xmodule/tests/test_split_test_module.py
index 92c0351bb7..3c4110c104 100644
--- a/common/lib/xmodule/xmodule/tests/test_split_test_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_split_test_module.py
@@ -115,7 +115,7 @@ class SplitTestBlockTest(XModuleXmlImportTest, PartitionTestCase):
# Mock user_service user
user_service = Mock()
user = Mock(username='ma', email='ma@edx.org', is_staff=False, is_active=True)
- user_service._django_user = user
+ user_service._django_user = user # lint-amnesty, pylint: disable=protected-access
self.module_system._services['user'] = user_service # pylint: disable=protected-access
self.split_test_module = self.course_sequence.get_children()[0]
@@ -206,7 +206,7 @@ class SplitTestBlockStudioTest(SplitTestBlockTest):
"""
@patch('xmodule.split_test_module.SplitTestBlock.group_configuration_url', return_value='http://example.com')
- def test_render_author_view(self, group_configuration_url):
+ def test_render_author_view(self, group_configuration_url): # lint-amnesty, pylint: disable=unused-argument
"""
Test the rendering of the Studio author view.
"""
@@ -372,7 +372,7 @@ class SplitTestBlockStudioTest(SplitTestBlockTest):
self.assertEqual(active_children, [])
self.assertEqual(inactive_children, children)
- def test_validation_messages(self):
+ def test_validation_messages(self): # lint-amnesty, pylint: disable=too-many-statements
"""
Test the validation messages produced for different split test configurations.
"""
diff --git a/common/lib/xmodule/xmodule/tests/test_vertical.py b/common/lib/xmodule/xmodule/tests/test_vertical.py
index cc1d22b8c2..ca50f60286 100644
--- a/common/lib/xmodule/xmodule/tests/test_vertical.py
+++ b/common/lib/xmodule/xmodule/tests/test_vertical.py
@@ -86,7 +86,7 @@ class BaseVerticalBlockTest(XModuleXmlImportTest):
test_problem = 'Test Problem'
def setUp(self):
- super(BaseVerticalBlockTest, self).setUp()
+ super(BaseVerticalBlockTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
# construct module
course = xml.CourseFactory.build()
sequence = xml.SequenceFactory.build(parent=course)
diff --git a/common/lib/xmodule/xmodule/tests/test_video.py b/common/lib/xmodule/xmodule/tests/test_video.py
index fd5fa4c75c..00f0f26027 100644
--- a/common/lib/xmodule/xmodule/tests/test_video.py
+++ b/common/lib/xmodule/xmodule/tests/test_video.py
@@ -106,12 +106,12 @@ def instantiate_descriptor(**field_data):
class _MockValVideoNotFoundError(Exception):
"""Mock ValVideoNotFoundError exception"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class _MockValCannotCreateError(Exception):
"""Mock ValCannotCreateError exception"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
class VideoBlockTest(unittest.TestCase):
@@ -198,7 +198,7 @@ class VideoBlockTestBase(unittest.TestCase):
"""
def setUp(self):
- super(VideoBlockTestBase, self).setUp()
+ super(VideoBlockTestBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.descriptor = instantiate_descriptor()
def assertXmlEqual(self, expected, xml):
@@ -696,7 +696,7 @@ class VideoExportTestCase(VideoBlockTestBase):
"""
def setUp(self):
- super(VideoExportTestCase, self).setUp()
+ super(VideoExportTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.temp_dir = mkdtemp()
self.file_system = OSFS(self.temp_dir)
self.addCleanup(shutil.rmtree, self.temp_dir)
diff --git a/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py b/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py
index a68e3fbeff..31111263a0 100644
--- a/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py
+++ b/common/lib/xmodule/xmodule/tests/test_xblock_wrappers.py
@@ -102,7 +102,7 @@ class ModuleSystemFactory(Factory):
model = ModuleSystem
@classmethod
- def _build(cls, target_class, *args, **kwargs): # pylint: disable=unused-argument
+ def _build(cls, target_class, *args, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""See documentation from :meth:`factory.Factory._build`"""
return get_test_system(*args, **kwargs)
@@ -118,7 +118,7 @@ class DescriptorSystemFactory(Factory):
model = DescriptorSystem
@classmethod
- def _build(cls, target_class, *args, **kwargs): # pylint: disable=unused-argument
+ def _build(cls, target_class, *args, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
"""See documentation from :meth:`factory.Factory._build`"""
return get_test_descriptor_system(*args, **kwargs)
@@ -208,7 +208,7 @@ class LeafDescriptorFactory(Factory):
return self.location
@classmethod
- def _build(cls, target_class, *args, **kwargs): # pylint: disable=unused-argument
+ def _build(cls, target_class, *args, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
runtime = kwargs.pop('runtime')
desc_cls = kwargs.pop('descriptor_cls')
block_type = kwargs.pop('block_type')
@@ -255,7 +255,7 @@ class ContainerModuleFactory(LeafModuleFactory):
and are ready to act as XModules.
"""
@lazy_attribute
- def xmodule_runtime(self):
+ def xmodule_runtime(self): # lint-amnesty, pylint: disable=arguments-differ
return ContainerModuleRuntimeFactory(depth=self.depth) # pylint: disable=no-member
@@ -273,7 +273,7 @@ class XBlockWrapperTestMixin(object):
"""
Raise SkipTest if this descriptor_cls shouldn't be tested.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
def check_property(self, descriptor):
"""
@@ -356,7 +356,7 @@ class TestStudioView(XBlockWrapperTestMixin, TestCase):
raise SkipTest(descriptor_cls.__name__ + " is not editable in studio")
pure_xblock_class = issubclass(descriptor_cls, XBlock) and not issubclass(descriptor_cls, XModuleDescriptor)
- if pure_xblock_class:
+ if pure_xblock_class: # lint-amnesty, pylint: disable=no-else-raise
raise SkipTest(descriptor_cls.__name__ + " is a pure XBlock and implements studio_view")
elif descriptor_cls.studio_view != XModuleDescriptor.studio_view:
raise SkipTest(descriptor_cls.__name__ + " implements studio_view")
@@ -377,7 +377,7 @@ class TestXModuleHandler(TestCase):
"""
def setUp(self):
- super(TestXModuleHandler, self).setUp()
+ super(TestXModuleHandler, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.module = XModule(descriptor=Mock(), field_data=Mock(), runtime=Mock(), scope_ids=Mock())
self.module.handle_ajax = Mock(return_value='{}')
self.request = webob.Request({})
diff --git a/common/lib/xmodule/xmodule/tests/test_xml_module.py b/common/lib/xmodule/xmodule/tests/test_xml_module.py
index 874d0367f0..d913ac93a6 100644
--- a/common/lib/xmodule/xmodule/tests/test_xml_module.py
+++ b/common/lib/xmodule/xmodule/tests/test_xml_module.py
@@ -65,7 +65,7 @@ class InheritingFieldDataTest(unittest.TestCase):
Tests of InheritingFieldData.
"""
- class TestableInheritingXBlock(XmlDescriptor):
+ class TestableInheritingXBlock(XmlDescriptor): # lint-amnesty, pylint: disable=abstract-method
"""
An XBlock we can use in these tests.
"""
@@ -73,7 +73,7 @@ class InheritingFieldDataTest(unittest.TestCase):
not_inherited = String(scope=Scope.settings, default="nothing")
def setUp(self):
- super(InheritingFieldDataTest, self).setUp()
+ super(InheritingFieldDataTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
self.dummy_course_key = CourseLocator('test_org', 'test_123', 'test_run')
self.system = get_test_descriptor_system()
self.all_blocks = {}
@@ -340,10 +340,10 @@ class EditableMetadataFieldsTest(unittest.TestCase):
).editable_metadata_fields
def get_descriptor(self, field_data):
- class TestModuleDescriptor(TestFields, XmlDescriptor):
+ class TestModuleDescriptor(TestFields, XmlDescriptor): # lint-amnesty, pylint: disable=abstract-method
@property
def non_editable_metadata_fields(self):
- non_editable_fields = super(TestModuleDescriptor, self).non_editable_metadata_fields
+ non_editable_fields = super(TestModuleDescriptor, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.append(TestModuleDescriptor.due)
return non_editable_fields
@@ -351,8 +351,8 @@ class EditableMetadataFieldsTest(unittest.TestCase):
system.render_template = Mock(return_value="
Test Template HTML
")
return system.construct_xblock_from_class(TestModuleDescriptor, field_data=field_data, scope_ids=Mock())
- def assert_field_values(self, editable_fields, name, field, explicitly_set, value, default_value,
- type='Generic', options=[]):
+ def assert_field_values(self, editable_fields, name, field, explicitly_set, value, default_value, # lint-amnesty, pylint: disable=dangerous-default-value
+ type='Generic', options=[]): # lint-amnesty, pylint: disable=redefined-builtin
test_field = editable_fields[name]
self.assertEqual(field.name, test_field['field_name'])
@@ -382,7 +382,7 @@ class TestSerialize(unittest.TestCase):
assert serialize_field('fAlse') == 'fAlse'
assert serialize_field('hat box') == 'hat box'
serialized_dict = serialize_field({'bar': 'hat', 'frog': 'green'})
- assert serialized_dict == '{"bar": "hat", "frog": "green"}' or serialized_dict == '{"frog": "green", "bar": "hat"}'
+ assert serialized_dict == '{"bar": "hat", "frog": "green"}' or serialized_dict == '{"frog": "green", "bar": "hat"}' # lint-amnesty, pylint: disable=consider-using-in, line-too-long
assert serialize_field([3.5, 5.6]) == '[3.5, 5.6]'
assert serialize_field(['foo', 'bar']) == '["foo", "bar"]'
assert serialize_field("2012-12-31T23:59:59Z") == '2012-12-31T23:59:59Z'
@@ -395,7 +395,7 @@ class TestDeserialize(unittest.TestCase):
"""
Asserts the result of deserialize_field.
"""
- assert deserialize_field(self.field_type(), arg) == expected
+ assert deserialize_field(self.field_type(), arg) == expected # lint-amnesty, pylint: disable=no-member
def assertDeserializeNonString(self):
"""
@@ -649,7 +649,7 @@ class TestXmlAttributes(XModuleXmlImportTest):
seq = self.process_xml(root)
assert seq.unmixed_class == SequenceDescriptor
- assert type(seq) != SequenceDescriptor
+ assert type(seq) != SequenceDescriptor # lint-amnesty, pylint: disable=unidiomatic-typecheck
# `attribute` is added to the constructed sequence, because
# it's in the InheritanceMixin
diff --git a/common/lib/xmodule/xmodule/tests/xml/__init__.py b/common/lib/xmodule/xmodule/tests/xml/__init__.py
index 4a579199cc..3ebc8f6078 100644
--- a/common/lib/xmodule/xmodule/tests/xml/__init__.py
+++ b/common/lib/xmodule/xmodule/tests/xml/__init__.py
@@ -30,7 +30,7 @@ class InMemorySystem(XMLParsingSystem, MakoDescriptorSystem): # pylint: disable
"""Return the policy data for the specified usage"""
return xml_import_data.policy.get(policy_key(usage_id), {})
- super(InMemorySystem, self).__init__(
+ super(InMemorySystem, self).__init__( # lint-amnesty, pylint: disable=super-with-arguments
get_policy=get_policy,
process_xml=self.process_xml,
load_item=self.load_item,
diff --git a/common/lib/xmodule/xmodule/tests/xml/factories.py b/common/lib/xmodule/xmodule/tests/xml/factories.py
index 83816e1c99..db383ed90b 100644
--- a/common/lib/xmodule/xmodule/tests/xml/factories.py
+++ b/common/lib/xmodule/xmodule/tests/xml/factories.py
@@ -59,7 +59,7 @@ class XmlImportData(object):
# Extract all argument names used to construct XmlImportData objects,
# so that the factory doesn't treat them as XML attributes
-XML_IMPORT_ARGS = inspect.getargspec(XmlImportData.__init__).args
+XML_IMPORT_ARGS = inspect.getargspec(XmlImportData.__init__).args # lint-amnesty, pylint: disable=deprecated-method
class XmlImportFactory(Factory):
diff --git a/common/lib/xmodule/xmodule/timeinfo.py b/common/lib/xmodule/xmodule/timeinfo.py
index 4063713aae..ff3c94c870 100644
--- a/common/lib/xmodule/xmodule/timeinfo.py
+++ b/common/lib/xmodule/xmodule/timeinfo.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import logging
diff --git a/common/lib/xmodule/xmodule/unit_block.py b/common/lib/xmodule/xmodule/unit_block.py
index 91dd1f3cde..712b3b2f63 100644
--- a/common/lib/xmodule/xmodule/unit_block.py
+++ b/common/lib/xmodule/xmodule/unit_block.py
@@ -61,7 +61,7 @@ class UnitBlock(XBlock):
"""
# return key/value fields in a Python dict object
# values may be numeric / string or dict
- xblock_body = super(UnitBlock, self).index_dictionary()
+ xblock_body = super(UnitBlock, self).index_dictionary() # lint-amnesty, pylint: disable=super-with-arguments
index_body = {
"display_name": self.display_name,
}
diff --git a/common/lib/xmodule/xmodule/util/sandboxing.py b/common/lib/xmodule/xmodule/util/sandboxing.py
index 0d80810a78..780a7a7ce3 100644
--- a/common/lib/xmodule/xmodule/util/sandboxing.py
+++ b/common/lib/xmodule/xmodule/util/sandboxing.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import re
diff --git a/common/lib/xmodule/xmodule/validation.py b/common/lib/xmodule/xmodule/validation.py
index 62cc9e42eb..d52e375044 100644
--- a/common/lib/xmodule/xmodule/validation.py
+++ b/common/lib/xmodule/xmodule/validation.py
@@ -33,7 +33,7 @@ class StudioValidationMessage(ValidationMessage):
action_runtime_event (str): An event name to be triggered on the xblock client-side runtime when
the "fix-up" action is clicked (optional).
"""
- super(StudioValidationMessage, self).__init__(message_type, message_text)
+ super(StudioValidationMessage, self).__init__(message_type, message_text) # lint-amnesty, pylint: disable=super-with-arguments
if action_label is not None:
if not isinstance(action_label, six.text_type):
raise TypeError("Action label must be unicode.")
@@ -54,7 +54,7 @@ class StudioValidationMessage(ValidationMessage):
Returns:
dict: A dict representation that is json-serializable.
"""
- serialized = super(StudioValidationMessage, self).to_json()
+ serialized = super(StudioValidationMessage, self).to_json() # lint-amnesty, pylint: disable=super-with-arguments
if hasattr(self, "action_label"):
serialized["action_label"] = self.action_label
if hasattr(self, "action_class"):
@@ -94,7 +94,7 @@ class StudioValidation(Validation):
Args:
xblock_id (object): An identification object that must support conversion to unicode.
"""
- super(StudioValidation, self).__init__(xblock_id)
+ super(StudioValidation, self).__init__(xblock_id) # lint-amnesty, pylint: disable=super-with-arguments
self.summary = None
def set_summary(self, message):
@@ -116,7 +116,7 @@ class StudioValidation(Validation):
Returns:
bool: True iff this instance has no validation issues and therefore has no messages or summary.
"""
- return super(StudioValidation, self).empty and not self.summary
+ return super(StudioValidation, self).empty and not self.summary # lint-amnesty, pylint: disable=super-with-arguments
def to_json(self):
"""
@@ -125,7 +125,7 @@ class StudioValidation(Validation):
Returns:
dict: A dict representation that is json-serializable.
"""
- serialized = super(StudioValidation, self).to_json()
+ serialized = super(StudioValidation, self).to_json() # lint-amnesty, pylint: disable=super-with-arguments
if self.summary:
serialized["summary"] = self.summary.to_json()
return serialized
diff --git a/common/lib/xmodule/xmodule/vertical_block.py b/common/lib/xmodule/xmodule/vertical_block.py
index 52266d0e80..9480f39c35 100644
--- a/common/lib/xmodule/xmodule/vertical_block.py
+++ b/common/lib/xmodule/xmodule/vertical_block.py
@@ -14,7 +14,7 @@ from lxml import etree
from web_fragments.fragment import Fragment
from common.lib.xmodule.xmodule.util.misc import is_xblock_an_assignment
-from xblock.core import XBlock
+from xblock.core import XBlock # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.mako_module import MakoTemplateBlockBase
from xmodule.progress import Progress
from xmodule.seq_module import SequenceFields
@@ -63,14 +63,14 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse
if 'bookmarked' not in child_context:
bookmarks_service = self.runtime.service(self, 'bookmarks')
child_context['bookmarked'] = bookmarks_service.is_bookmarked(
- usage_key=self.location), # pylint: disable=no-member
+ usage_key=self.location), # lint-amnesty, pylint: disable=no-member, trailing-comma-tuple
if 'username' not in child_context:
user_service = self.runtime.service(self, 'user')
child_context['username'] = user_service.get_current_user().opt_attrs.get(
'edx-platform.username'
)
- child_blocks = self.get_display_items()
+ child_blocks = self.get_display_items() # lint-amnesty, pylint: disable=no-member
child_blocks_to_complete_on_view = set()
completion_service = self.runtime.service(self, 'completion')
@@ -101,7 +101,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse
completed = self.is_block_complete_for_assignments(completion_service)
past_due = completed is False and self.due and self.due < datetime.now(pytz.UTC)
cta_service = self.runtime.service(self, 'call_to_action')
- vertical_banner_ctas = (cta_service and cta_service.get_ctas(self, 'vertical_banner', completed)) or []
+ vertical_banner_ctas = (cta_service and cta_service.get_ctas(self, 'vertical_banner', completed)) or [] # lint-amnesty, pylint: disable=consider-using-ternary
fragment_context = {
'items': contents,
@@ -204,14 +204,14 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse
"""
Gather all fields which can't be edited.
"""
- non_editable_fields = super(VerticalBlock, self).non_editable_metadata_fields
+ non_editable_fields = super(VerticalBlock, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.extend([
- self.fields['due'],
+ self.fields['due'], # lint-amnesty, pylint: disable=unsubscriptable-object
])
return non_editable_fields
def studio_view(self, context):
- fragment = super(VerticalBlock, self).studio_view(context)
+ fragment = super(VerticalBlock, self).studio_view(context) # lint-amnesty, pylint: disable=super-with-arguments
# This continues to use the old XModuleDescriptor javascript code to enabled studio editing.
# TODO: Remove this when studio better supports editing of pure XBlocks.
fragment.add_javascript('VerticalBlock = XModule.Descriptor;')
@@ -224,7 +224,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse
# return key/value fields in a Python dict object
# values may be numeric / string or dict
# default implementation is an empty dict
- xblock_body = super(VerticalBlock, self).index_dictionary()
+ xblock_body = super(VerticalBlock, self).index_dictionary() # lint-amnesty, pylint: disable=super-with-arguments
index_body = {
"display_name": self.display_name,
}
diff --git a/common/lib/xmodule/xmodule/video_module/__init__.py b/common/lib/xmodule/xmodule/video_module/__init__.py
index 8c132b766d..a0dc3a5e30 100644
--- a/common/lib/xmodule/xmodule/video_module/__init__.py
+++ b/common/lib/xmodule/xmodule/video_module/__init__.py
@@ -3,6 +3,6 @@ Container for video module and its utils.
"""
from .bumper_utils import *
-from .transcripts_utils import *
+from .transcripts_utils import * # lint-amnesty, pylint: disable=redefined-builtin
from .video_module import *
from .video_utils import *
diff --git a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py
index 781b2ce5f1..f17e019ee8 100644
--- a/common/lib/xmodule/xmodule/video_module/transcripts_utils.py
+++ b/common/lib/xmodule/xmodule/video_module/transcripts_utils.py
@@ -72,7 +72,7 @@ def exception_decorator(func):
return func(*args, **kwds)
except (TranscriptsGenerationException, UnicodeDecodeError) as ex:
log.exception(text_type(ex))
- raise NotFoundError
+ raise NotFoundError # lint-amnesty, pylint: disable=raise-missing-from
return wrapper
@@ -156,7 +156,7 @@ def youtube_video_transcript_name(youtube_text_api):
return None
-def get_transcripts_from_youtube(youtube_id, settings, i18n, youtube_transcript_name=''):
+def get_transcripts_from_youtube(youtube_id, settings, i18n, youtube_transcript_name=''): # lint-amnesty, pylint: disable=redefined-outer-name
"""
Gets transcripts from youtube for youtube_id.
@@ -204,7 +204,7 @@ def get_transcripts_from_youtube(youtube_id, settings, i18n, youtube_transcript_
return {'start': sub_starts, 'end': sub_ends, 'text': sub_texts}
-def download_youtube_subs(youtube_id, video_descriptor, settings):
+def download_youtube_subs(youtube_id, video_descriptor, settings): # lint-amnesty, pylint: disable=redefined-outer-name
"""
Download transcripts from Youtube.
@@ -256,7 +256,7 @@ def generate_subs_from_source(speed_subs, subs_type, subs_filedata, item, langua
msg = _("Something wrong with SubRip transcripts file during parsing. Inner message is {error_message}").format(
error_message=text_type(ex)
)
- raise TranscriptsGenerationException(msg)
+ raise TranscriptsGenerationException(msg) # lint-amnesty, pylint: disable=raise-missing-from
if not srt_subs_obj:
raise TranscriptsGenerationException(_("Something wrong with SubRip transcripts file during parsing."))
@@ -450,7 +450,7 @@ def manage_video_subtitles_save(item, user, old_metadata=None, generate_translat
{speed: subs_id for subs_id, speed in six.iteritems(youtube_speed_dict(item))},
lang,
)
- except TranscriptException as ex:
+ except TranscriptException as ex: # lint-amnesty, pylint: disable=unused-variable
pass
if reraised_message:
item.save_with_metadata(user)
@@ -488,7 +488,7 @@ def generate_sjson_for_all_speeds(item, user_filename, result_subs_dict, lang):
try:
srt_transcripts = contentstore().find(Transcript.asset_location(item.location, user_filename))
except NotFoundError as ex:
- raise TranscriptException(_("{exception_message}: Can't find uploaded transcripts: {user_filename}").format(
+ raise TranscriptException(_("{exception_message}: Can't find uploaded transcripts: {user_filename}").format( # lint-amnesty, pylint: disable=raise-missing-from
exception_message=text_type(ex),
user_filename=user_filename
))
@@ -670,7 +670,7 @@ class Transcript(object):
error_handling=SubRipFile.ERROR_RAISE
)
except Error as ex: # Base exception from pysrt
- raise TranscriptsGenerationException(text_type(ex))
+ raise TranscriptsGenerationException(text_type(ex)) # lint-amnesty, pylint: disable=raise-missing-from
return json.dumps(generate_sjson_from_srt(srt_subs))
@@ -1011,7 +1011,7 @@ def get_transcript_from_blockstore(video_block, language, output_format, transcr
try:
content_binary = blockstore_cache.get_bundle_file_data_with_cache(bundle_uuid, path, bundle_version, draft_name)
except blockstore_api.BundleFileNotFound:
- raise NotFoundError("Transcript file '{}' missing for video XBlock {}".format(
+ raise NotFoundError("Transcript file '{}' missing for video XBlock {}".format( # lint-amnesty, pylint: disable=raise-missing-from
path,
video_block.scope_ids.usage_id,
))
diff --git a/common/lib/xmodule/xmodule/video_module/video_handlers.py b/common/lib/xmodule/xmodule/video_module/video_handlers.py
index 7f46e1f610..b8ba614acc 100644
--- a/common/lib/xmodule/xmodule/video_module/video_handlers.py
+++ b/common/lib/xmodule/xmodule/video_module/video_handlers.py
@@ -98,7 +98,7 @@ class VideoStudentViewHandlers(object):
setattr(self, key, value)
if key == 'speed':
- self.global_speed = self.speed
+ self.global_speed = self.speed # lint-amnesty, pylint: disable=attribute-defined-outside-init
return json.dumps({'success': True})
@@ -239,11 +239,11 @@ class VideoStudentViewHandlers(object):
Return value: JSON response (200 on success, 400 for malformed data)
"""
completion_service = self.runtime.service(self, 'completion')
- if completion_service is None:
+ if completion_service is None: # lint-amnesty, pylint: disable=no-else-raise
raise JsonHandlerError(500, u"No completion service found")
elif not completion_service.completion_tracking_enabled():
raise JsonHandlerError(404, u"Completion tracking is not enabled and API calls are unexpected")
- if not isinstance(data['completion'], (int, float)):
+ if not isinstance(data['completion'], (int, float)): # lint-amnesty, pylint: disable=no-else-raise
message = u"Invalid completion value {}. Must be a float in range [0.0, 1.0]"
raise JsonHandlerError(400, message.format(data['completion']))
elif not 0.0 <= data['completion'] <= 1.0:
@@ -322,8 +322,8 @@ class VideoStudentViewHandlers(object):
log.info("Video: transcript facilities are not available for given language.")
return Response(status=404)
- if language != self.transcript_language:
- self.transcript_language = language
+ if language != self.transcript_language: # lint-amnesty, pylint: disable=access-member-before-definition
+ self.transcript_language = language # lint-amnesty, pylint: disable=attribute-defined-outside-init
try:
if is_bumper:
@@ -384,7 +384,7 @@ class VideoStudentViewHandlers(object):
return response
@XBlock.handler
- def student_view_user_state(self, request, suffix=''):
+ def student_view_user_state(self, request, suffix=''): # lint-amnesty, pylint: disable=unused-argument
"""
Endpoint to get user-specific state, like current position and playback speed,
without rendering the full student_view HTML. This is similar to student_view_state,
@@ -402,7 +402,7 @@ class VideoStudentViewHandlers(object):
)
@XBlock.handler
- def yt_video_metadata(self, request, suffix=''):
+ def yt_video_metadata(self, request, suffix=''): # lint-amnesty, pylint: disable=unused-argument
"""
Endpoint to get YouTube metadata.
This handler is only used in the Blockstore-based runtime. The old
@@ -447,7 +447,7 @@ class VideoStudioViewHandlers(object):
elif (
data['language_code'] != data['new_language_code'] and data['new_language_code'] in available_translations
):
- error = _(u'A transcript with the "{language_code}" language code already exists.'.format(
+ error = _(u'A transcript with the "{language_code}" language code already exists.'.format( # lint-amnesty, pylint: disable=translation-of-non-string
language_code=data['new_language_code']
))
elif 'file' not in data:
diff --git a/common/lib/xmodule/xmodule/video_module/video_module.py b/common/lib/xmodule/xmodule/video_module/video_module.py
index 7e12761a73..f6048b811f 100644
--- a/common/lib/xmodule/xmodule/video_module/video_module.py
+++ b/common/lib/xmodule/xmodule/video_module/video_module.py
@@ -200,7 +200,7 @@ class VideoBlock(
# is enabled for this course
return waffle_flags()[DEPRECATE_YOUTUBE].is_enabled(self.location.course_key)
- def youtube_disabled_for_course(self):
+ def youtube_disabled_for_course(self): # lint-amnesty, pylint: disable=missing-function-docstring
if not self.location.context_key.is_course:
return False # Only courses have this flag
request_cache = RequestCache('youtube_disabled_for_course')
@@ -266,7 +266,7 @@ class VideoBlock(
shim_xmodule_js(fragment, 'Video')
return fragment
- def get_html(self, view=STUDENT_VIEW):
+ def get_html(self, view=STUDENT_VIEW): # lint-amnesty, pylint: disable=arguments-differ, too-many-statements
track_status = (self.download_track and self.track)
transcript_download_format = self.transcript_download_format if not track_status else None
@@ -287,7 +287,7 @@ class VideoBlock(
# If we have an edx_video_id, we prefer its values over what we store
# internally for download links (source, html5_sources) and the youtube
# stream.
- if self.edx_video_id and edxval_api:
+ if self.edx_video_id and edxval_api: # lint-amnesty, pylint: disable=too-many-nested-blocks
try:
val_profiles = ["youtube", "desktop_webm", "desktop_mp4"]
@@ -361,11 +361,11 @@ class VideoBlock(
cdn_exp_group = None
if self.youtube_disabled_for_course():
- self.youtube_streams = ''
+ self.youtube_streams = '' # lint-amnesty, pylint: disable=attribute-defined-outside-init
else:
self.youtube_streams = youtube_streams or create_youtube_string(self) # pylint: disable=W0201
- settings_service = self.runtime.service(self, 'settings')
+ settings_service = self.runtime.service(self, 'settings') # lint-amnesty, pylint: disable=unused-variable
poster = None
if edxval_api and self.edx_video_id:
@@ -467,7 +467,7 @@ class VideoBlock(
'download_video_link': download_video_link,
'track': track_url,
'transcript_download_format': transcript_download_format,
- 'transcript_download_formats_list': self.fields['transcript_download_format'].values,
+ 'transcript_download_formats_list': self.fields['transcript_download_format'].values, # lint-amnesty, pylint: disable=unsubscriptable-object
'license': getattr(self, "license", None),
}
return self.system.render_template('video.html', context)
@@ -478,7 +478,7 @@ class VideoBlock(
is the override of the general XBlock method, and it will also ask
its superclass to validate.
"""
- validation = super(VideoBlock, self).validate()
+ validation = super(VideoBlock, self).validate() # lint-amnesty, pylint: disable=super-with-arguments
if not isinstance(validation, StudioValidation):
validation = StudioValidation.copy(validation)
@@ -501,7 +501,7 @@ class VideoBlock(
)
return validation
- def editor_saved(self, user, old_metadata, old_content):
+ def editor_saved(self, user, old_metadata, old_content): # lint-amnesty, pylint: disable=unused-argument
"""
Used to update video values during `self`:save method from CMS.
old_metadata: dict, values of fields of `self` with scope=settings which were explicitly set by user.
@@ -564,7 +564,7 @@ class VideoBlock(
@property
def editable_metadata_fields(self):
- editable_fields = super(VideoBlock, self).editable_metadata_fields
+ editable_fields = super(VideoBlock, self).editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
settings_service = self.runtime.service(self, 'settings')
if settings_service:
@@ -619,9 +619,9 @@ class VideoBlock(
video_block = runtime.construct_xblock_from_class(cls, keys)
field_data = cls.parse_video_xml(node)
for key, val in field_data.items():
- if key not in cls.fields:
+ if key not in cls.fields: # lint-amnesty, pylint: disable=unsupported-membership-test
continue # parse_video_xml returns some old non-fields like 'source'
- setattr(video_block, key, cls.fields[key].from_json(val))
+ setattr(video_block, key, cls.fields[key].from_json(val)) # lint-amnesty, pylint: disable=unsubscriptable-object
# Don't use VAL in the new runtime:
video_block.edx_video_id = None
return video_block
@@ -666,7 +666,7 @@ class VideoBlock(
return video
- def definition_to_xml(self, resource_fs):
+ def definition_to_xml(self, resource_fs): # lint-amnesty, pylint: disable=too-many-statements
"""
Returns an xml string representing this module.
"""
@@ -690,7 +690,7 @@ class VideoBlock(
# Mild workaround to ensure that tests pass -- if a field
# is set to its default value, we don't write it out.
if value:
- if key in self.fields and self.fields[key].is_set_on(self):
+ if key in self.fields and self.fields[key].is_set_on(self): # lint-amnesty, pylint: disable=unsubscriptable-object, unsupported-membership-test
try:
xml.set(key, six.text_type(value))
except UnicodeDecodeError:
@@ -788,7 +788,7 @@ class VideoBlock(
"""
Extend context by data for transcript basic tab.
"""
- _context = super(VideoBlock, self).get_context()
+ _context = super(VideoBlock, self).get_context() # lint-amnesty, pylint: disable=super-with-arguments
metadata_fields = copy.deepcopy(self.editable_metadata_fields)
@@ -925,7 +925,7 @@ class VideoBlock(
field_data['transcripts'] = {tr.get('language'): tr.get('src') for tr in transcripts}
for attr, value in xml.items():
- if attr in compat_keys:
+ if attr in compat_keys: # lint-amnesty, pylint: disable=consider-using-get
attr = compat_keys[attr]
if attr in cls.metadata_to_strip + ('url_name', 'name'):
continue
@@ -940,12 +940,12 @@ class VideoBlock(
field_data['youtube_id_{0}'.format(normalized_speed.replace('.', '_'))] = youtube_id
elif attr in conversions:
field_data[attr] = conversions[attr](value)
- elif attr not in cls.fields:
+ elif attr not in cls.fields: # lint-amnesty, pylint: disable=unsupported-membership-test
field_data.setdefault('xml_attributes', {})[attr] = value
else:
# We export values with json.dumps (well, except for Strings, but
# for about a month we did it for Strings also).
- field_data[attr] = deserialize_field(cls.fields[attr], value)
+ field_data[attr] = deserialize_field(cls.fields[attr], value) # lint-amnesty, pylint: disable=unsubscriptable-object
course_id = getattr(id_generator, 'target_course_id', None)
# Update the handout location with current course_id
@@ -1016,7 +1016,7 @@ class VideoBlock(
return edx_video_id
def index_dictionary(self):
- xblock_body = super(VideoBlock, self).index_dictionary()
+ xblock_body = super(VideoBlock, self).index_dictionary() # lint-amnesty, pylint: disable=super-with-arguments
video_body = {
"display_name": self.display_name,
}
@@ -1057,7 +1057,7 @@ class VideoBlock(
@request_cached(
request_cache_getter=lambda args, kwargs: args[1],
)
- def get_cached_val_data_for_course(cls, request_cache, video_profile_names, course_id):
+ def get_cached_val_data_for_course(cls, request_cache, video_profile_names, course_id): # lint-amnesty, pylint: disable=unused-argument
"""
Returns the VAL data for the requested video profiles for the given course.
"""
diff --git a/common/lib/xmodule/xmodule/video_module/video_xfields.py b/common/lib/xmodule/xmodule/video_module/video_xfields.py
index 60f257130b..6430a1712f 100644
--- a/common/lib/xmodule/xmodule/video_module/video_xfields.py
+++ b/common/lib/xmodule/xmodule/video_module/video_xfields.py
@@ -1,4 +1,4 @@
-"""
+""" # lint-amnesty, pylint: disable=cyclic-import
XFields for video module.
"""
diff --git a/common/lib/xmodule/xmodule/word_cloud_module.py b/common/lib/xmodule/xmodule/word_cloud_module.py
index a32efa1ffb..c1d63b39a8 100644
--- a/common/lib/xmodule/xmodule/word_cloud_module.py
+++ b/common/lib/xmodule/xmodule/word_cloud_module.py
@@ -274,7 +274,7 @@ class WordCloudBlock( # pylint: disable=abstract-method
'error': 'Unknown Command!'
})
- def student_view(self, context):
+ def student_view(self, context): # lint-amnesty, pylint: disable=unused-argument
"""
Renders the output that a student will see.
"""
@@ -318,7 +318,7 @@ class WordCloudBlock( # pylint: disable=abstract-method
# values may be numeric / string or dict
# default implementation is an empty dict
- xblock_body = super(WordCloudBlock, self).index_dictionary()
+ xblock_body = super(WordCloudBlock, self).index_dictionary() # lint-amnesty, pylint: disable=super-with-arguments
index_body = {
"display_name": self.display_name,
diff --git a/common/lib/xmodule/xmodule/wrapper_module.py b/common/lib/xmodule/xmodule/wrapper_module.py
index 6e35e1ba4e..d42e355d16 100644
--- a/common/lib/xmodule/xmodule/wrapper_module.py
+++ b/common/lib/xmodule/xmodule/wrapper_module.py
@@ -1,4 +1,4 @@
-# Same as vertical,
+# Same as vertical, # lint-amnesty, pylint: disable=missing-module-docstring
# But w/o css delimiters between children
@@ -13,4 +13,4 @@ class WrapperBlock(VerticalBlock):
'''
Layout block for laying out sub-blocks vertically *w/o* css delimiters.
'''
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py
index 6f411a6153..f022644dc8 100644
--- a/common/lib/xmodule/xmodule/x_module.py
+++ b/common/lib/xmodule/xmodule/x_module.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import logging
import os
@@ -235,8 +235,8 @@ class HTMLSnippet(object):
# cdodge: We've moved the xmodule.coffee script from an outside directory into the xmodule area of common
# this means we need to make sure that all xmodules include this dependency which had been previously implicitly
# fulfilled in a different area of code
- coffee = cls.js.setdefault('coffee', [])
- js = cls.js.setdefault('js', [])
+ coffee = cls.js.setdefault('coffee', []) # lint-amnesty, pylint: disable=unused-variable
+ js = cls.js.setdefault('js', []) # lint-amnesty, pylint: disable=unused-variable
# Added xmodule.js separately to enforce 000 prefix for this only.
cls.js.setdefault('xmodule_js', resource_string(__name__, 'js/src/xmodule.js'))
@@ -310,7 +310,7 @@ def shim_xmodule_js(fragment, js_module_name):
"""
# Delay this import so that it is only used (and django settings are parsed) when
# they are required (rather than at startup)
- import webpack_loader.utils
+ import webpack_loader.utils # lint-amnesty, pylint: disable=unused-import
if not fragment.js_init_fn:
fragment.initialize_js('XBlockToXModuleShim')
@@ -369,7 +369,7 @@ class XModuleMixin(XModuleFields, XBlock):
self.xmodule_runtime = None
self._asides = []
- super(XModuleMixin, self).__init__(*args, **kwargs)
+ super(XModuleMixin, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
@property
def runtime(self):
@@ -478,7 +478,7 @@ class XModuleMixin(XModuleFields, XBlock):
any set to None.)
"""
result = {}
- for field in self.fields.values():
+ for field in self.fields.values(): # lint-amnesty, pylint: disable=no-member
if field.scope == scope and field.is_set_on(self):
try:
result[field.name] = field.read_json(self)
@@ -488,7 +488,7 @@ class XModuleMixin(XModuleFields, XBlock):
location=text_type(self.location),
field_name=field.name
)
- raise TypeError(exception_message)
+ raise TypeError(exception_message) # lint-amnesty, pylint: disable=raise-missing-from
return result
def has_children_at_depth(self, depth):
@@ -507,7 +507,7 @@ class XModuleMixin(XModuleFields, XBlock):
So the example above would return True for `has_children_at_depth(2)`, and False
for depth > 2
"""
- if depth < 0:
+ if depth < 0: # lint-amnesty, pylint: disable=no-else-raise
raise ValueError("negative depth argument is invalid")
elif depth == 0:
return bool(self.get_children())
@@ -551,7 +551,7 @@ class XModuleMixin(XModuleFields, XBlock):
return [
child
for child
- in super(XModuleMixin, self).get_children(usage_id_filter)
+ in super(XModuleMixin, self).get_children(usage_id_filter) # lint-amnesty, pylint: disable=super-with-arguments
if child is not None
]
@@ -561,7 +561,7 @@ class XModuleMixin(XModuleFields, XBlock):
is an error while retrieving the block.
"""
try:
- child = super(XModuleMixin, self).get_child(usage_id)
+ child = super(XModuleMixin, self).get_child(usage_id) # lint-amnesty, pylint: disable=super-with-arguments
except ItemNotFoundError:
log.warning(u'Unable to load item %s, skipping', usage_id)
return None
@@ -689,7 +689,7 @@ class XModuleMixin(XModuleFields, XBlock):
self.clear_child_cache()
# Clear out any cached field data scoped to the old user.
- for field in self.fields.values():
+ for field in self.fields.values(): # lint-amnesty, pylint: disable=no-member
if field.scope in (Scope.parent, Scope.children):
continue
@@ -823,7 +823,7 @@ class XModuleMixin(XModuleFields, XBlock):
display_name=self.display_name
)
else:
- display_text = _(DEFAULT_PUBLIC_VIEW_MESSAGE)
+ display_text = _(DEFAULT_PUBLIC_VIEW_MESSAGE) # lint-amnesty, pylint: disable=translation-of-non-string
return Fragment(alert_html.format(display_text))
@@ -922,7 +922,7 @@ class XModuleToXBlockMixin(object):
@XBlock.needs("i18n")
@python_2_unicode_compatible
-class XModule(XModuleToXBlockMixin, HTMLSnippet, XModuleMixin):
+class XModule(XModuleToXBlockMixin, HTMLSnippet, XModuleMixin): # lint-amnesty, pylint: disable=abstract-method
""" Implements a generic learning module.
Subclasses must at a minimum provide a definition for get_html in order
@@ -955,7 +955,7 @@ class XModule(XModuleToXBlockMixin, HTMLSnippet, XModuleMixin):
# Set the descriptor first so that we can proxy to it
self.descriptor = descriptor
self._runtime = None
- super(XModule, self).__init__(*args, **kwargs)
+ super(XModule, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.runtime.xmodule_instance = self
@property
@@ -968,7 +968,7 @@ class XModule(XModuleToXBlockMixin, HTMLSnippet, XModuleMixin):
def __str__(self):
# xss-lint: disable=python-wrap-html
- return u'
'.format(self.id)
+ return u''.format(self.id) # lint-amnesty, pylint: disable=no-member
def handle_ajax(self, _dispatch, _data):
""" dispatch is last part of the URL.
@@ -1011,7 +1011,7 @@ class XModule(XModuleToXBlockMixin, HTMLSnippet, XModuleMixin):
return [self.descriptor]
# ~~~~~~~~~~~~~~~ XBlock API Wrappers ~~~~~~~~~~~~~~~~
- def student_view(self, context):
+ def student_view(self, context): # lint-amnesty, pylint: disable=unused-argument
"""
Return a fragment with the html from this XModule
@@ -1067,9 +1067,9 @@ class ResourceTemplates(object):
return templates
@classmethod
- def get_template_dir(cls):
+ def get_template_dir(cls): # lint-amnesty, pylint: disable=missing-function-docstring
if getattr(cls, 'template_dir_name', None):
- dirname = os.path.join('templates', cls.template_dir_name)
+ dirname = os.path.join('templates', cls.template_dir_name) # lint-amnesty, pylint: disable=no-member
if not resource_isdir(__name__, dirname):
log.warning(u"No resource directory {dir} found when loading {cls_name} templates".format(
dir=dirname,
@@ -1117,7 +1117,7 @@ class XModuleDescriptorToXBlockMixin(object):
# ================================= XML PARSING ============================
@classmethod
- def parse_xml(cls, node, runtime, keys, id_generator):
+ def parse_xml(cls, node, runtime, keys, id_generator): # lint-amnesty, pylint: disable=unused-argument
"""
Interpret the parsed XML in `node`, creating an XModuleDescriptor.
"""
@@ -1191,7 +1191,7 @@ class XModuleDescriptorToXBlockMixin(object):
@XBlock.needs("i18n")
-class XModuleDescriptor(XModuleDescriptorToXBlockMixin, HTMLSnippet, ResourceTemplates, XModuleMixin):
+class XModuleDescriptor(XModuleDescriptorToXBlockMixin, HTMLSnippet, ResourceTemplates, XModuleMixin): # lint-amnesty, pylint: disable=abstract-method
"""
An XModuleDescriptor is a specification for an element of a course. This
could be a problem, an organizational element (a group of content), or a
@@ -1226,7 +1226,7 @@ class XModuleDescriptor(XModuleDescriptorToXBlockMixin, HTMLSnippet, ResourceTem
XModuleDescriptor.__init__ takes the same arguments as xblock.core:XBlock.__init__
"""
- super(XModuleDescriptor, self).__init__(*args, **kwargs)
+ super(XModuleDescriptor, self).__init__(*args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
# update_version is the version which last updated this xblock v prev being the penultimate updater
# leaving off original_version since it complicates creation w/o any obv value yet and is computable
# by following previous until None
@@ -1249,7 +1249,7 @@ class XModuleDescriptor(XModuleDescriptorToXBlockMixin, HTMLSnippet, ResourceTem
old_content (dict): the values of the fields with Scope.content before the save was performed.
This will include 'data'.
"""
- pass
+ pass # lint-amnesty, pylint: disable=unnecessary-pass
# =============================== BUILTIN METHODS ==========================
def __eq__(self, other):
@@ -1258,9 +1258,9 @@ class XModuleDescriptor(XModuleDescriptorToXBlockMixin, HTMLSnippet, ResourceTem
"""
return (hasattr(other, 'scope_ids') and
self.scope_ids == other.scope_ids and
- set(self.fields.keys()) == set(other.fields.keys()) and
+ set(self.fields.keys()) == set(other.fields.keys()) and # lint-amnesty, pylint: disable=no-member
all(getattr(self, field.name) == getattr(other, field.name)
- for field in self.fields.values()))
+ for field in self.fields.values())) # lint-amnesty, pylint: disable=no-member
def __hash__(self): # pylint: disable=useless-super-delegation
"""
@@ -1271,7 +1271,7 @@ class XModuleDescriptor(XModuleDescriptorToXBlockMixin, HTMLSnippet, ResourceTem
performance if we have to rely on lists and equality rather than sets,
dictionaries, and identity-based hash functions.
"""
- return super(XModuleDescriptor, self).__hash__()
+ return super(XModuleDescriptor, self).__hash__() # lint-amnesty, pylint: disable=super-with-arguments
def __repr__(self):
return (
@@ -1357,7 +1357,7 @@ class ConfigurableFragmentWrapper(object):
...
return wrapped_frag
"""
- super(ConfigurableFragmentWrapper, self).__init__(**kwargs)
+ super(ConfigurableFragmentWrapper, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
if wrappers is not None:
self.wrappers = wrappers
else:
@@ -1408,7 +1408,7 @@ def descriptor_global_local_resource_url(block, uri):
"""
See :meth:`xblock.runtime.Runtime.local_resource_url`.
"""
- raise NotImplementedError("Applications must monkey-patch this function before using local_resource_url for studio_view")
+ raise NotImplementedError("Applications must monkey-patch this function before using local_resource_url for studio_view") # lint-amnesty, pylint: disable=line-too-long
class MetricsMixin(object):
@@ -1416,11 +1416,11 @@ class MetricsMixin(object):
Mixin for adding metric logging for render and handle methods in the DescriptorSystem and ModuleSystem.
"""
- def render(self, block, view_name, context=None):
+ def render(self, block, view_name, context=None): # lint-amnesty, pylint: disable=missing-function-docstring
start_time = time.time()
try:
status = "success"
- return super(MetricsMixin, self).render(block, view_name, context=context)
+ return super(MetricsMixin, self).render(block, view_name, context=context) # lint-amnesty, pylint: disable=super-with-arguments
except:
status = "failure"
@@ -1430,7 +1430,7 @@ class MetricsMixin(object):
end_time = time.time()
duration = end_time - start_time
course_id = getattr(self, 'course_id', '')
- tags = [
+ tags = [ # lint-amnesty, pylint: disable=unused-variable
u'view_name:{}'.format(view_name),
u'action:render',
u'action_status:{}'.format(status),
@@ -1446,11 +1446,11 @@ class MetricsMixin(object):
getattr(block, 'location', ''),
)
- def handle(self, block, handler_name, request, suffix=''):
+ def handle(self, block, handler_name, request, suffix=''): # lint-amnesty, pylint: disable=missing-function-docstring
start_time = time.time()
try:
status = "success"
- return super(MetricsMixin, self).handle(block, handler_name, request, suffix=suffix)
+ return super(MetricsMixin, self).handle(block, handler_name, request, suffix=suffix) # lint-amnesty, pylint: disable=super-with-arguments
except:
status = "failure"
@@ -1460,7 +1460,7 @@ class MetricsMixin(object):
end_time = time.time()
duration = end_time - start_time
course_id = getattr(self, 'course_id', '')
- tags = [
+ tags = [ # lint-amnesty, pylint: disable=unused-variable
u'handler_name:{}'.format(handler_name),
u'action:handle',
u'action_status:{}'.format(status),
@@ -1481,7 +1481,7 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
"""
Base class for :class:`Runtime`s to be used with :class:`XModuleDescriptor`s
"""
- # pylint: disable=bad-continuation
+ # lint-amnesty, pylint: disable=bad-continuation, bad-option-value
def __init__(
self, load_item, resources_fs, error_tracker, get_policy=None, disabled_xblock_types=lambda: [], **kwargs
):
@@ -1505,7 +1505,7 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
"""
kwargs.setdefault('id_reader', OpaqueKeyReader())
kwargs.setdefault('id_generator', AsideKeyGenerator())
- super(DescriptorSystem, self).__init__(**kwargs)
+ super(DescriptorSystem, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
# This is used by XModules to write out separate files during xml export
self.export_fs = None
@@ -1530,7 +1530,7 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
"""
if block_type in self.disabled_xblock_types():
return self.default_class
- return super(DescriptorSystem, self).load_block_type(block_type)
+ return super(DescriptorSystem, self).load_block_type(block_type) # lint-amnesty, pylint: disable=super-with-arguments
def get_field_provenance(self, xblock, field):
"""
@@ -1577,7 +1577,7 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
"""
See :meth:`xblock.runtime.Runtime:applicable_aside_types` for documentation.
"""
- potential_set = set(super(DescriptorSystem, self).applicable_aside_types(block))
+ potential_set = set(super(DescriptorSystem, self).applicable_aside_types(block)) # lint-amnesty, pylint: disable=super-with-arguments
if getattr(block, 'xmodule_runtime', None) is not None:
if hasattr(block.xmodule_runtime, 'applicable_aside_types'):
application_set = set(block.xmodule_runtime.applicable_aside_types(block))
@@ -1595,7 +1595,7 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
child.set('url_name', block.url_name)
block.add_xml_to_node(child)
- def publish(self, block, event_type, event):
+ def publish(self, block, event_type, event): # lint-amnesty, pylint: disable=arguments-differ
# A stub publish method that doesn't emit any events from XModuleDescriptors.
pass
@@ -1614,7 +1614,7 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
An object implementing the requested service, or None.
"""
# getting the service from parent module. making sure of block service declarations.
- service = super(DescriptorSystem, self).service(block=block, service_name=service_name)
+ service = super(DescriptorSystem, self).service(block=block, service_name=service_name) # lint-amnesty, pylint: disable=super-with-arguments
# Passing the block to service if it is callable e.g. ModuleI18nService. It is the responsibility of calling
# service to handle the passing argument.
if callable(service):
@@ -1625,14 +1625,14 @@ class DescriptorSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
new_contract('DescriptorSystem', DescriptorSystem)
-class XMLParsingSystem(DescriptorSystem):
+class XMLParsingSystem(DescriptorSystem): # lint-amnesty, pylint: disable=abstract-method, missing-class-docstring
def __init__(self, process_xml, **kwargs):
"""
process_xml: Takes an xml string, and returns a XModuleDescriptor
created from that xml
"""
- super(XMLParsingSystem, self).__init__(**kwargs)
+ super(XMLParsingSystem, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.process_xml = process_xml
def _usage_id_from_node(self, node, parent_id, id_generator=None):
@@ -1834,7 +1834,7 @@ class ModuleSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
# explicit field_data during construct_xblock.
kwargs.setdefault('id_reader', getattr(descriptor_runtime, 'id_reader', OpaqueKeyReader()))
kwargs.setdefault('id_generator', getattr(descriptor_runtime, 'id_generator', AsideKeyGenerator()))
- super(ModuleSystem, self).__init__(field_data=field_data, **kwargs)
+ super(ModuleSystem, self).__init__(field_data=field_data, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
self.STATIC_URL = static_url
self.xqueue = xqueue
@@ -1896,13 +1896,13 @@ class ModuleSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
assert self.xmodule_instance is not None
return self.handler_url(self.xmodule_instance, 'xmodule_handler', '', '').rstrip('/?')
- def get_block(self, block_id, for_parent=None):
+ def get_block(self, block_id, for_parent=None): # lint-amnesty, pylint: disable=arguments-differ
return self.get_module(self.descriptor_runtime.get_block(block_id, for_parent=for_parent))
def resource_url(self, resource):
raise NotImplementedError("edX Platform doesn't currently implement XBlock resource urls")
- def publish(self, block, event_type, event):
+ def publish(self, block, event_type, event): # lint-amnesty, pylint: disable=arguments-differ
pass
def service(self, block, service_name):
@@ -1920,7 +1920,7 @@ class ModuleSystem(MetricsMixin, ConfigurableFragmentWrapper, Runtime):
An object implementing the requested service, or None.
"""
# getting the service from parent module. making sure of block service declarations.
- service = super(ModuleSystem, self).service(block=block, service_name=service_name)
+ service = super(ModuleSystem, self).service(block=block, service_name=service_name) # lint-amnesty, pylint: disable=super-with-arguments
# Passing the block to service if it is callable e.g. ModuleI18nService. It is the responsibility of calling
# service to handle the passing argument.
if callable(service):
@@ -2030,7 +2030,7 @@ class CombinedSystem(object):
Always set the attr on the DescriptorSystem.
"""
if name in self.__slots__:
- return super(CombinedSystem, self).__setattr__(name, value)
+ return super(CombinedSystem, self).__setattr__(name, value) # lint-amnesty, pylint: disable=super-with-arguments
if self._module_system:
setattr(self._module_system, name, value)
diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py
index 1e0ecc1e99..ca97bc6b73 100644
--- a/common/lib/xmodule/xmodule/xml_module.py
+++ b/common/lib/xmodule/xmodule/xml_module.py
@@ -1,4 +1,4 @@
-
+ # lint-amnesty, pylint: disable=missing-module-docstring
import copy
import json
@@ -14,7 +14,7 @@ from xblock.fields import Dict, Scope, ScopeIds
from xblock.runtime import KvsFieldData
from xmodule.modulestore import EdxJSONEncoder
from xmodule.modulestore.inheritance import InheritanceKeyValueStore, own_metadata
-from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, XModuleDescriptor
+from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, XModuleDescriptor # lint-amnesty, pylint: disable=unused-import
log = logging.getLogger(__name__)
@@ -206,7 +206,7 @@ class XmlParserMixin(object):
try:
with fs.open(filepath) as xml_file:
return cls.file_to_xml(xml_file)
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
# Add info about where we are, but keep the traceback
msg = 'Unable to load file contents at path %s for item %s: %s ' % (
filepath, def_id, err)
@@ -357,7 +357,7 @@ class XmlParserMixin(object):
metadata['definition_metadata_raw'] = dmdata
try:
metadata.update(json.loads(dmdata))
- except Exception as err:
+ except Exception as err: # lint-amnesty, pylint: disable=broad-except
log.debug('Error in loading metadata %r', dmdata, exc_info=True)
metadata['definition_metadata_err'] = str(err)
@@ -470,9 +470,9 @@ class XmlParserMixin(object):
val = serialize_field(self._field_data.get(self, attr))
try:
xml_object.set(attr, val)
- except Exception:
+ except Exception: # lint-amnesty, pylint: disable=broad-except
logging.exception(
- u'Failed to serialize metadata attribute %s with value %s in module %s. This could mean data loss!!!',
+ u'Failed to serialize metadata attribute %s with value %s in module %s. This could mean data loss!!!', # lint-amnesty, pylint: disable=line-too-long
attr, val, self.url_name
)
@@ -520,12 +520,12 @@ class XmlParserMixin(object):
"""
Return a list of all metadata fields that cannot be edited.
"""
- non_editable_fields = super(XmlParserMixin, self).non_editable_metadata_fields
+ non_editable_fields = super(XmlParserMixin, self).non_editable_metadata_fields # lint-amnesty, pylint: disable=super-with-arguments
non_editable_fields.append(XmlParserMixin.xml_attributes)
return non_editable_fields
-class XmlMixin(XmlParserMixin):
+class XmlMixin(XmlParserMixin): # lint-amnesty, pylint: disable=abstract-method
"""
Mixin class for standardized parsing of XModule xml.
"""
@@ -581,7 +581,7 @@ class XmlMixin(XmlParserMixin):
except AttributeError:
return super(XmlMixin, cls).parse_xml(node, runtime, keys, id_generator=None)
- def export_to_xml(self, resource_fs):
+ def export_to_xml(self, resource_fs): # lint-amnesty, pylint: disable=unused-argument
"""
Returns an xml string representing this module, and all modules
underneath it. May also write required resources out to resource_fs.
@@ -599,7 +599,7 @@ class XmlMixin(XmlParserMixin):
# a) define export_to_xml themselves
# b) call super(..).export_to_xml(..)
node = Element(self.category)
- super(XmlMixin, self).add_xml_to_node(node)
+ super(XmlMixin, self).add_xml_to_node(node) # lint-amnesty, pylint: disable=super-with-arguments
return etree.tostring(node)
def add_xml_to_node(self, node):
@@ -607,13 +607,13 @@ class XmlMixin(XmlParserMixin):
Export this :class:`XModuleDescriptor` as XML, by setting attributes on the provided
`node`.
"""
- if self.export_to_xml != XmlMixin.export_to_xml:
+ if self.export_to_xml != XmlMixin.export_to_xml: # lint-amnesty, pylint: disable=comparison-with-callable
# Skip the add_xml_to_node from XmlParserMixin to get the shim add_xml_to_node
# from XModuleDescriptor, which actually calls `export_to_xml`.
super(XmlParserMixin, self).add_xml_to_node(node) # pylint: disable=bad-super-call
else:
- super(XmlMixin, self).add_xml_to_node(node)
+ super(XmlMixin, self).add_xml_to_node(node) # lint-amnesty, pylint: disable=super-with-arguments
-class XmlDescriptor(XmlMixin, XModuleDescriptor):
+class XmlDescriptor(XmlMixin, XModuleDescriptor): # lint-amnesty, pylint: disable=abstract-method
pass