MCPcopy
hub / github.com/PokeAPI/pokeapi / try_image_names

Function try_image_names

data/v2/build.py:1427–1445  ·  view source on GitHub ↗
(path, info, extension)

Source from the content-addressed store, hash-verified

1425 build_generic((Pokemon,), "pokemon.csv", csv_record_to_objects)
1426
1427 def try_image_names(path, info, extension):
1428 # poke_sprites = "pokemon/{0}"
1429 pokemon_id = info[0]
1430 identifier = info[1]
1431 species_id = info[2]
1432 if "-" in identifier:
1433 form_file_name = "%s.%s" % (
1434 species_id + "-" + identifier.split("-", 1)[1],
1435 extension,
1436 )
1437 id_file_name = "%s.%s" % (pokemon_id, extension)
1438 file_name = (
1439 id_file_name
1440 if file_path_or_none(path + id_file_name)
1441 else form_file_name
1442 )
1443 else:
1444 file_name = "%s.%s" % (info[0], extension)
1445 return file_path_or_none(path + file_name)
1446
1447 def csv_record_to_objects(info):
1448 poke_sprites = "pokemon/"

Callers 1

csv_record_to_objectsFunction · 0.85

Calls 2

file_path_or_noneFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected