From 7229ef92ee248b1ea8ccf03b082ec94206c874e0 Mon Sep 17 00:00:00 2001 From: Sarina Canelake Date: Sun, 30 Nov 2014 17:16:42 -0500 Subject: [PATCH] s/pylint: disable=W0212/pylint: disable=protected-access/ --- .../contentstore/tests/test_contentstore.py | 1 - common/lib/capa/capa/tests/test_inputtypes.py | 46 +++++++++---------- .../xmodule/modulestore/tests/test_mongo.py | 2 +- .../tests/test_split_modulestore.py | 4 +- .../xmodule/xmodule/tests/test_capa_module.py | 4 +- .../lib/xmodule/xmodule/tests/test_import.py | 4 +- .../xmodule/tests/test_textannotation.py | 4 +- .../lib/xmodule/xmodule/tests/test_video.py | 2 +- .../xmodule/tests/test_videoannotation.py | 8 ++-- docs/en_us/developers/source/conf.py | 2 +- docs/en_us/platform_api/source/conf.py | 2 +- lms/djangoapps/course_wiki/middleware.py | 2 +- .../courseware/tests/test_access.py | 2 +- .../courseware/tests/test_video_xml.py | 2 +- lms/djangoapps/shoppingcart/admin.py | 2 +- 15 files changed, 43 insertions(+), 44 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 9bde0a6672..b753bbe130 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# pylint: disable=W0212 import copy import mock diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py index b53ce496f4..632ae5dcb9 100644 --- a/common/lib/capa/capa/tests/test_inputtypes.py +++ b/common/lib/capa/capa/tests/test_inputtypes.py @@ -54,7 +54,7 @@ class OptionInputTest(unittest.TestCase): 'status': 'answered'} option_input = lookup_tag('optioninput')(test_capa_system(), element, state) - context = option_input._get_render_context() # pylint: disable=W0212 + context = option_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -114,7 +114,7 @@ class ChoiceGroupTest(unittest.TestCase): the_input = lookup_tag(tag)(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -168,7 +168,7 @@ class JavascriptInputTest(unittest.TestCase): state = {'value': '3', } the_input = lookup_tag('javascriptinput')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -200,7 +200,7 @@ class TextLineTest(unittest.TestCase): state = {'value': 'BumbleBee', } the_input = lookup_tag('textline')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -232,7 +232,7 @@ class TextLineTest(unittest.TestCase): state = {'value': 'BumbleBee', } the_input = lookup_tag('textline')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -276,7 +276,7 @@ class TextLineTest(unittest.TestCase): state = {'value': 'BumbleBee', } the_input = lookup_tag('textline')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -318,7 +318,7 @@ class FileSubmissionTest(unittest.TestCase): input_class = lookup_tag('filesubmission') the_input = input_class(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -367,7 +367,7 @@ class CodeInputTest(unittest.TestCase): input_class = lookup_tag('codeinput') the_input = input_class(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -421,7 +421,7 @@ class MatlabTest(unittest.TestCase): self.the_input = self.input_class(test_capa_system(), elt, state) def test_rendering(self): - context = self.the_input._get_render_context() # pylint: disable=W0212 + context = self.the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -452,7 +452,7 @@ class MatlabTest(unittest.TestCase): elt = etree.fromstring(self.xml) the_input = self.input_class(test_capa_system(), elt, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -484,7 +484,7 @@ class MatlabTest(unittest.TestCase): elt = etree.fromstring(self.xml) the_input = self.input_class(test_capa_system(), elt, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', 'id': 'prob_1_2', @@ -515,7 +515,7 @@ class MatlabTest(unittest.TestCase): elt = etree.fromstring(self.xml) the_input = self.input_class(test_capa_system(), elt, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', 'id': 'prob_1_2', @@ -721,7 +721,7 @@ class MatlabTest(unittest.TestCase): elt = etree.fromstring(self.xml) the_input = self.input_class(test_capa_system(), elt, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access self.maxDiff = None expected = fromstring(u'\n
if Conditionally execute statements.\nThe general form of the if statement is\n\n if expression\n statements\n ELSEIF expression\n statements\n ELSE\n statements\n END\n\nThe statements are executed if the real part of the expression \nhas all non-zero elements. The ELSE and ELSEIF parts are optional.\nZero or more ELSEIF parts can be used as well as nested if\'s.\nThe expression is usually of the form expr rop expr where \nrop is ==, <, >, <=, >=, or ~=.\n\n\nExample\n if I == J\n A(I,J) = 2;\n elseif abs(I-J) == 1\n A(I,J) = -1;\n else\n A(I,J) = 0;\n end\n\nSee also relop, else, elseif, end, for, while, switch.\n\nReference page in Help browser\n doc if\n\n
\n') received = fromstring(context['queue_msg']) @@ -792,7 +792,7 @@ class MatlabTest(unittest.TestCase): not_allowed_tag = 'script' self.the_input.msg = "<{0}>Test message".format(not_allowed_tag) expected = "<script>Test message</script>" - self.assertEqual(self.the_input._get_render_context()['msg'], expected) + self.assertEqual(self.the_input._get_render_context()['msg'], expected) # pylint: disable=protected-access def html_tree_equal(received, expected): @@ -840,7 +840,7 @@ class SchematicTest(unittest.TestCase): the_input = lookup_tag('schematic')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -884,7 +884,7 @@ class ImageInputTest(unittest.TestCase): the_input = lookup_tag('imageinput')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -939,7 +939,7 @@ class CrystallographyTest(unittest.TestCase): the_input = lookup_tag('crystallography')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -981,7 +981,7 @@ class VseprTest(unittest.TestCase): the_input = lookup_tag('vsepr_input')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -1013,7 +1013,7 @@ class ChemicalEquationTest(unittest.TestCase): def test_rendering(self): ''' Verify that the render context matches the expected render context''' - context = self.the_input._get_render_context() # pylint: disable=W0212 + context = self.the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -1101,7 +1101,7 @@ class FormulaEquationTest(unittest.TestCase): """ Verify that the render context matches the expected render context """ - context = self.the_input._get_render_context() # pylint: disable=W0212 + context = self.the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -1231,7 +1231,7 @@ class DragAndDropTest(unittest.TestCase): the_input = lookup_tag('drag_and_drop_input')(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', 'id': 'prob_1_2', @@ -1283,7 +1283,7 @@ class AnnotationInputTest(unittest.TestCase): the_input = lookup_tag(tag)(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access expected = { 'STATIC_URL': '/dummy-static/', @@ -1373,7 +1373,7 @@ class TestChoiceText(unittest.TestCase): } expected.update(state) the_input = lookup_tag(tag)(test_capa_system(), element, state) - context = the_input._get_render_context() # pylint: disable=W0212 + context = the_input._get_render_context() # pylint: disable=protected-access self.assertEqual(context, expected) def test_radiotextgroup(self): diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py index 663be7a467..b08031252a 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py @@ -2,7 +2,7 @@ Unit tests for the Mongo modulestore """ # pylint: disable=no-member -# pylint: disable=W0212 +# pylint: disable=protected-access # pylint: disable=no-name-in-module from nose.tools import assert_equals, assert_raises, \ assert_not_equals, assert_false, assert_true, assert_greater, assert_is_instance, assert_is_none 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 8ea9d26c81..c2135b5291 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py @@ -865,7 +865,7 @@ class SplitModuleItemTests(SplitModuleTest): with self.assertRaises(ItemNotFoundError): modulestore().get_item(locator) - # pylint: disable=W0212 + # pylint: disable=protected-access def test_matching(self): ''' test the block and value matches help functions @@ -1304,7 +1304,7 @@ class TestItemCrud(SplitModuleTest): fields={'display_name': 'problem 2', 'data': another_payload}, definition_locator=original.definition_locator, ) - # pylint: disable=W0212 + # pylint: disable=protected-access modulestore()._clear_cache() # now begin the test diff --git a/common/lib/xmodule/xmodule/tests/test_capa_module.py b/common/lib/xmodule/xmodule/tests/test_capa_module.py index 4d117c69e9..65213e58f0 100644 --- a/common/lib/xmodule/xmodule/tests/test_capa_module.py +++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py @@ -601,7 +601,7 @@ class CapaModuleTest(unittest.TestCase): def test_check_problem_with_files(self): # Check a problem with uploaded files, using the check_problem API. - # pylint: disable=W0212 + # pylint: disable=protected-access # The files we'll be uploading. fnames = ["prog1.py", "prog2.py", "prog3.py"] @@ -650,7 +650,7 @@ class CapaModuleTest(unittest.TestCase): def test_check_problem_with_files_as_xblock(self): # Check a problem with uploaded files, using the XBlock API. - # pylint: disable=W0212 + # pylint: disable=protected-access # The files we'll be uploading. fnames = ["prog1.py", "prog2.py", "prog3.py"] diff --git a/common/lib/xmodule/xmodule/tests/test_import.py b/common/lib/xmodule/xmodule/tests/test_import.py index 2d7518b1c6..079b73f81c 100644 --- a/common/lib/xmodule/xmodule/tests/test_import.py +++ b/common/lib/xmodule/xmodule/tests/test_import.py @@ -206,7 +206,7 @@ class ImportTestCase(BaseCourseTestCase): descriptor = system.process_xml(start_xml) compute_inherited_metadata(descriptor) - # pylint: disable=W0212 + # pylint: disable=protected-access print(descriptor, descriptor._field_data) self.assertEqual(descriptor.due, ImportTestCase.date.from_json(v)) @@ -296,7 +296,7 @@ class ImportTestCase(BaseCourseTestCase): '''.format(due=course_due, org=ORG, course=COURSE, url_name=url_name) descriptor = system.process_xml(start_xml) child = descriptor.get_children()[0] - # pylint: disable=W0212 + # pylint: disable=protected-access child._field_data.set(child, 'due', child_due) compute_inherited_metadata(descriptor) diff --git a/common/lib/xmodule/xmodule/tests/test_textannotation.py b/common/lib/xmodule/xmodule/tests/test_textannotation.py index 23d41a659b..7d0e664cdc 100644 --- a/common/lib/xmodule/xmodule/tests/test_textannotation.py +++ b/common/lib/xmodule/xmodule/tests/test_textannotation.py @@ -60,12 +60,12 @@ class TextAnnotationModuleTestCase(unittest.TestCase): xmltree = etree.fromstring(self.sample_xml) expected_xml = u"

