Skip to content

Commit 235462f

Browse files
infinitewarpJ-e-k
authored andcommitted
more python3 fixes; fixes j-e-k/poketrainer/jekirl#322 (jekirl#323)
1 parent 618d3a3 commit 235462f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

web.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@
77
import re
88
from collections import defaultdict
99

10-
import six
1110
import zerorpc
1211
from flask import Flask, flash, jsonify, redirect, render_template, url_for
1312

1413
from pgoapi.poke_utils import pokemon_iv_percentage
1514

16-
if six.PY3:
17-
from past.builtins import cmp
18-
1915
app = Flask(__name__, template_folder="templates")
2016
app.secret_key = ".t\x86\xcb3Lm\x0e\x8c:\x86\xe8FD\x13Z\x08\xe1\x04(\x01s\x9a\xae"
2117
app.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

Comments
 (0)