Пример #1
0
Файл: sh.py Проект: 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())
Пример #2
0
Файл: sh.py Проект: 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))