def set_name_lists(ethnicity=None):
if not ethnicity: ethnicity = random.choice(get_ethnicities())<EOL>print("<STR_LIT>" + ethnicity)<EOL>filename = names_dir + ethnicity + '<STR_LIT>'<EOL>try:<EOL><INDENT>with open(filename, '<STR_LIT:r>') as injson:<EOL><INDENT>data = json.load(injson)<EOL><DEDENT><DEDENT>except:<EOL><INDENT>return '<STR_LIT>' + filename<EOL><DEDENT>else:<EOL><INDENT>names = [ tuple(name.split('<STR_LIT:U+002C>')) for name in data ]<EOL>random.shuffle(names)<EOL>global female_names<EOL>female_names = [name for name,gender,*desc in names if gender == '<STR_LIT>']<EOL>global male_names<EOL>male_names = [name for name,gender,*desc in names if gender == '<STR_LIT>']<EOL>global nb_names<EOL>nb_names = [name for name,gender,*desc in names if gender == '<STR_LIT>']<EOL><DEDENT>
Set three globally available lists of names.