-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathshow.py
executable file
·44 lines (38 loc) · 1.11 KB
/
show.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
import argparse
import sys
import glob
from dataparser import parse, nl, ni
from util import path, get_in_file_content
try: import matplotlib.pyplot as plt
except: pass
# ns is the namespace.
# If needed write a simple parser which returns ns.
def test(tc_name, inp):
print(tc_name)
print(inp)
print('==============')
ns = parse(inp)
# TODO: display inp in readable form!
def get_tasks():
parser = argparse.ArgumentParser()
parser.add_argument('testcase', nargs='?', default=None)
parser.add_argument('-a', '--all', action='store_true')
args = parser.parse_args()
if not (args.testcase or args.all):
print('provide either all: -a or a testcase.')
exit()
tasks = []
if args.all:
for f in sorted(glob.glob('in/*.in')):
tc_name = path(f).name
tasks.append(tc_name)
else:
tc_name = path(args.testcase).name
tasks.append(tc_name)
return tasks
if __name__=='__main__':
tasks = get_tasks()
for tc_name in tasks:
inp = get_in_file_content(tc_name)
test(tc_name, inp)