def dwnldfile():
    filename = input(colored(" [system]: filename: ", "white"))
    time.sleep(1)
    ################################

    suffix = '%(index)d/%(max)d [%(elapsed)d / %(eta)d / %(eta_td)s]'
    bar = FillingSquaresBar(" [system]: downloading ", suffix=suffix)
    for i in bar.iter(range(100)):
        sleep()

    ##################################
    localfile = open(filename, 'wb')
    ftp.retrbinary('RETR ' + filename, localfile.write, 1024)
    print(" ")
    time.sleep(0.9)
    print(colored(" [system]: file downloaded", "white"))
    ftp.quit()
    localfile.close()
Example #2
0
def dwnldfile(chatroom):
    ftp = FTP(os.getenv("FTP", None))
    ftp.login()
    print(chatroom)
    ftp.cwd("./" + chatroom)
    print(ftp.dir())
    filename = input(colored(" [system]: filename: ", "white"))
    time.sleep(1)
    ################################

    suffix = '%(index)d/%(max)d [%(elapsed)d / %(eta)d / %(eta_td)s]'
    bar = FillingSquaresBar(" [system]: downloading ", suffix=suffix)
    for i in bar.iter(range(100)):
        sleep()

    ##################################
    localfile = open(filename, 'wb')
    ftp.retrbinary('RETR ' + filename, localfile.write, 1024)
    print(" ")
    time.sleep(0.9)
    print(colored(" [system]: file downloaded", "white"))
    ftp.cwd("./../")
    localfile.close()
    ftp.quit()
Example #3
0
if game == 'guessthatnumber':
    players = [
        'colosseum.games.guessthatnumber.linearbot',
        'colosseum.games.guessthatnumber.binarybot',
        # 'colosseum.games.guessthatnumber.human',
    ]
    hoster = gtn.GTNHoster(players)
    start_game_args = (100, )
elif game == 'dotsnboxes':
    players = [
        'colosseum.games.dotsnboxes.randombot',
        'colosseum.games.dotsnboxes.randombot',
    ]
    hoster = dnb.DnBHoster(players)
    start_game_args = ()

n = 1000
print(f'Running {n} games...')
cum_time = 0
bar = FillingSquaresBar(
    'Running games...',
    suffix='%(percent)d%% [%(index)d/%(max)d] elapsed: %(elapsed)ds '
    'remaining: %(eta)ds')
for _ in bar.iter(range(n)):
    cum_time -= time()
    hoster.start_game(*start_game_args)
    cum_time += time()
print(f'{cum_time:0.3f} s of total runtime')
print(f'{cum_time/n:0.3f} s/game')
print(f'{n/cum_time:0.3f} game/s')