示例#1
0
文件: search.py 项目: daftmath/phd
def get_sample(start_txt, seed):
    with open("start.txt", "w") as outfile:
        outfile.write(start_txt)

    try:
        s = sample(seed)
        result = preprocess.preprocess(s)
        if result:
            return result
    except Exception as e:
        pass
示例#2
0
def get_sample(start_txt, seed):
    with open("start.txt", "w") as outfile:
        outfile.write(start_txt)

    try:
        s = sample(seed)
        result = preprocess.preprocess(s)
        if result:
            return result
    except Exception as e:
        pass
示例#3
0
文件: search.py 项目: daftmath/phd
def generate_test_code(start_seed=0):
    seed = start_seed - 1
    found_sample = False

    while True:
        seed += 1
        print("Sampling seed {} ... ".format(seed), end="")
        code = sample(seed)
        result = None
        try:
            result = preprocess.preprocess(code)
        except Exception:
            print("bad")
            print(indent(code[:300]))
        if result and len(code) > 100:
            path = os.path.join("search", str(seed) + ".txt")
            write_file(path, result)
            print(path)
            print(indent(result))
示例#4
0
def generate_test_code(start_seed=0):
    seed = start_seed - 1
    found_sample = False

    while True:
        seed += 1
        print("Sampling seed {} ... ".format(seed), end="")
        code = sample(seed)
        result = None
        try:
            result = preprocess.preprocess(code)
        except Exception:
            print("bad")
            print(indent(code[:300]))
        if result and len(code) > 100:
            path = os.path.join("search", str(seed) + ".txt")
            write_file(path, result)
            print(path)
            print(indent(result))