Example #1
0
#! /usr/bin/env python
from traceback import print_exc
from lib.invgame_server.mturk_util import error, connect, mkParser

p = mkParser("Expire a HIT")
p.add_argument('HITId', type=str, help='ID Of the HIT To expire.')
args = p.parse_args()

try:
    mc = connect(args.credentials_file, args.sandbox)
    r = mc.expire_hit(args.HITId)
except Exception as e:
    print_exc()
    error("Failed...")
Example #2
0
        lines = list(output.split("\\n"))
    start = 0
    desugaredF = {}
    r = re.compile("implementation (?P<name>[^(]*)\(", re.MULTILINE)
    while True:
        try:
            code = "\n".join(lines[lines.index(
                "after desugaring sugared commands like procedure calls", start
            ) + 1:lines.index("after conversion into a DAG", start)])
            name = r.findall(code)[0]
            desugaredF[name] = code
            start = lines.index("after conversion into a DAG", start) + 1
        except ValueError:
            break

    return desugaredF


if (__name__ == "__main__"):
    args = p.parse_args()

    print("Desugaring ", args.inp_file, " to ", args.out_file)
    res = desugar(args.inp_file)

    if (len(res) > 1):
        error("More than one function: " + ",".join(list(res.keys())))

    f = open(args.out_file, "w")
    f.write(list(res.values())[0])
    f.close()