diff --git a/cms/djangoapps/contentstore/features/video_handout.py b/cms/djangoapps/contentstore/features/video_handout.py index c847a2a5fb..63a9e42c9e 100644 --- a/cms/djangoapps/contentstore/features/video_handout.py +++ b/cms/djangoapps/contentstore/features/video_handout.py @@ -3,7 +3,7 @@ # pylint: disable=C0111 from lettuce import world, step -from nose.tools import assert_true # pylint: disable=E0611 +from nose.tools import assert_true # pylint: disable=E0611 from video_editor import RequestHandlerWithSessionId, success_upload_file diff --git a/cms/djangoapps/contentstore/management/commands/prompt.py b/cms/djangoapps/contentstore/management/commands/prompt.py index 44f981b5ac..260ab44079 100644 --- a/cms/djangoapps/contentstore/management/commands/prompt.py +++ b/cms/djangoapps/contentstore/management/commands/prompt.py @@ -11,8 +11,13 @@ def query_yes_no(question, default="yes"): The "answer" return value is one of "yes" or "no". """ - valid = {"yes": True, "y": True, "ye": True, - "no": False, "n": False} + valid = { + "yes": True, + "y": True, + "ye": True, + "no": False, + "n": False, + } if default is None: prompt = " [y/n] " elif default == "yes": diff --git a/cms/djangoapps/contentstore/views/preview.py b/cms/djangoapps/contentstore/views/preview.py index a16fad00a9..3e292827b1 100644 --- a/cms/djangoapps/contentstore/views/preview.py +++ b/cms/djangoapps/contentstore/views/preview.py @@ -151,7 +151,7 @@ def _preview_module_system(request, descriptor): replace_urls=partial(static_replace.replace_static_urls, data_directory=None, course_id=course_id), user=request.user, can_execute_unsafe_code=(lambda: can_execute_unsafe_code(course_id)), - get_python_lib_zip=(lambda :get_python_lib_zip(contentstore, course_id)), + get_python_lib_zip=(lambda: get_python_lib_zip(contentstore, course_id)), mixins=settings.XBLOCK_MIXINS, course_id=course_id, anonymous_student_id='student', diff --git a/cms/djangoapps/contentstore/views/transcripts_ajax.py b/cms/djangoapps/contentstore/views/transcripts_ajax.py index 57e8e2614e..d404a6d9dc 100644 --- a/cms/djangoapps/contentstore/views/transcripts_ajax.py +++ b/cms/djangoapps/contentstore/views/transcripts_ajax.py @@ -377,7 +377,10 @@ def choose_transcripts(request): if item.sub != html5_id: # update sub value item.sub = html5_id item.save_with_metadata(request.user) - response = {'status': 'Success', 'subs': item.sub} + response = { + 'status': 'Success', + 'subs': item.sub, + } return JsonResponse(response) @@ -408,7 +411,10 @@ def replace_transcripts(request): item.sub = youtube_id item.save_with_metadata(request.user) - response = {'status': 'Success', 'subs': item.sub} + response = { + 'status': 'Success', + 'subs': item.sub, + } return JsonResponse(response) diff --git a/cms/envs/common.py b/cms/envs/common.py index 2e987ed5b0..c542b373b7 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -736,7 +736,7 @@ ADVANCED_COMPONENT_TYPES = [ 'done', # Lets students mark things as done. See https://github.com/pmitros/DoneXBlock 'audio', # Embed an audio file. See https://github.com/pmitros/AudioXBlock 'recommender', # Crowdsourced recommender. Prototype by dli&pmitros. Intended for roll-out in one place in one course. - 'profile', # Prototype user profile XBlock. Used to test XBlock parameter passing. See https://github.com/pmitros/ProfileXBlock + 'profile', # Prototype user profile XBlock. Used to test XBlock parameter passing. See https://github.com/pmitros/ProfileXBlock 'split_test', 'combinedopenended', 'peergrading', diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py index 05986e8b3d..f45e601e6e 100644 --- a/cms/envs/devstack.py +++ b/cms/envs/devstack.py @@ -2,7 +2,7 @@ Specific overrides to the base prod settings to make development easier. """ -from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import +from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import # Don't use S3 in devstack, fall back to filesystem del DEFAULT_FILE_STORAGE diff --git a/cms/envs/test.py b/cms/envs/test.py index f06140c5f8..36b9e54e29 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -69,9 +69,9 @@ STATICFILES_DIRS += [ # If we don't add these settings, then Django templates that can't # find pipelined assets will raise a ValueError. # http://stackoverflow.com/questions/12816941/unit-testing-with-django-pipeline -STATICFILES_STORAGE='pipeline.storage.NonPackagingPipelineStorage' +STATICFILES_STORAGE = 'pipeline.storage.NonPackagingPipelineStorage' STATIC_URL = "/static/" -PIPELINE_ENABLED=False +PIPELINE_ENABLED = False # Update module store settings per defaults for tests update_module_store_settings( diff --git a/common/djangoapps/microsite_configuration/templatetags/microsite.py b/common/djangoapps/microsite_configuration/templatetags/microsite.py index 1aea3c4944..b349f66a87 100644 --- a/common/djangoapps/microsite_configuration/templatetags/microsite.py +++ b/common/djangoapps/microsite_configuration/templatetags/microsite.py @@ -43,7 +43,7 @@ def platform_name(): @register.simple_tag(name="favicon_path") -def favicon_path(default=getattr(settings,'FAVICON_PATH', 'images/favicon.ico')): +def favicon_path(default=getattr(settings, 'FAVICON_PATH', 'images/favicon.ico')): """ Django template tag that outputs the configured favicon: {% favicon_path %} diff --git a/common/djangoapps/student/tests/test_course_listing.py b/common/djangoapps/student/tests/test_course_listing.py index 13d838715e..b73067cbd0 100644 --- a/common/djangoapps/student/tests/test_course_listing.py +++ b/common/djangoapps/student/tests/test_course_listing.py @@ -105,7 +105,10 @@ class TestCourseListing(ModuleStoreTestCase): course_location = SlashSeparatedCourseKey('testOrg', 'erroredCourse', 'RunBabyRun') course = self._create_course_with_access_groups(course_location) course_db_record = mongo_store._find_one(course.location) - course_db_record.setdefault('metadata', {}).get('tabs', []).append({"type": "wiko", "name": "Wiki" }) + course_db_record.setdefault('metadata', {}).get('tabs', []).append({ + "type": "wiko", + "name": "Wiki", + }) mongo_store.collection.update( {'_id': course.location.to_deprecated_son()}, {'$set': { diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 5fa2ba4951..75ad8aa984 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -95,7 +95,9 @@ def initial_setup(server): if browser_driver == 'chrome': desired_capabilities = DesiredCapabilities.CHROME - desired_capabilities['loggingPrefs'] = { 'browser':'ALL' } + desired_capabilities['loggingPrefs'] = { + 'browser': 'ALL', + } elif browser_driver == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX else: @@ -239,7 +241,7 @@ def capture_console_log(scenario): output_dir = '{}/log'.format(settings.TEST_ROOT) file_name = '{}/{}.log'.format(output_dir, scenario.name.replace(' ', '_')) - with open (file_name, 'w') as output_file: + with open(file_name, 'w') as output_file: for line in log: output_file.write("{}{}".format(dumps(line), '\n')) diff --git a/common/djangoapps/terrain/stubs/http.py b/common/djangoapps/terrain/stubs/http.py index 8013616431..80d2a0e70b 100644 --- a/common/djangoapps/terrain/stubs/http.py +++ b/common/djangoapps/terrain/stubs/http.py @@ -123,8 +123,8 @@ class StubHttpRequestHandler(BaseHTTPRequestHandler, object): # By default, `parse_qs` returns a list of values for each param # For convenience, we replace lists of 1 element with just the element return { - k:v[0] if len(v) == 1 else v - for k,v in urlparse.parse_qs(query).items() + key: value[0] if len(value) == 1 else value + for key, value in urlparse.parse_qs(query).items() } @lazy diff --git a/common/djangoapps/terrain/stubs/ora.py b/common/djangoapps/terrain/stubs/ora.py index 1edf93c484..8efc5be4aa 100644 --- a/common/djangoapps/terrain/stubs/ora.py +++ b/common/djangoapps/terrain/stubs/ora.py @@ -45,7 +45,7 @@ class StudentState(object): @property def num_pending(self): - return max(self.INITIAL_ESSAYS_AVAILABLE- self.num_graded, 0) + return max(self.INITIAL_ESSAYS_AVAILABLE - self.num_graded, 0) @property def num_required(self): diff --git a/common/djangoapps/terrain/stubs/tests/test_http.py b/common/djangoapps/terrain/stubs/tests/test_http.py index ba0769ac45..fb768deabc 100644 --- a/common/djangoapps/terrain/stubs/tests/test_http.py +++ b/common/djangoapps/terrain/stubs/tests/test_http.py @@ -25,7 +25,9 @@ class StubHttpServiceTest(unittest.TestCase): 'test_empty': '', 'test_int': 12345, 'test_float': 123.45, - 'test_dict': { 'test_key': 'test_val' }, + 'test_dict': { + 'test_key': 'test_val', + }, 'test_empty_dict': {}, 'test_unicode': u'\u2603 the snowman', 'test_none': None, diff --git a/common/djangoapps/terrain/stubs/tests/test_lti_stub.py b/common/djangoapps/terrain/stubs/tests/test_lti_stub.py index 34f2445ac2..9614e4b9b0 100644 --- a/common/djangoapps/terrain/stubs/tests/test_lti_stub.py +++ b/common/djangoapps/terrain/stubs/tests/test_lti_stub.py @@ -35,7 +35,7 @@ class StubLtiServiceTest(unittest.TestCase): 'launch_presentation_return_url': '', 'lis_outcome_service_url': 'http://localhost:8001/test_callback', 'lis_result_sourcedid': '', - 'resource_link_id':'', + 'resource_link_id': '', } def test_invalid_request_url(self): diff --git a/common/djangoapps/terrain/stubs/xqueue.py b/common/djangoapps/terrain/stubs/xqueue.py index 76ba787fb5..ad66ce2ba3 100644 --- a/common/djangoapps/terrain/stubs/xqueue.py +++ b/common/djangoapps/terrain/stubs/xqueue.py @@ -214,6 +214,7 @@ class StubXQueueService(StubHttpService): except for 'default' and 'register_submission_url' which have special meaning """ return { - key:val for key, val in self.config.iteritems() + key: value + for key, value in self.config.iteritems() if key not in self.NON_QUEUE_CONFIG_KEYS }.items() diff --git a/common/djangoapps/track/middleware.py b/common/djangoapps/track/middleware.py index 9dc2a03692..242e819a5f 100644 --- a/common/djangoapps/track/middleware.py +++ b/common/djangoapps/track/middleware.py @@ -106,7 +106,7 @@ class TrackMiddleware(object): for header_name, context_key in META_KEY_TO_CONTEXT_KEY.iteritems(): context[context_key] = request.META.get(header_name, '') - # Google Analytics uses the clientId to keep track of unique visitors. A GA cookie looks like + # Google Analytics uses the clientId to keep track of unique visitors. A GA cookie looks like # this: _ga=GA1.2.1033501218.1368477899. The clientId is this part: 1033501218.1368477899. google_analytics_cookie = request.COOKIES.get('_ga') if google_analytics_cookie is None: diff --git a/common/lib/capa/capa/safe_exec/safe_exec.py b/common/lib/capa/capa/safe_exec/safe_exec.py index b25f7b47a2..b57afbcd0d 100644 --- a/common/lib/capa/capa/safe_exec/safe_exec.py +++ b/common/lib/capa/capa/safe_exec/safe_exec.py @@ -21,7 +21,7 @@ random.Random = random_module.Random sys.modules['random'] = random """ -ASSUMED_IMPORTS=[ +ASSUMED_IMPORTS = [ ("numpy", "numpy"), ("math", "math"), ("scipy", "scipy"), diff --git a/common/lib/capa/capa/xqueue_interface.py b/common/lib/capa/capa/xqueue_interface.py index 5b877e998b..aa327dc285 100644 --- a/common/lib/capa/capa/xqueue_interface.py +++ b/common/lib/capa/capa/xqueue_interface.py @@ -14,7 +14,7 @@ dateformat = '%Y%m%d%H%M%S' XQUEUE_METRIC_NAME = 'edxapp.xqueue' # Wait time for response from Xqueue. -XQUEUE_TIMEOUT = 35 # seconds +XQUEUE_TIMEOUT = 35 # seconds def make_hashkey(seed): diff --git a/common/lib/sandbox-packages/verifiers/draganddrop.py b/common/lib/sandbox-packages/verifiers/draganddrop.py index cdfa163f33..28ac146d4f 100644 --- a/common/lib/sandbox-packages/verifiers/draganddrop.py +++ b/common/lib/sandbox-packages/verifiers/draganddrop.py @@ -21,7 +21,7 @@ or: { "molecule": "[100, 200]" }, ] } -values are (x,y) coordinates of centers of dragged images. +values are (x, y) coordinates of centers of dragged images. """ import json @@ -77,7 +77,7 @@ class PositionsCompare(list): list or string:: "abc" - target [10, 20] - list of integers - [[10,20], 200] list of list and integer + [[10, 20], 200] list of list and integer """ def __eq__(self, other): @@ -223,10 +223,10 @@ class DragAndDrop(object): Examples: - many draggables per position: - user ['1','2','2','2'] is 'anyof' equal to ['1', '2', '3'] + user ['1', '2', '2', '2'] is 'anyof' equal to ['1', '2', '3'] - draggables can be placed in any order: - user ['1','2','3','4'] is 'anyof' equal to ['4', '2', '1', 3'] + user ['1', '2', '3', '4'] is 'anyof' equal to ['4', '2', '1', 3'] 'unordered_equal' is same as 'exact' but disregards on order @@ -235,7 +235,7 @@ class DragAndDrop(object): Equality functon depends on type of element. They declared in PositionsCompare class. For position like targets ids ("t1", "t2", etc..) it is string equality function. For coordinate - positions ([1,2] or [[1,2], 15]) it is coordinate_positions_compare + positions ([1, 2] or [[1, 2], 15]) it is coordinate_positions_compare function (see docstrings in PositionsCompare class) Args: @@ -352,7 +352,7 @@ class DragAndDrop(object): # correct_answer entries. If the draggable is mentioned in at least one # correct_answer entry, the value is False. # default to consider every user answer excess until proven otherwise. - self.excess_draggables = dict((users_draggable.keys()[0],True) + self.excess_draggables = dict((users_draggable.keys()[0], True) for users_draggable in user_answer) # Convert nested `user_answer` to flat format. @@ -414,8 +414,8 @@ def grade(user_input, correct_answer): 'rule': 'anyof' }, { - 'draggables': ['l1_c','l8_c'], - 'targets': ['t5_c','t6_c'], + 'draggables': ['l1_c', 'l8_c'], + 'targets': ['t5_c', 't6_c'], 'rule': 'anyof' } ] diff --git a/common/lib/xmodule/xmodule/combined_open_ended_module.py b/common/lib/xmodule/xmodule/combined_open_ended_module.py index 3a184ffec0..a6e8d5bf36 100644 --- a/common/lib/xmodule/xmodule/combined_open_ended_module.py +++ b/common/lib/xmodule/xmodule/combined_open_ended_module.py @@ -208,7 +208,7 @@ class CombinedOpenEndedFields(object): "This field is only populated if the instructor changes tasks after " "the module is created and students have attempted it (for example, if a self assessed problem is " "changed to self and peer assessed)."), - scope = Scope.user_state + scope=Scope.user_state, ) task_states = List( help=_("List of state dictionaries of each task within this module."), diff --git a/common/lib/xmodule/xmodule/lti_module.py b/common/lib/xmodule/xmodule/lti_module.py index 2cf31195e6..85d4fb9300 100644 --- a/common/lib/xmodule/xmodule/lti_module.py +++ b/common/lib/xmodule/xmodule/lti_module.py @@ -773,7 +773,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 + '}', '') # 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: 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 4882c42734..e98095b596 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_xml_importer.py @@ -88,7 +88,7 @@ def modulestore(): ModuleStoreNoSettings.modulestore = class_( None, # contentstore ModuleStoreNoSettings.MODULESTORE['DOC_STORE_CONFIG'], - branch_setting_func = lambda: ModuleStoreEnum.Branch.draft_preferred, + branch_setting_func=lambda: ModuleStoreEnum.Branch.draft_preferred, **options ) diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_rubric.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_rubric.py index 0a4641f66d..de90378f6c 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_rubric.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_rubric.py @@ -236,7 +236,7 @@ class CombinedOpenEndedRubric(object): rubric_categories[i]['options'][j]['grader_types'].append(grader_type) #Grab the score and add it to the actual scores. J will be the score for the selected #grader type - if len(actual_scores)<=i: + if len(actual_scores) <= i: #Initialize a new list in the list of lists actual_scores.append([j]) else: @@ -249,7 +249,7 @@ class CombinedOpenEndedRubric(object): for (i, a) in enumerate(actual_scores): if int(a) == max_scores[i]: correct.append(1) - elif int(a)==0: + elif int(a) == 0: correct.append(0) else: correct.append(.5) diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py index 0b72ad7b6f..036ed74b22 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py @@ -103,7 +103,7 @@ class PeerGradingService(GradingService): self._record_result('get_problem_list', result) dog_stats_api.histogram( self._metric_name('get_problem_list.result.length'), - len(result.get('problem_list',[])) + len(result.get('problem_list', [])), ) return result @@ -160,4 +160,11 @@ class MockPeerGradingService(object): ]} def get_data_for_location(self, problem_location, student_id): - return {"version": 1, "count_graded": 3, "count_required": 3, "success": True, "student_sub_count": 1, 'submissions_available' : 0} + return { + "version": 1, + "count_graded": 3, + "count_required": 3, + "success": True, + "student_sub_count": 1, + 'submissions_available': 0, + } diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py index 30c5c10c49..efc4f38d3b 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py @@ -198,7 +198,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild): 'success': success, 'rubric_html': self.get_rubric_html(system), 'error': error_message, - 'student_response': data['student_answer'].replace("\n","
") + 'student_response': data['student_answer'].replace("\n", "
"), } def save_assessment(self, data, _system): diff --git a/common/lib/xmodule/xmodule/split_test_module.py b/common/lib/xmodule/xmodule/split_test_module.py index fdd4629a9a..3dd59bfd68 100644 --- a/common/lib/xmodule/xmodule/split_test_module.py +++ b/common/lib/xmodule/xmodule/split_test_module.py @@ -26,7 +26,7 @@ log = logging.getLogger('edx.' + __name__) # Make '_' a no-op so we can scrape strings _ = lambda text: text -DEFAULT_GROUP_NAME = _(u'Group ID {group_id}') +DEFAULT_GROUP_NAME = _(u'Group ID {group_id}') class SplitTestFields(object): diff --git a/common/lib/xmodule/xmodule/tests/__init__.py b/common/lib/xmodule/xmodule/tests/__init__.py index 960f57c16f..4c8ff94f76 100644 --- a/common/lib/xmodule/xmodule/tests/__init__.py +++ b/common/lib/xmodule/xmodule/tests/__init__.py @@ -89,7 +89,13 @@ def get_test_system(course_id=SlashSeparatedCourseKey('org', 'course', 'run')): filestore=Mock(), debug=True, hostname="edx.org", - xqueue={'interface': None, 'callback_url': '/', 'default_queuename': 'testqueue', 'waittime': 10, 'construct_callback' : Mock(side_effect="/")}, + xqueue={ + 'interface': None, + 'callback_url': '/', + 'default_queuename': 'testqueue', + 'waittime': 10, + 'construct_callback': Mock(side_effect="/"), + }, node_path=os.environ.get("NODE_PATH", "/usr/local/lib/node_modules"), anonymous_student_id='student', open_ended_grading_interface=open_ended_grading_interface, diff --git a/common/lib/xmodule/xmodule/tests/test_video.py b/common/lib/xmodule/xmodule/tests/test_video.py index 8763c15225..f27cb6c2dc 100644 --- a/common/lib/xmodule/xmodule/tests/test_video.py +++ b/common/lib/xmodule/xmodule/tests/test_video.py @@ -566,7 +566,7 @@ class VideoCdnTest(unittest.TestCase): original_video_url = "http://www.original_video.com/original_video.mp4" cdn_response_video_url = "http://www.cdn_video.com/cdn_video.mp4" cdn_response_content = '{{"sources":["{cdn_url}"]}}'.format(cdn_url=cdn_response_video_url) - cdn_response.return_value=Mock(status_code=200, content=cdn_response_content) + cdn_response.return_value = Mock(status_code=200, content=cdn_response_content) fake_cdn_url = 'http://fake_cdn.com/' self.assertEqual( get_video_from_cdn(fake_cdn_url, original_video_url), @@ -579,6 +579,6 @@ class VideoCdnTest(unittest.TestCase): Test if no alternative video in CDN exists. """ original_video_url = "http://www.original_video.com/original_video.mp4" - cdn_response.return_value=Mock(status_code=404) + cdn_response.return_value = Mock(status_code=404) fake_cdn_url = 'http://fake_cdn.com/' self.assertIsNone(get_video_from_cdn(fake_cdn_url, original_video_url)) diff --git a/common/lib/xmodule/xmodule/video_module/video_module.py b/common/lib/xmodule/xmodule/video_module/video_module.py index d10bd65790..0de4ed2f87 100644 --- a/common/lib/xmodule/xmodule/video_module/video_module.py +++ b/common/lib/xmodule/xmodule/video_module/video_module.py @@ -132,7 +132,7 @@ class VideoModule(VideoFields, VideoTranscriptsMixin, VideoStudentViewHandlers, def get_transcripts_for_student(self): """Return transcript information necessary for rendering the XModule student view. - This is more or less a direct extraction from `get_html`. + This is more or less a direct extraction from `get_html`. Returns: Tuple of (track_url, transcript_language, sorted_languages) diff --git a/common/test/acceptance/pages/lms/annotation_component.py b/common/test/acceptance/pages/lms/annotation_component.py index ad8ac3fd20..a1e31fc520 100644 --- a/common/test/acceptance/pages/lms/annotation_component.py +++ b/common/test/acceptance/pages/lms/annotation_component.py @@ -41,7 +41,7 @@ class AnnotationComponentPage(PageObject): Return css selector for current active problem with sub_selector. """ return 'div[data-problem-id="{}"] {}'.format( - self.q(css='.vert-{}'.format(self.active_problem+1)).map( + self.q(css='.vert-{}'.format(self.active_problem + 1)).map( lambda el: el.get_attribute('data-id')).results[0], sub_selector, ) diff --git a/common/test/data/uploads/python_lib_zip/number_helpers.py b/common/test/data/uploads/python_lib_zip/number_helpers.py index 04db8e9bfe..8cc3c93804 100644 --- a/common/test/data/uploads/python_lib_zip/number_helpers.py +++ b/common/test/data/uploads/python_lib_zip/number_helpers.py @@ -3,4 +3,4 @@ def seventeen(): def fortytwo(x): - return 42+x + return 42 + x diff --git a/lms/djangoapps/courseware/features/high-level-tabs.py b/lms/djangoapps/courseware/features/high-level-tabs.py index 774ac841c5..e2c1f7129e 100644 --- a/lms/djangoapps/courseware/features/high-level-tabs.py +++ b/lms/djangoapps/courseware/features/high-level-tabs.py @@ -7,5 +7,5 @@ def i_click_on_the_tab_and_check(step): tab_text = tab_title['TabName'] title = tab_title['PageTitle'] world.click_link(tab_text) - world.wait_for(lambda _driver:title in world.browser.title) + world.wait_for(lambda _driver: title in world.browser.title) assert(title in world.browser.title) diff --git a/lms/djangoapps/courseware/masquerade.py b/lms/djangoapps/courseware/masquerade.py index a044e89d91..41a868cc9b 100644 --- a/lms/djangoapps/courseware/masquerade.py +++ b/lms/djangoapps/courseware/masquerade.py @@ -62,4 +62,4 @@ def is_masquerading_as_student(user): Return True if user is masquerading as a student, False otherwise ''' masq = getattr(user, 'masquerade_as_student', False) - return masq==True + return masq is True diff --git a/lms/djangoapps/courseware/tests/test_navigation.py b/lms/djangoapps/courseware/tests/test_navigation.py index 8d97567c5d..6b5dbe41a3 100644 --- a/lms/djangoapps/courseware/tests/test_navigation.py +++ b/lms/djangoapps/courseware/tests/test_navigation.py @@ -79,7 +79,7 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase): ''' Check if the progress tab is active in the tab set ''' for line in response.content.split('\n'): if tabname in line and 'active' in line: - raise AssertionError("assertTabInactive failed: "+tabname+" active") + raise AssertionError("assertTabInactive failed: " + tabname + " active") return def test_chrome_settings(self): diff --git a/lms/djangoapps/instructor/tests/test_legacy_xss.py b/lms/djangoapps/instructor/tests/test_legacy_xss.py index bd0e75f7f7..310e9c3eb9 100644 --- a/lms/djangoapps/instructor/tests/test_legacy_xss.py +++ b/lms/djangoapps/instructor/tests/test_legacy_xss.py @@ -45,7 +45,7 @@ class TestXss(ModuleStoreTestCase): Build a request with the given action, call the instructor dashboard view, and check that HTML code in a user's name is properly escaped. """ - req = self._request_factory.post( + req = self._request_factory.post( "dummy_url", data={"action": action} ) diff --git a/lms/djangoapps/notification_prefs/tests.py b/lms/djangoapps/notification_prefs/tests.py index 2a12f70047..3206dfaabc 100644 --- a/lms/djangoapps/notification_prefs/tests.py +++ b/lms/djangoapps/notification_prefs/tests.py @@ -67,7 +67,7 @@ class NotificationPrefViewTest(UrlResetMixin, TestCase): request.user = self.user response = ajax_status(request) self.assertEqual(response.status_code, 200) - self.assertEqual(json.loads(response.content), {"status":0}) + self.assertEqual(json.loads(response.content), {"status": 0}) def test_ajax_status_get_1(self): self.create_prefs() @@ -75,7 +75,7 @@ class NotificationPrefViewTest(UrlResetMixin, TestCase): request.user = self.user response = ajax_status(request) self.assertEqual(response.status_code, 200) - self.assertEqual(json.loads(response.content), {"status":1}) + self.assertEqual(json.loads(response.content), {"status": 1}) def test_ajax_status_post(self): request = self.request_factory.post("dummy") diff --git a/lms/djangoapps/notification_prefs/views.py b/lms/djangoapps/notification_prefs/views.py index 4df6465830..eef24c5ee4 100644 --- a/lms/djangoapps/notification_prefs/views.py +++ b/lms/djangoapps/notification_prefs/views.py @@ -149,7 +149,7 @@ def ajax_status(request): key=NOTIFICATION_PREF_KEY ) - return HttpResponse(json.dumps({"status":len(qs)}), content_type="application/json") + return HttpResponse(json.dumps({"status": len(qs)}), content_type="application/json") @require_GET diff --git a/lms/djangoapps/open_ended_grading/staff_grading_service.py b/lms/djangoapps/open_ended_grading/staff_grading_service.py index d67376591b..81baf721c2 100644 --- a/lms/djangoapps/open_ended_grading/staff_grading_service.py +++ b/lms/djangoapps/open_ended_grading/staff_grading_service.py @@ -321,7 +321,7 @@ def get_problem_list(request, course_id): u'If not, please do so and return to this page.' ) valid_problem_list = [] - for i in xrange(0,len(problem_list)): + for i in xrange(0, len(problem_list)): # Needed to ensure that the 'location' key can be accessed. try: problem_list[i] = json.loads(problem_list[i]) diff --git a/lms/djangoapps/shoppingcart/processors/CyberSource2.py b/lms/djangoapps/shoppingcart/processors/CyberSource2.py index 1d66138a96..2794e03448 100644 --- a/lms/djangoapps/shoppingcart/processors/CyberSource2.py +++ b/lms/djangoapps/shoppingcart/processors/CyberSource2.py @@ -288,7 +288,7 @@ def get_purchase_params(cart, callback_url=None, extra_data=None): params['transaction_type'] = 'sale' params['locale'] = 'en' - params['signed_date_time'] = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') + params['signed_date_time'] = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') params['signed_field_names'] = 'access_key,profile_id,amount,currency,transaction_type,reference_number,signed_date_time,locale,transaction_uuid,signed_field_names,unsigned_field_names,orderNumber' params['unsigned_field_names'] = '' params['transaction_uuid'] = uuid.uuid4().hex diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 4d454f90f8..dadeb56568 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -110,7 +110,7 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None): if page is not None: viewer_params += '&page={}'.format(page) - if request.GET.get('viewer','') == 'true': + if request.GET.get('viewer', '') == 'true': template = 'pdf_viewer.html' else: template = 'static_pdfbook.html' diff --git a/pavelib/utils/test/suites/acceptance_suite.py b/pavelib/utils/test/suites/acceptance_suite.py index d33ee744fe..377b753836 100644 --- a/pavelib/utils/test/suites/acceptance_suite.py +++ b/pavelib/utils/test/suites/acceptance_suite.py @@ -33,7 +33,7 @@ class AcceptanceTest(TestSuite): @property def cmd(self): - report_file = self.report_dir / "{}.xml".format(self.system) + report_file = self.report_dir / "{}.xml".format(self.system) report_args = "--with-xunit --xunit-file {}".format(report_file) cmd = ( diff --git a/scripts/all-tests.sh b/scripts/all-tests.sh index a666402078..52cab28a02 100755 --- a/scripts/all-tests.sh +++ b/scripts/all-tests.sh @@ -57,7 +57,7 @@ set -e # Violations thresholds for failing the build PYLINT_THRESHOLD=4725 -PEP8_THRESHOLD=200 +PEP8_THRESHOLD=150 source $HOME/jenkins_env diff --git a/scripts/cov_merge.py b/scripts/cov_merge.py index 8b4cd1c6d5..02632d14be 100644 --- a/scripts/cov_merge.py +++ b/scripts/cov_merge.py @@ -119,7 +119,7 @@ class ReportMerge(object): report_path = os.path.join(self.DESTINATION, output_file) else: report_filename = path.split('reports/')[1].split('/cover')[0].replace('/', '_') - report_path = os.path.join(self.DESTINATION, report_filename+'_coverage.html') + report_path = os.path.join(self.DESTINATION, report_filename + '_coverage.html') # Write everything to single report file with open(report_path, 'w') as report_file: