panda1835 commited on
Commit
1f1d918
1 Parent(s): 38a40dc

Upload utils.py

Browse files
Files changed (1) hide show
  1. utils.py +11 -8
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
- while chain:
121
- species_name = chain['species']['name']
122
- evolution_list.append(pypokedex.get(name=species_name).dex)
123
- if chain.get('evolves_to') != []:
124
- chain = chain.get('evolves_to')[0]
125
- else:
126
- break
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):