summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkpov_judge/test_task.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/kpov_judge/test_task.py b/kpov_judge/test_task.py
index 206e809..a3eace5 100755
--- a/kpov_judge/test_task.py
+++ b/kpov_judge/test_task.py
@@ -75,14 +75,11 @@ def http_auth(url, username, password):
urllib.request.install_opener(opener)
def load_task(stream):
- # the stream should compile into at least the function
- # task(...) and a dictionary "params_meta".
+ # the stream should definitions for the functions task(…),
+ # task_check and gen_params, and a dictionary params_meta
source = stream.read()
- t = compile(source, 'task.py', 'exec')
d = {}
- exec(t, d)
- # get a list of arguments for task(...)
- # args_list = inspect.getargs(task.func_code)[0]
+ exec(compile(source, 'task.py', 'exec'), d)
return d['task'], d['task_check'], d['params_meta'], d['gen_params']
def locate_task(params, argparser, quiet=False):
@@ -118,12 +115,9 @@ def locate_task(params, argparser, quiet=False):
def load_params(filename):
try:
with open(filename) as f:
- saved_params = yaml.load(f)
+ return yaml.load(f)
except:
- saved_params = dict()
- if saved_params is None:
- saved_params = dict()
- return saved_params
+ return {}
if __name__ == '__main__':
# get the parameters needed to get to the task, such as the URLs, the name of the task and optionally an ID from the student