From 4e7b80974d7433f96fa1908293e5faee9d8de519 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 2 Oct 2015 16:14:24 +0200 Subject: Removed unnecessary HintSequences. --- python/common.py | 2 +- python/en.py | 46 ++++++++++++++++++++- python/problems/functions/greatest/common.py | 2 +- .../functions/greatest_absolutist/common.py | 2 +- .../problems/functions/greatest_negative/common.py | 2 +- python/problems/introduction/average/common.py | 2 +- python/problems/introduction/ballistics/common.py | 2 +- .../introduction/fahrenheit_to_celsius/common.py | 2 +- .../problems/introduction/fast_fingers/common.py | 2 +- .../problems/introduction/fast_fingers_2/common.py | 2 +- .../introduction/pythagorean_theorem/common.py | 6 +-- .../problems/lists_and_for/contains_42/common.py | 3 +- .../lists_and_for/contains_string/common.py | 3 +- python/problems/while_and_if/buy_five/common.py | 2 +- .../while_and_if/checking_account/common.py | 2 +- python/problems/while_and_if/competition/common.py | 9 +++- .../while_and_if/consumers_anonymous/common.py | 9 ++-- .../while_and_if/consumers_anonymous/en.py | 48 ++++++++++++++++++++-- .../while_and_if/consumers_anonymous/sl.py | 1 - python/problems/while_and_if/minimax/common.py | 2 +- python/problems/while_and_if/top_shop/common.py | 2 +- 21 files changed, 119 insertions(+), 32 deletions(-) diff --git a/python/common.py b/python/common.py index e4de997..26f3881 100644 --- a/python/common.py +++ b/python/common.py @@ -1,7 +1,7 @@ # coding=utf-8 import ast -from server.hints import Hint, HintSequence +from server.hints import Hint hint_type = { 'no_hint': Hint('no_hint'), diff --git a/python/en.py b/python/en.py index 77157f1..33453a9 100644 --- a/python/en.py +++ b/python/en.py @@ -3,6 +3,27 @@ name = 'Python' description = 'Introductory Python course.' + +general_msg = { + 'error_head' : '''\ +''', + + 'general_exception': '''\ +''', + + 'name_error' : '''\ +''', + + 'type_error': '''\ +''', + + 'eof_error':'''\ +''', + + 'timed_out':'''\ +''' +} + hint = { 'no_hint': '''\

No hint available, sorry!

