#!/usr/bin/env python3 # -*- coding: utf-8 -*- # program/match-regex # Standardized types do not require authors to specify any control script as # it can be generated on import. However when provided it will overwrite the # default behaivior. import sys import subprocess import re def grade(ctx): """A function that governs the grading process when different from default. Expected is return value that indicates if the task passed or failed.""" print(ctx.data['data']['regex'], file=sys.stderr) print(ctx.data['solution'], file=sys.stderr) if re.match(ctx.data['data']['regex'], ctx.data['solution') != None: return 'PASS' else: return 'FAIL' def response(ctx): grade = ctx.grade_result msg = "" return {'output': output, 'grade': grade, 'msg': msg, 'data': None}