Exemplo n.º 1
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
Exemplo n.º 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
Exemplo n.º 3
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))
Exemplo n.º 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))