summaryrefslogtreecommitdiff
path: root/kpov_judge/instructions_extractor.py
blob: 5574389dd9b7b7c6156ce9a0a9f28c38b52fba28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python

import glob
import os.path
from bson.son import SON
import sys


if __name__ == '__main__':
    l = glob.glob(sys.argv[1])
    l.sort()
    for week in l:
        print "---------------"
        for part in ['preparation', 'evaluation']:
            try:
                print week.split('/')[2], '-' , part, ':'
                with open(os.path.join(week, part, 'task.py')) as f:
                    task_code = compile(f.read(), 'task.py', 'exec')
                    exec(task_code)
                print instructions['si'].encode('utf-8')
            except Exception, e:
                print e
                pass