File size: 954 Bytes
0e239c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Display a task, repositories or its evaluation specification."""
import argparse
import json
from common import ROOT, load_task
from statement_text import read_problem_statement


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--instance-id", required=True)
    parser.add_argument("--view", choices=["task", "statement", "repos", "contract"], default="task")
    args = parser.parse_args()
    task = load_task(args.instance_id)
    directory = ROOT / "instances" / task["instance_id"]
    if args.view == "statement":
        print(read_problem_statement(task), end="")
    elif args.view == "repos":
        print(json.dumps(task["repositories"], indent=2, ensure_ascii=False))
    elif args.view == "contract":
        print((directory / task["evaluation"]["path"]).read_text(), end="")
    else:
        print(json.dumps(task, indent=2, ensure_ascii=False))


if __name__ == "__main__":
    main()