diff options
author | maheshgudi | 2018-10-15 17:23:43 +0530 |
---|---|---|
committer | ankitjavalkar | 2019-12-27 11:02:25 +0530 |
commit | 28c64f6f1771fe93385e3767d5bee9fe55af8c82 (patch) | |
tree | 34fbf78dd0fb85671746be09008d49dcfb269486 /yaksh | |
parent | 3a0acf73017899067b75b23b7df0eac0ab888abf (diff) | |
download | online_test-28c64f6f1771fe93385e3767d5bee9fe55af8c82.tar.gz online_test-28c64f6f1771fe93385e3767d5bee9fe55af8c82.tar.bz2 online_test-28c64f6f1771fe93385e3767d5bee9fe55af8c82.zip |
Fix pep8 for stdio spacing error
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/error_messages.py | 2 | ||||
-rw-r--r-- | yaksh/templatetags/custom_filters.py | 4 | ||||
-rw-r--r-- | yaksh/templatetags/test_custom_filters.py | 4 | ||||
-rw-r--r-- | yaksh/views.py | 16 |
4 files changed, 15 insertions, 11 deletions
diff --git a/yaksh/error_messages.py b/yaksh/error_messages.py index bf79ef8..2d27417 100644 --- a/yaksh/error_messages.py +++ b/yaksh/error_messages.py @@ -33,7 +33,7 @@ def prettify_exceptions(exception, message, traceback=None, def _get_incorrect_user_lines(exp_lines, user_lines): err_line_numbers = [] for line_no, (expected_line, user_line) in \ - enumerate(zip_longest(exp_lines, user_lines)): + enumerate(zip_longest(exp_lines, user_lines)): if user_line != expected_line: err_line_numbers.append(line_no) return err_line_numbers diff --git a/yaksh/templatetags/custom_filters.py b/yaksh/templatetags/custom_filters.py index e51b8aa..92a1169 100644 --- a/yaksh/templatetags/custom_filters.py +++ b/yaksh/templatetags/custom_filters.py @@ -110,4 +110,6 @@ def course_grade(course, user): @register.filter(name='highlight_spaces') def highlight_spaces(text): - return text.replace(" ",'<span style="background-color:#ffb6db"> </span>') + return text.replace( + " ", '<span style="background-color:#ffb6db"> </span>' + ) diff --git a/yaksh/templatetags/test_custom_filters.py b/yaksh/templatetags/test_custom_filters.py index 9816dc8..9d7f246 100644 --- a/yaksh/templatetags/test_custom_filters.py +++ b/yaksh/templatetags/test_custom_filters.py @@ -58,6 +58,7 @@ def tearDownModule(): User.objects.get(username="teacher2000").delete() Group.objects.all().delete() + class CustomFiltersTestCases(unittest.TestCase): @classmethod @@ -154,4 +155,5 @@ class CustomFiltersTestCases(unittest.TestCase): expected_output = "A " highlighted_output = highlight_spaces(expected_output) self.assertEqual(highlighted_output, - 'A<span style="background-color:#ffb6db"> </span>') + 'A<span style="background-color:#ffb6db"> </span>' + ) diff --git a/yaksh/views.py b/yaksh/views.py index 440236c..56f1873 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -98,13 +98,14 @@ def get_html_text(md_text): """Takes markdown text and converts it to html""" return Markdown().convert(md_text) + def formfield_callback(field): - if (isinstance(field, models.TextField) - and field.name == 'expected_output' - or field.name == 'expected_input'): + if (isinstance(field, models.TextField) and field.name == 'expected_output' + or field.name == 'expected_input'): return fields.CharField(strip=False) return field.formfield() + @email_verified def index(request, next_url=None): """The start page. @@ -255,7 +256,7 @@ def add_question(request, question_id=None): formset = inlineformset_factory( Question, testcase, extra=0, fields='__all__', - formfield_callback = formfield_callback + formfield_callback=formfield_callback ) formsets.append(formset( request.POST, request.FILES, instance=question @@ -941,10 +942,9 @@ def complete(request, reason=None, attempt_num=None, questionpaper_id=None, """Show a page to inform user that the quiz has been completed.""" user = request.user if questionpaper_id is None: - message = ( - reason or "An Unexpected Error occurred." - " Please contact your instructor/administrator." - ) + message = reason or ("An Unexpected Error occurred. Please " + "contact your instructor/administrator." + ) context = {'message': message} return my_render_to_response(request, 'yaksh/complete.html', context) else: |