34 lines
758 B
Python
34 lines
758 B
Python
|
#!/usr/bin/env python3
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import sys
|
||
|
import json
|
||
|
|
||
|
print("Handler program/match-regex-parallel loaded!")
|
||
|
|
||
|
|
||
|
# helper
|
||
|
|
||
|
|
||
|
class ExerciseHandler(object):
|
||
|
def __init__(self, parser=None):
|
||
|
self.parser = parser
|
||
|
self.data = {'code': ''}
|
||
|
print("ExerciseHandler program/match-regex")
|
||
|
print("parser.path", parser.path)
|
||
|
|
||
|
|
||
|
item = self.parser.item
|
||
|
data = self.data
|
||
|
|
||
|
# enable grading for this exercise type
|
||
|
item.grading = True
|
||
|
|
||
|
item.content = self.parser.get_exercise_content()
|
||
|
data['code'] = self.parser.get_file_content('program.c')
|
||
|
data['regex'] = self.parser.get_file_content('regex').strip()
|
||
|
|
||
|
|
||
|
item.data = json.dumps(self.data)
|
||
|
item.save()
|