3 from codecs
import open
5 from pokedex
.db
import connect
, identifier_from_name
6 from pokedex
.db
.tables
import Language
7 from pokedex
.db
.tables
import Location
, LocationGameIndex
11 en
= session
.query(Language
).filter_by(identifier
='en').one() # English
12 ja
= session
.query(Language
).filter_by(identifier
='ja').one() # Japanese
14 with
open("bw-location-names-en", "r", "utf-8") as f
:
15 en_names
= [line
.rstrip("\n") for line
in f
]
16 with
open("bw-location-names-kanji", "r", "utf-8") as f
:
17 ja_names
= [line
.rstrip("\n") for line
in f
]
20 for i
, name
in enumerate(zip(en_names
, ja_names
)):
24 en_name
, ja_name
= name
33 loc
.name_map
[en
] = en_name
35 loc
.name_map
[ja
] = ja_name
36 loc
.region_id
= 5 # Unova
37 loc
.identifier
= identifier_from_name(en_name
)
41 lgi
= LocationGameIndex()
43 lgi
.generation_id
= 5 # Gen 5