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/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/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/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/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/open_ended_grading_classes/peer_grading_service.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py
index bd6cf0ef2c..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
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/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/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/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'