Test Instructions.

" - actual_xml = self.mod._extract_instructions(xmltree) # pylint: disable=W0212 + actual_xml = self.mod._extract_instructions(xmltree) # pylint: disable=protected-access self.assertIsNotNone(actual_xml) self.assertEqual(expected_xml.strip(), actual_xml.strip()) xmltree = etree.fromstring('foo') - actual = self.mod._extract_instructions(xmltree) # pylint: disable=W0212 + actual = self.mod._extract_instructions(xmltree) # pylint: disable=protected-access self.assertIsNone(actual) def test_student_view(self): diff --git a/common/lib/xmodule/xmodule/tests/test_video.py b/common/lib/xmodule/xmodule/tests/test_video.py index f27cb6c2dc..f92c3f9cb1 100644 --- a/common/lib/xmodule/xmodule/tests/test_video.py +++ b/common/lib/xmodule/xmodule/tests/test_video.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# pylint: disable=W0212 +# pylint: disable=protected-access """Test for Video Xmodule functional logic. These test data read from xml, not from mongo. diff --git a/common/lib/xmodule/xmodule/tests/test_videoannotation.py b/common/lib/xmodule/xmodule/tests/test_videoannotation.py index 18630344b6..075cee71df 100644 --- a/common/lib/xmodule/xmodule/tests/test_videoannotation.py +++ b/common/lib/xmodule/xmodule/tests/test_videoannotation.py @@ -56,12 +56,12 @@ class VideoAnnotationModuleTestCase(unittest.TestCase): xmltree = etree.fromstring(self.sample_xml) expected_xml = u"

