Fix PEP8: E231 missing whitespace after '[:,]'
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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","<br/>")
|
||||
'student_response': data['student_answer'].replace("\n", "<br/>"),
|
||||
}
|
||||
|
||||
def save_assessment(self, data, _system):
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user