@@ -18,4 +39,27 @@ hint = { [%=message%] ''', -} + + 'system_error': ['''\ +'''], + + 'problematic_test_case': ['''\ +'''], + + 'no_func_name': ['''\ +'''], + + 'name_error' : [general_msg['error_head'], + general_msg['general_exception'], + general_msg['name_error']], + + 'type_error' : [general_msg['error_head'], + general_msg['general_exception'], + general_msg['type_error']], + + 'error' : [general_msg['error_head'], general_msg['general_exception']], + + 'eof_error' : [general_msg['eof_error']], + + 'timed_out' : [general_msg['timed_out']] +} \ No newline at end of file diff --git a/python/problems/functions/greatest/common.py b/python/problems/functions/greatest/common.py index 74fb15e..6857603 100644 --- a/python/problems/functions/greatest/common.py +++ b/python/problems/functions/greatest/common.py @@ -3,7 +3,7 @@ import re from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 195 group = 'functions' diff --git a/python/problems/functions/greatest_absolutist/common.py b/python/problems/functions/greatest_absolutist/common.py index 8174a63..2d80097 100644 --- a/python/problems/functions/greatest_absolutist/common.py +++ b/python/problems/functions/greatest_absolutist/common.py @@ -3,7 +3,7 @@ import re from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 196 group = 'functions' diff --git a/python/problems/functions/greatest_negative/common.py b/python/problems/functions/greatest_negative/common.py index 2425bbc..5d65438 100644 --- a/python/problems/functions/greatest_negative/common.py +++ b/python/problems/functions/greatest_negative/common.py @@ -3,7 +3,7 @@ import re from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 197 group = 'functions' diff --git a/python/problems/introduction/average/common.py b/python/problems/introduction/average/common.py index c84ef72..1609a6f 100644 --- a/python/problems/introduction/average/common.py +++ b/python/problems/introduction/average/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 189 diff --git a/python/problems/introduction/ballistics/common.py b/python/problems/introduction/ballistics/common.py index 10ef692..eaf230d 100644 --- a/python/problems/introduction/ballistics/common.py +++ b/python/problems/introduction/ballistics/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 187 group = 'introduction' diff --git a/python/problems/introduction/fahrenheit_to_celsius/common.py b/python/problems/introduction/fahrenheit_to_celsius/common.py index 485d59d..df426d3 100644 --- a/python/problems/introduction/fahrenheit_to_celsius/common.py +++ b/python/problems/introduction/fahrenheit_to_celsius/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 180 group = 'introduction' diff --git a/python/problems/introduction/fast_fingers/common.py b/python/problems/introduction/fast_fingers/common.py index cda6486..dc04dcf 100644 --- a/python/problems/introduction/fast_fingers/common.py +++ b/python/problems/introduction/fast_fingers/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 190 group = 'introduction' diff --git a/python/problems/introduction/fast_fingers_2/common.py b/python/problems/introduction/fast_fingers_2/common.py index 386e251..6261d92 100644 --- a/python/problems/introduction/fast_fingers_2/common.py +++ b/python/problems/introduction/fast_fingers_2/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 191 group = 'introduction' diff --git a/python/problems/introduction/pythagorean_theorem/common.py b/python/problems/introduction/pythagorean_theorem/common.py index 193527e..d11dae0 100644 --- a/python/problems/introduction/pythagorean_theorem/common.py +++ b/python/problems/introduction/pythagorean_theorem/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 188 group = 'introduction' @@ -19,8 +19,8 @@ print("Hipotenuza trikotnika s stranicama", a, "in", b, "je", c) hint_type = { 'plan': Hint('plan'), - 'name_error': HintSequence('name_error', 4), - 'unsupported_operand': HintSequence('unsupported_operand', 4), + 'name_error': Hint('name_error'), + 'unsupported_operand': Hint('unsupported_operand'), 'no_input_call' : Hint('no_input_call'), 'printing': Hint('printing'), 'math_functions': Hint('math_functions') diff --git a/python/problems/lists_and_for/contains_42/common.py b/python/problems/lists_and_for/contains_42/common.py index 915938e..f91465f 100644 --- a/python/problems/lists_and_for/contains_42/common.py +++ b/python/problems/lists_and_for/contains_42/common.py @@ -3,7 +3,7 @@ import re from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 193 group = 'lists_and_for' @@ -21,7 +21,6 @@ print(vsebuje) ''' hint_type = { - 'plan': HintSequence('plan', 1), 'no_xs': Hint('no_xs'), 'for_loop': Hint('for_loop'), 'if_clause': Hint('if_clause'), diff --git a/python/problems/lists_and_for/contains_string/common.py b/python/problems/lists_and_for/contains_string/common.py index 0fe7c00..29bc9f2 100644 --- a/python/problems/lists_and_for/contains_string/common.py +++ b/python/problems/lists_and_for/contains_string/common.py @@ -3,7 +3,7 @@ import re from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 194 group = 'lists_and_for' @@ -21,7 +21,6 @@ print(vsebuje) ''' hint_type = { - 'plan': HintSequence('plan', 1), 'no_xs': Hint('no_xs'), 'for_loop': Hint('for_loop'), 'if_clause': Hint('if_clause'), diff --git a/python/problems/while_and_if/buy_five/common.py b/python/problems/while_and_if/buy_five/common.py index 9f335af..ba44f5b 100644 --- a/python/problems/while_and_if/buy_five/common.py +++ b/python/problems/while_and_if/buy_five/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 185 group = 'while_and_if' diff --git a/python/problems/while_and_if/checking_account/common.py b/python/problems/while_and_if/checking_account/common.py index 610bbfc..ee1e3ee 100644 --- a/python/problems/while_and_if/checking_account/common.py +++ b/python/problems/while_and_if/checking_account/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 200 group = 'while_and_if' diff --git a/python/problems/while_and_if/competition/common.py b/python/problems/while_and_if/competition/common.py index a7471df..fff96ed 100644 --- a/python/problems/while_and_if/competition/common.py +++ b/python/problems/while_and_if/competition/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 192 group = 'while_and_if' @@ -19,9 +19,14 @@ print('Vsota:', vsota) ''' hint_type = { - 'plan': HintSequence('plan', 1), + 'read_before_while': Hint('read_before_while'), + 'while_clause': Hint('while_clause'), + 'printing': Hint('printing'), + 'summation': Hint('summation'), + 'nonumber': Hint('nonumber'), } + def test(python, code): # List of inputs: (expression to eval, stdin). test_in = [ diff --git a/python/problems/while_and_if/consumers_anonymous/common.py b/python/problems/while_and_if/consumers_anonymous/common.py index d1428d8..ff3f928 100644 --- a/python/problems/while_and_if/consumers_anonymous/common.py +++ b/python/problems/while_and_if/consumers_anonymous/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 201 group = 'while_and_if' @@ -30,8 +30,9 @@ hint_type = { 'nonumber': Hint('nonumber'), 'while_condition': Hint('while_condition'), 'final_hint': Hint('final_hint'), - 'summation': Hint('final_hint'), - 'counting': Hint('final_hint'), + 'summation': Hint('summation'), + 'counting': Hint('counting'), + 'problematic_test_case': Hint('problematic_test_case'), } def test(python, code): @@ -69,7 +70,7 @@ def test(python, code): tout = correct passed = n_correct == len(test_in) - hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_in)}}] + hints = [{'id': 'test_results', 'args': {'passed': str(n_correct), 'total': str(len(test_in))}}] if tin: hints.append({'id': 'problematic_test_case', 'args': {'testin': str(tin), 'sum': str(tout[0]), diff --git a/python/problems/while_and_if/consumers_anonymous/en.py b/python/problems/while_and_if/consumers_anonymous/en.py index 94ea662..6331570 100644 --- a/python/problems/while_and_if/consumers_anonymous/en.py +++ b/python/problems/while_and_if/consumers_anonymous/en.py @@ -1,4 +1,6 @@ # coding=utf-8 +import server +mod = server.problems.load_language('python', 'sl') id = 201 name = 'Consumers Anonymous' @@ -7,10 +9,48 @@ slug = 'Consumers Anonymous' description = '''\

(translation missing)

''' + +main_plan = ['''\ +'''] + +while_condition = ['''\ +'''] + +while_clause = ['''\ +''' +] + +plan = [main_plan, + while_condition] + hint = { - 'plan': '''\ -

(translation missing)

''', + 'while_clause': while_clause, + + 'while_condition': while_condition, + + 'printing': ['''\ +'''], - 'no_input_call': '''\ -

(translation missing)

''', + 'nonumber': ['''

'''], + + 'summation': ['''

'''], + + 'counting': ['''

'''], + + 'name_error' : [mod.general_msg['error_head'], + mod.general_msg['general_exception'], + mod.general_msg['name_error'], + '''\ +'''], + + 'problematic_test_case': ['''\ +'''], + + 'final_hint': ['''\ +'''], + + 'eof_error':[mod.general_msg['eof_error'], + '''\ +'''] } + diff --git a/python/problems/while_and_if/consumers_anonymous/sl.py b/python/problems/while_and_if/consumers_anonymous/sl.py index 4b1348b..ee2700c 100644 --- a/python/problems/while_and_if/consumers_anonymous/sl.py +++ b/python/problems/while_and_if/consumers_anonymous/sl.py @@ -63,7 +63,6 @@ cena != 0 and vsota < 100 and artiklov < 10 '''] - plan = [main_plan, while_condition] diff --git a/python/problems/while_and_if/minimax/common.py b/python/problems/while_and_if/minimax/common.py index 6155024..71632b7 100644 --- a/python/problems/while_and_if/minimax/common.py +++ b/python/problems/while_and_if/minimax/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 199 group = 'while_and_if' diff --git a/python/problems/while_and_if/top_shop/common.py b/python/problems/while_and_if/top_shop/common.py index db98212..115dc9e 100644 --- a/python/problems/while_and_if/top_shop/common.py +++ b/python/problems/while_and_if/top_shop/common.py @@ -2,7 +2,7 @@ from python.util import has_token_sequence, string_almost_equal, \ string_contains_number, get_tokens, get_numbers, get_exception_desc -from server.hints import Hint, HintSequence +from server.hints import Hint id = 198 group = 'while_and_if' -- cgit v1.2.1