from rifters import leagues from summ_data import scrape from summoner import Summoner me = "jiangpro" peers_jk = leagues( me, 'NA' ) summoners = [] start = time.perf_counter_ns() for pj in peers_jk: summ = scrape( pj ) summoners.append( summ ) end = time.perf_counter_ns() elapsed_secs = (end - start) / 1000000000 print( f"Collecting took {str(elapsed_secs)}s" ) filtered_summs = [ summ.filter() for summ in summoners ] Summoner.sort( filtered_summs, 'win_rates', False ) f = open('silvers.txt', 'w+') start = time.perf_counter() f.writelines( f"{summ}\n" for summ in filtered_summs ) end = time.perf_counter() elapsed_secs = (end - start) / 1000000000 f.close() print( f"Storing took {str(elapsed_secs)}s" )
for thread in threads: thread.start() for thread in threads: thread.join() i += NUM_THREADS end = time.process_time() summoner_objs = [ Summoner.from_json(summ) for summ in summoners if type(summ) != str ] print(f'{len(summoner_objs)} summoners collected in {end-start}s') for summ in summoner_objs: summ['win_rates'] = int( summ['wins']) / (int(summ['wins']) + int(summ['losses'])) summ['games_played'] = int(summ['wins']) + int(summ['losses']) filtered_summs = Summoner.list_filter(summoner_objs, 'games_played', 100) Summoner.sort(filtered_summs, 'win_rates') start = time.process_time() f = open('./data/leaguers.txt', 'w+') f.write(f"{ json.dumps( Summoner.list_json( filtered_summs ), indent=3 ) }\n") f.close() end = time.process_time() print(f'Data written in {end-start}s')