Video Test Instructions.

" - actual_xml = self.mod._extract_instructions(xmltree) # pylint: disable=W0212 + actual_xml = self.mod._extract_instructions(xmltree) # pylint: disable=protected-access self.assertIsNotNone(actual_xml) self.assertEqual(expected_xml.strip(), actual_xml.strip()) xmltree = etree.fromstring('foo') - actual = self.mod._extract_instructions(xmltree) # pylint: disable=W0212 + actual = self.mod._extract_instructions(xmltree) # pylint: disable=protected-access self.assertIsNone(actual) def test_get_extension(self): @@ -71,8 +71,8 @@ class VideoAnnotationModuleTestCase(unittest.TestCase): """ expectedyoutube = 'video/youtube' expectednotyoutube = 'video/mp4' - result1 = self.mod._get_extension(self.sample_sourceurl) # pylint: disable=W0212 - result2 = self.mod._get_extension(self.sample_youtubeurl) # pylint: disable=W0212 + result1 = self.mod._get_extension(self.sample_sourceurl) # pylint: disable=protected-access + result2 = self.mod._get_extension(self.sample_youtubeurl) # pylint: disable=protected-access self.assertEqual(expectedyoutube, result2) self.assertEqual(expectednotyoutube, result1) diff --git a/docs/en_us/developers/source/conf.py b/docs/en_us/developers/source/conf.py index ff60da07dd..bccbb11c5e 100644 --- a/docs/en_us/developers/source/conf.py +++ b/docs/en_us/developers/source/conf.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # pylint: disable=invalid-name # pylint: disable=W0622 -# pylint: disable=W0212 +# pylint: disable=protected-access # pylint: disable=unused-argument import os diff --git a/docs/en_us/platform_api/source/conf.py b/docs/en_us/platform_api/source/conf.py index 0836542763..628aed8b5d 100644 --- a/docs/en_us/platform_api/source/conf.py +++ b/docs/en_us/platform_api/source/conf.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # pylint: disable=invalid-name # pylint: disable=W0622 -# pylint: disable=W0212 +# pylint: disable=protected-access # pylint: disable=unused-argument import os diff --git a/lms/djangoapps/course_wiki/middleware.py b/lms/djangoapps/course_wiki/middleware.py index 355d4d9f8b..ba824f305f 100644 --- a/lms/djangoapps/course_wiki/middleware.py +++ b/lms/djangoapps/course_wiki/middleware.py @@ -98,5 +98,5 @@ class WikiAccessMiddleware(object): response = self._redirect_from_referrer(request, wiki_path) or response # END HACK: _transform_url must be set to a no-op function after it's done its work - reverse._transform_url = lambda url: url # pylint: disable=W0212 + reverse._transform_url = lambda url: url # pylint: disable=protected-access return response diff --git a/lms/djangoapps/courseware/tests/test_access.py b/lms/djangoapps/courseware/tests/test_access.py index bd2a8217a7..0963b74489 100644 --- a/lms/djangoapps/courseware/tests/test_access.py +++ b/lms/djangoapps/courseware/tests/test_access.py @@ -16,7 +16,7 @@ from xmodule.course_module import ( CATALOG_VISIBILITY_NONE) # pylint: disable=missing-docstring -# pylint: disable=W0212 +# pylint: disable=protected-access class AccessTestCase(TestCase): diff --git a/lms/djangoapps/courseware/tests/test_video_xml.py b/lms/djangoapps/courseware/tests/test_video_xml.py index 5f9c87be16..508c261c5c 100644 --- a/lms/djangoapps/courseware/tests/test_video_xml.py +++ b/lms/djangoapps/courseware/tests/test_video_xml.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# pylint: disable=W0212 +# pylint: disable=protected-access """Test for Video Xmodule functional logic. These test data read from xml, not from mongo. diff --git a/lms/djangoapps/shoppingcart/admin.py b/lms/djangoapps/shoppingcart/admin.py index d2d9195777..8f68b098c2 100644 --- a/lms/djangoapps/shoppingcart/admin.py +++ b/lms/djangoapps/shoppingcart/admin.py @@ -22,7 +22,7 @@ class SoftDeleteCouponAdmin(admin.ModelAdmin): admin site. This is used by changelist_view. """ # Default: qs = self.model._default_manager.get_active_coupons_query_set() # Queryset with all the coupons including the soft-deletes: qs = self.model._default_manager.get_query_set() - query_string = self.model._default_manager.get_active_coupons_query_set() # pylint: disable=W0212 + query_string = self.model._default_manager.get_active_coupons_query_set() # pylint: disable=protected-access return query_string def get_actions(self, request):