コード例 #1
0
ファイル: reinicio.py プロジェクト: anapaulabarros/flyingbee
def reinicio():
    zera_pontos = ''
    pos2 = list((pygame.mouse.get_pos()))
    click_mouse = pygame.mouse.get_pressed()
    screen.blit(back, (0, 0))
    screen.blit(reiniciar, (340, 185))
    screen.blit(voltar, (340, 279))

    #exibe a pontuacao da ultima partida
    pontuacao = open("pontos.txt", "r").read()
    font = pygame.font.Font("fonts/font2.ttf", 30)
    mensagem = font.render(pontuacao, True, (0, 0, 0))
    screen.blit(mensagem, [450, 110])

    if pos2[0] >= 281 and pos2[0] <= 437 and pos2[1] >= 187 and pos2[1] <= 269:
        if click_mouse[0] == 1:
            zera_pontos = open("pontos.txt",
                               "w").write(str(0))  #zera a ultima pontuação
            script.main()
            sys.exit()

    if pos2[0] >= 282 and pos2[0] <= 438 and pos2[1] >= 282 and pos2[1] <= 368:
        if click_mouse[0] == 1:
            menu.main()
            sys.exit()

    pygame.display.flip()
コード例 #2
0
ファイル: saxo.py プロジェクト: Web5design/saxo
def script(argv):
    # Save PEP 3122!
    if "." in __name__:
        from .script import main
    else:
        from script import main

    main(argv, version)
コード例 #3
0
    def do_script(self, message):        
        if message.get('script'):
            with open('script.py', 'w') as f:
                f.write(message.get('script'))
            import script
            script.main()

        return None, None
コード例 #4
0
ファイル: test.py プロジェクト: andrewdyates/all_bool_dist
def main():
  script.main(fname="D.expr.gold.CLS.apr.19.tab")
  D = mio.load("D.expr.gold.CLS.apr.19.tab")
  CLS = all_pairs_bool_dist(D['M'])
  CHECK = mio.load("gold.R.dists.tab")['M']
  print CLS
  print CHECK
  assert np.all(CLS == CHECK)
コード例 #5
0
def main():
    done = False
    pos2 = []  #posicao do mouse
    pygame.init()
    clock = pygame.time.Clock()

    screen = pygame.display.set_mode(wind_size)
    pygame.display.set_caption('Flying Bee')
    screen.blit(back, (0, 0))
    screen.blit(btn_iniciar, (330, 140))
    screen.blit(btn_ajuda, (325, 185))
    screen.blit(btn_sobre, (320, 232))
    screen.blit(btn_sair, (320, 275))

    while not done:
        pos2 = list((pygame.mouse.get_pos()))
        click_mouse = pygame.mouse.get_pressed()
        #print pygame.mouse.get_pos()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                done = True

        screen.blit(back, (0, 0))
        screen.blit(btn_iniciar, (330, 140))
        screen.blit(btn_ajuda, (325, 185))
        screen.blit(btn_sobre, (320, 232))
        screen.blit(btn_sair, (320, 275))

        if pos2[0] >= 365 and pos2[0] <= 483 and pos2[1] >= 146 and pos2[
                1] <= 171:
            if click_mouse[0] == 1:
                script.main()
                sys.exit()
            screen.blit(btn_iniciar_h, (330, 140))

        if pos2[0] >= 372 and pos2[0] <= 475 and pos2[1] >= 195 and pos2[
                1] <= 216:
            screen.blit(btn_ajuda_h, (325, 185))
            if click_mouse[0] == 1:
                tela.ajuda()

        if pos2[0] >= 373 and pos2[0] <= 472 and pos2[1] >= 240 and pos2[
                1] <= 273:
            screen.blit(btn_sobre_h, (320, 232))
            if click_mouse[0] == 1:
                tela.sobre()

        if pos2[0] >= 387 and pos2[0] <= 451 and pos2[1] >= 286 and pos2[
                1] <= 308:
            if click_mouse[0] == 1:
                done = True  #sai do jogo
            screen.blit(btn_sair_h, (320, 275))

        pygame.display.flip()
        clock.tick(60)
        pygame.display.update()

    pygame.quit()
