Exemplo n.º 1
0
Arquivo: sh.py Projeto: erinui/espy
def cmd_execute(args):
    src = get_source(args)

    rt = es.Runtime()
    glob = new_global_object(rt)
    rt.set_global_object(glob)

    if not args.profile:
        es.execute(rt, src)
    else:
        import cProfile as profile
        profile.runctx("es.execute(rt, src)", globals(), locals())
Exemplo n.º 2
0
Arquivo: sh.py Projeto: erinui/espy
def cmd_test(args):
    for test in tests.strip().split("\n"):
        if test[0] == "#":
            continue

        print(test)
        with open("jit-test\\tests\\" + test) as f:
            src = f.read()
        rt = es.Runtime()
        rt.set_global_object(new_global_object(rt))

        t = time.time()
        es.execute(rt, src)
        print("  (Elapsed time: {:5.3f} sec)".format(time.time() - t))