Spaces:
Runtime error
Runtime error
Upload utils.py
Browse files
utils.py
CHANGED
@@ -117,14 +117,17 @@ def get_evolution_chain(dex):
|
|
117 |
# Parse the evolution chain data and get the full list of evolutions
|
118 |
evolution_list = []
|
119 |
chain = evolution_chain_data['chain']
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
128 |
return evolution_list
|
129 |
|
130 |
def can_evolve(dex, energy):
|
|
|
117 |
# Parse the evolution chain data and get the full list of evolutions
|
118 |
evolution_list = []
|
119 |
chain = evolution_chain_data['chain']
|
120 |
+
try:
|
121 |
+
while chain:
|
122 |
+
species_name = chain['species']['name']
|
123 |
+
evolution_list.append(pypokedex.get(name=species_name).dex)
|
124 |
+
if chain.get('evolves_to') != []:
|
125 |
+
chain = chain.get('evolves_to')[0]
|
126 |
+
else:
|
127 |
+
break
|
128 |
+
except Exception as e:
|
129 |
+
evolution_list = [name]
|
130 |
+
print(str(e))
|
131 |
return evolution_list
|
132 |
|
133 |
def can_evolve(dex, energy):
|