Exemplo n.º 1
0
def upload_file():
    if request.method == 'POST':
        f = request.files['file']
        f.save(secure_filename(f.filename))
        #try:
        print(f.filename)
        return main.main_run(f.filename)
        #except:
        print('error')
        return 'file uploaded successfully'
Exemplo n.º 2
0
def interpret_tacit():
    with open("tmp/tacit", "wb") as tacit_output_file:
        test_environment = base_environment().extend(
            {"cout": MachineStream(tacit_output_file)})
        main_run("tacit/main.tacit", test_environment)
GA = structure()
GA.bestsol = None
GA.avgsol = None
GA.bestvalue = structure()
niter = 10
generation = 100
GA1 = GA.repeat(niter)
GA2 = GA.repeat(niter)
GA3 = GA.repeat(niter)

for i in range(niter):
    print('iteration {}'.format(i + 1))
    GA1[i].bestsol, GA2[i].bestsol, GA3[i].bestsol, GA1[i].avgsol, GA2[
        i].avgsol, GA3[i].avgsol, GA1[i].bestvalue, GA2[i].bestvalue, GA3[
            i].bestvalue = main_run(generation)

plottable(GA1, niter, 1)
plottable(GA2, niter, 2)
plottable(GA3, niter, 3)

mean1_max = []
mean1_avg = []
stddev1_max = []
stddev1_avg = []

mean2_max = []
mean2_avg = []
stddev2_max = []
stddev2_avg = []
Exemplo n.º 4
0
def test_my_func(monkeypatch):
    override_config(monkeypatch, ['ItemB'])
    my_list = main_run()
    print(my_list)
    assert 'ItemB' in my_list
    assert len(my_list) == 1