77import re
88from collections import defaultdict
99
10- import six
1110import zerorpc
1211from flask import Flask , flash , jsonify , redirect , render_template , url_for
1312
1413from pgoapi .poke_utils import pokemon_iv_percentage
1514
16- if six .PY3 :
17- from past .builtins import cmp
18-
1915app = Flask (__name__ , template_folder = "templates" )
2016app .secret_key = ".t\x86 \xcb 3Lm\x0e \x8c :\x86 \xe8 FD\x13 Z\x08 \xe1 \x04 (\x01 s\x9a \xae "
2117app .debug = True
@@ -47,7 +43,7 @@ def get_api_rpc(username):
4743 sock_port = 0
4844 with open (desc_file ) as f :
4945 data = f .read ()
50- data = json .loads (data . encode () if len (data ) > 0 else '{}' )
46+ data = json .loads (data if len (data ) > 0 else '{}' )
5147 if username not in data :
5248 print ("There is no bot running with the input username!" )
5349 return None
@@ -66,7 +62,7 @@ def status(username):
6662 return ("There is no bot running with the input username!" )
6763 with open ("data_dumps/%s.json" % username ) as f :
6864 data = f .read ()
69- data = json .loads (data . encode () )
65+ data = json .loads (data )
7066 currency = data ['GET_PLAYER' ]['player_data' ]['currencies' ][1 ]['amount' ]
7167 latlng = c .current_location ()
7268 latlng = "%f,%f" % (latlng [0 ], latlng [1 ])
@@ -86,7 +82,7 @@ def status(username):
8682 if "pokemon_family" in item :
8783 filled_family = str (item ['pokemon_family' ]['family_id' ]).zfill (4 )
8884 candy [filled_family ] += item ['pokemon_family' ].get ("candy" , 0 )
89- pokemons = sorted (pokemons , lambda x , y : cmp ( x ["iv" ], y [ "iv" ]) , reverse = True )
85+ pokemons = sorted (pokemons , key = lambda x : x ["iv" ], reverse = True )
9086 # add candy back into pokemon json
9187 for pokemon in pokemons :
9288 pokemon ['candy' ] = candy [pokemon ['family_id' ]]
0 commit comments