コード例 #6
0
    def do_script(self, message):
        if message.get('script'):
            with open('script.py', 'w') as f:
                f.write(message.get('script'))
            # noinspection PyUnresolvedReferences
            import script
            script.main()

        return None, None
コード例 #7
0
    def runScript(self):
        print("Running script")
        print("Imported files: ")
        for file in root.files:
            print(file)

        print("Destination Directory" + root.directory)

        script.main(root.files, root.directory)
	
        print("Script Complete")
コード例 #8
0
ファイル: test.py プロジェクト: pafi1/stream
 def test_all(self):
     sys.argv = [
         "",
         "--url",
         "http://kinox.to/Stream/The_Big_Bang_Theory.html",
         "--episode",
         "8",
         "2",
         "--count",
         "2",
     ]
     script.main()
コード例 #9
0
ファイル: scrapper.py プロジェクト: MichaelKatsoulis/scrader
def convert_to_df(url_list, image_list, title_list, date_list, companies_list,
                  website_url_list, websites_list):

    data = pd.DataFrame({"Article": url_list, "Title": title_list,
                         "Image": image_list, "Date": date_list,
                         "Company": companies_list, "Website": websites_list,
                         "Website url": website_url_list})
    print(len(data))
    abs_filename = "./Scraderlatestnews.csv"
    try:
        os.remove(abs_filename)
    except OSError:
        pass
    data.to_csv(abs_filename, encoding='utf-8')
    script.main()
    algorithm.run_algorithm(abs_filename)
コード例 #10
0
async def lol_patch(ctx, version):
    # image = discord.File(main(version))
    # await ctx.send(file=image)
    e = discord.Embed(title=f'Notas de la version {version}',
                      color=discord.Color.blue())
    img = main(version)
    e.set_image(url=img)
    await ctx.send(embed=e)
コード例 #11
0
    def main(self, *args, **kwargs):
        from script import main

        _kwargs = {
            "out": self.out,
            "err": self.err,
        }
        _kwargs.update(kwargs)
        return main(*args, **_kwargs)
コード例 #12
0
ファイル: tests.py プロジェクト: chrisrammy/python-script
    def main(self, *args, **kwargs):
        from script import main

        _kwargs = {
            "out": self.out,
            "err": self.err,
        }
        _kwargs.update(kwargs)
        return main(*args, **_kwargs)
コード例 #13
0
ファイル: tests.py プロジェクト: pat-laugh/notes-to-text
def run_tests():
	set_debug(True)
	ELLIPSIS = '…'.encode('utf-8')

	f_names = [
		'Plan for next-2',
		'iOS-10-test-1',
		'iOS-10-test-2',
		'iOS-14-test-1',
		'iOS-14-test-2',
	]
	contents = [
		b'Plan for next\n\nDo that, and...\n\nWork on this.',
		b'iOS-10-test-1\n\nNeed to get rid of items!\n\nit could be...',
		b'iOS-10-test-2\nline',
		b'iOS-14-test-1\n\nyou don\'t want to work in that context.',
		b'iOS-14-test-2\n\nMessage on board:\n\nI haven\'t used all' + ELLIPSIS,
	]

	test_content(1, f_names[0], 15, 60, contents[0])
	test_content(2, f_names[1], 15, 71, contents[1])
	test_content(3, f_names[2], 10, 28, contents[2])
	test_content(4, f_names[3], 15, 71, contents[3])
	test_content(5, f_names[4], 15, 72, contents[4])

	DIR_OUT = 'test-out'
	try:
		os.mkdir(DIR_OUT)
	except FileExistsError:
		pass
	main('test-data', DIR_OUT)

	test_file_out(6, os.path.join(DIR_OUT, f_names[0]), contents[0])
	test_file_out(7, os.path.join(DIR_OUT, f_names[1]), contents[1])
	test_file_out(8, os.path.join(DIR_OUT, f_names[2]), contents[2])
	test_file_out(9, os.path.join(DIR_OUT, f_names[3]), contents[3])
	test_file_out(10, os.path.join(DIR_OUT, f_names[4]), contents[4])
コード例 #14
0
ファイル: test.py プロジェクト: andrewdyates/all_pairs_dcor
def main():
  DCOR = script.main(fname=FNAME)
  COR = compute_all_ppc_numpy(M)
  SCI = compute_all_pcc_scipy(M)
  print np.all(np.abs(COR-SCI) < 0.0000000000001)
  DCOR = compute_all_dcor(M)
  DCORL = loop_dcor(M)
  print np.all(np.abs(DCOR-DCORL) < 0.0000000000001)
  DCOR2 = compute_all_dcor_2(M)
  print np.all(np.abs(DCOR-DCOR2) < 0.0000000000001)
  DCOR3 = compute_all_dcor_3(M)
  print np.all(np.abs(DCOR-DCOR3) < 0.0000000000001)
  print np.all(np.abs(DCOR-DCOR3) < 0.1)

  KUN = mio.load("kungold.tab")['M']
  print KUN
  print "kun", np.all(np.abs(DCOR-KUN) < 0.001)
  print "kun", np.all(np.abs(DCORL-KUN) < 0.001)
  
  print DCOR[5,3], DCOR[3,5]
  print DCOR3[5,3], DCOR3[3,5]
コード例 #15
0
def main():
    DCOR = script.main(fname=FNAME)
    COR = compute_all_ppc_numpy(M)
    SCI = compute_all_pcc_scipy(M)
    print np.all(np.abs(COR - SCI) < 0.0000000000001)
    DCOR = compute_all_dcor(M)
    DCORL = loop_dcor(M)
    print np.all(np.abs(DCOR - DCORL) < 0.0000000000001)
    DCOR2 = compute_all_dcor_2(M)
    print np.all(np.abs(DCOR - DCOR2) < 0.0000000000001)
    DCOR3 = compute_all_dcor_3(M)
    print np.all(np.abs(DCOR - DCOR3) < 0.0000000000001)
    print np.all(np.abs(DCOR - DCOR3) < 0.1)

    KUN = mio.load("kungold.tab")['M']
    print KUN
    print "kun", np.all(np.abs(DCOR - KUN) < 0.001)
    print "kun", np.all(np.abs(DCORL - KUN) < 0.001)

    print DCOR[5, 3], DCOR[3, 5]
    print DCOR3[5, 3], DCOR3[3, 5]
コード例 #16
0
                image_name, folder_name = line.strip().split(
                    ',')[0].strip(), line.strip().split(',')[1].strip()
                file.write(image_name)

                folder_name = folder_name[len(
                    'https://github.com/ppc64le/build-scripts/tree/master/a/'
                ):]
                #print(folder_name)
                file.write("," + folder_name + "\n")

        with open('input.txt') as file:
            lines = file.readlines()

        with open('UpdatedImageList.csv', 'w') as file:
            for line in lines:
                ret = script.main(line, usernameStrGithub, passwordStrGithub)
                image_name, folder_name = line.strip().split(',')

                try:
                    print(" Uploading README file.. ")
                    push_file(image_name)
                    print(" README file uploaded..")
                except Exception as e:
                    print(e)
                    print("error")
                    file.write(image_name + "," + "authentication error\n")
                    continue

                if ret == 'docker':
                    file.write(image_name + "," + "docker error\n")
                elif ret == 'github':
コード例 #17
0
 def _script_b_fired(self):
     return script.main()
コード例 #18
0
ファイル: main.py プロジェクト: Hara-Yuma/vos
#!/usr/bin/env python3
import script
script.main()
コード例 #19
0
ファイル: demo.py プロジェクト: simvisage/spirrid
 def _script_b_fired(self):
     return script.main()
コード例 #20
0
def hello_world():
    return script.main()
コード例 #21
0
ファイル: expr.py プロジェクト: raven4752/QIQC
def expr_func(random_seed, epochs, fine_tuning_epochs, batch_size, dropout,
              learning_rate, learning_rate_max_offset, threshold,
              max_vocab_size, max_seq_len, embed_size, n_folds, share,
              n_repeat, debug):
    set_seed(random_seed)
    print('seed: {}'.format(random_seed))
    # TODO try 5*2 fold
    print_every_step = 500
    train_df, _ = load_data(debug=debug)
    train_df, test_df = train_test_split(train_df, test_size=356000)
    targets_te = test_df['target']
    scores_te = []
    scores_va = []
    for n in range(n_repeat):
        if n_folds > 1:
            predictions_te_h, predictions_te, scores, thresholds, coeffs = cv(
                train_df,
                test_df,
                n_folds=n_folds,
                epochs=epochs,
                batch_size=batch_size,
                learning_rate=learning_rate,
                threshold=threshold,
                max_vocab_size=max_vocab_size,
                embed_size=embed_size,
                print_every_step=print_every_step,
                share=share,
                dropout=dropout,
                learning_rate_max_offset=learning_rate_max_offset,
                fine_tuning_epochs=fine_tuning_epochs,
                max_seq_len=max_seq_len)
            print(coeffs)
            threshold_e = np.array(thresholds).mean()
            best_score = -1
            for t in np.arange(0, 1, 0.01):
                score = f1_score(targets_te, predictions_te > t)
                if score > best_score:
                    best_score = score
                    best_threshold = t
                    print('best threshold on test set: {:.2f} score {:.4f}'.
                          format(best_threshold, best_score))
            print('estimated {:.4f} 1 of hard {:.4f} 0.31 hard {:.4f}'.format(
                f1_score(targets_te, predictions_te > threshold_e),
                f1_score(targets_te, predictions_te_h > 1),
                f1_score(targets_te, predictions_te > 0.31)))

            scores_te.append([
                f1_score(targets_te, predictions_te > threshold_e),
                roc_auc_score(targets_te, predictions_te),
                precision_score(targets_te, predictions_te > threshold_e),
                recall_score(targets_te, predictions_te > threshold_e)
            ])
            scores_va.extend(scores)
        else:
            train_df, valid_df = train_test_split(train_df, test_size=0.02)
            train_df = train_df.reset_index(drop=True)
            valid_df = valid_df.reset_index(drop=True)
            predictions_te, predictions_va, targets_va, best_threshold = main(
                train_df,
                valid_df,
                test_df,
                epochs=epochs,
                batch_size=batch_size,
                learning_rate=learning_rate,
                threshold=threshold,
                max_vocab_size=max_vocab_size,
                embed_size=embed_size,
                print_every_step=print_every_step,
                dropout=dropout,
                learning_rate_max_offset=learning_rate_max_offset,
                fine_tuning_epochs=fine_tuning_epochs,
                max_seq_len=max_seq_len)
            scores_va.append([
                f1_score(targets_va, predictions_va > threshold),
                roc_auc_score(targets_va, predictions_va),
                precision_score(targets_va, predictions_va > threshold),
                recall_score(targets_va, predictions_va > threshold)
            ])
            scores_te.append([
                f1_score(targets_te, predictions_te > best_threshold),
                roc_auc_score(targets_te, predictions_te),
                precision_score(targets_te, predictions_te > best_threshold),
                recall_score(targets_te, predictions_te > best_threshold)
            ])
    if len(scores_te) == 1:
        scores_te = scores_te[0]
    if len(scores_va) == 1:
        scores_va = scores_va[0]
    return {'scores_te': scores_te, 'scores_va': scores_va}
