feat: allow null values in pokemon.csv

This commit is contained in:
Alessandro Pezzè 2020-07-25 21:18:10 +02:00
parent be946f27b9
commit 1c67ac45a4
2 changed files with 9 additions and 6 deletions

View file

@ -1336,12 +1336,12 @@ def _build_pokemons():
yield Pokemon(
id=int(info[0]),
name=info[1],
pokemon_species_id=int(info[2]),
height=int(info[3]),
weight=int(info[4]),
base_experience=int(info[5]),
order=int(info[6]),
is_default=bool(int(info[7])),
pokemon_species_id=int(info[2]) if info[2] != "" else None,
height=int(info[3]) if info[3] != "" else None,
weight=int(info[4]) if info[4] != "" else None,
base_experience=int(info[5]) if info[5] != "" else None,
order=int(info[6]) if info[6] != "" else None,
is_default=bool(int(info[7])) if info[7] != "" else None,
)
build_generic((Pokemon,), "pokemon.csv", csv_record_to_objects)

View file

@ -887,6 +887,9 @@ id,identifier,species_id,height,weight,base_experience,order,is_default
888,zacian,888,28,1100,335,,1
889,zamazenta,889,29,2100,335,,1
890,eternatus,890,200,9500,345,,1
891,kubfu,891,6,120,,,1
892,urshifu,892,19,1050,,,1
893,zarude,893,18,700,,,1
10001,deoxys-attack,386,17,608,270,497,0
10002,deoxys-defense,386,17,608,270,498,0
10003,deoxys-speed,386,17,608,270,499,0

1 id identifier species_id height weight base_experience order is_default
887 888 zacian 888 28 1100 335 1
888 889 zamazenta 889 29 2100 335 1
889 890 eternatus 890 200 9500 345 1
890 891 kubfu 891 6 120 1
891 892 urshifu 892 19 1050 1
892 893 zarude 893 18 700 1
893 10001 deoxys-attack 386 17 608 270 497 0
894 10002 deoxys-defense 386 17 608 270 498 0
895 10003 deoxys-speed 386 17 608 270 499 0