openenvforge's picture
3amBench v0.2.0
44084af verified
Raw History Blame Contribute Delete
892 Bytes
#!/usr/bin/env python3
"""Entry point: the grader package lives next to this file (python3 -I drops the script dir)."""
import argparse
import json
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from afgrader.xgrade import ExpertGrader # noqa: E402
def main():
ap = argparse.ArgumentParser()
for k in ("--workspace", "--spec", "--hidden", "--out"):
ap.add_argument(k, required=True)
ap.add_argument("--details")
a = ap.parse_args()
with open(a.spec) as fh:
spec = json.load(fh)
keys, details = ExpertGrader(spec, a.hidden).grade(a.workspace)
with open(a.out, "w") as fh:
json.dump(keys, fh)
if a.details:
with open(a.details, "w") as fh:
json.dump(details, fh, indent=1, default=str)
print(json.dumps(keys))
return 0
if __name__ == "__main__":
sys.exit(main())