コード例 #22
0
ファイル: main_vk.py プロジェクト: Korinin38/siriusneuralocr
def exec_py():
    return (script.main())
コード例 #23
0
import wow.register
from script import main

main()
コード例 #24
0
import argument_parser
import my_utils
import script
import time

opt = argument_parser.parser()
my_utils.plant_seeds(randomized_seed=opt.randomize)

import trainer

trainer = trainer.Trainer(opt)
trainer.build_dataset_train()
trainer.build_dataset_test()
trainer.build_network()
trainer.build_optimizer()
trainer.build_losses()
trainer.start_train_time = time.time()

for epoch in range(opt.nepoch):
    trainer.train_epoch()
    trainer.test_epoch()
    trainer.dump_stats()
    trainer.save_network()
    trainer.increment_epoch()

trainer.save_new_experiments_results()
script.main(opt, trainer.network)  #Inference
opt.faust = "INTRA"
script.main(opt, trainer.network)  #Inference
コード例 #25
0
ファイル: rpg.py プロジェクト: pengyuwei/casktown2
                              [x + 1, y + Inc.FootH - 1], \
                              [x + Inc.FootW - 1, y + Inc.FootH - 1] \
                             ])
    if map.canMove(lstRpgXY):
        player1.moveDown()
        if player1.y - map.viewY > Inc.ScreenH / 2:
            map.moveView(0, -Inc.moveStepPix)
        map.raiseEventAuto(lstRpgXY, 0)
    else:
        player1.stop()
    return False


def Action(player1, map):
    player1.setDirection(Player.Up)
    x, y = player1.getNextPos()
    lstRpgXY = map.getRpgXy([ \
                              [x + 1, y + 1], \
                              [x + Inc.FootW, y + 2] \
                             ])
    map.raiseEventAuto(lstRpgXY, 0)


if __name__ == '__main__':
    try:
        import script
        script.main()
    except:
        import traceback
        traceback.print_exc(file=file('trace.txt', 'w'))
コード例 #26
0
ファイル: runner.py プロジェクト: hltbra/psp_samples
import sys
import os

if len(sys.argv) < 2:
    print 'There was no app specified'
    exit()

app_name = sys.argv[1]

sys.path.append('psplibs-pygame_mockup')
sys.path.append(app_name)

from script import main
main()
コード例 #27
0
T1 = 50
T2 = 14
sample_per_step = 100

timer_throw_Methode1 = []
timer_count_Methode1 = []
timer_total_Methode1 = []
timer_throw_Methode2 = []
timer_count_Methode2 = []
timer_total_Methode2 = []
timer_throw_Methode3 = []
timer_count_Methode3 = []
timer_total_Methode3 = []

for i in range(1, N + 1):
    timer = script.main(i * sample_per_step, T1, T2)
    timer_throw_Methode1.append(timer[0][0])
    timer_count_Methode1.append(timer[0][1])
    timer_total_Methode1.append(timer[0][2])
    timer_throw_Methode2.append(timer[1][0])
    timer_count_Methode2.append(timer[1][1])
    timer_total_Methode2.append(timer[1][2])
    timer_throw_Methode3.append(timer[2][0])
    timer_count_Methode3.append(timer[2][1])
    timer_total_Methode3.append(timer[2][2])

ind = np.arange(N)  # the x locations for the groups
width = 0.25  # the width of the bars
space = 0.05

fig, ax = plt.subplots()
コード例 #28
0
ファイル: main.py プロジェクト: PavlenkoAlexandr/HW_WEB
from script import main
import asyncio

if __name__ == '__main__':
    username = input('Введите вашу Gmail почту: ')
    password = input('Введите пароль вашей почты: ')
    asyncio.run(main('contacts.db', username, password))
コード例 #29
0
def test_main():
	a = 2
	assert a+1 == main(a)
コード例 #30
0
def test_main():
	create_zipfile()
	sc.main('.')
	delete_zipfile()