<s> human_data = { } <EOL> droid_data = { } <EOL> def setup ( ) : <EOL> from . schema import Human , Droid <EOL> global human_data , droid_data <EOL> luke = Human ( <EOL> id = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> friends = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> appears_in = [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] , <EOL> home_planet = '<STR_LIT>' , <EOL> ) <EOL> vader = Human ( <EOL> id = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> friends = [ '<STR_LIT>' ] , <EOL> appears_in = [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] , <EOL> home_planet = '<STR_LIT>' , <EOL> ) <EOL> han = Human ( <EOL> id = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> friends = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> appears_in = [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] , <EOL> home_planet = None , <EOL> ) <EOL> leia = Human ( <EOL> id = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> friends = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> appears_in = [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] , <EOL> home_planet = '<STR_LIT>' , <EOL> ) <EOL> tarkin = Human ( <EOL> id = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> friends = [ '<STR_LIT>' ] , <EOL> appears_in = [ <NUM_LIT:4> ] , <EOL> home_planet = None , <EOL> ) <EOL> human_data = { <EOL> '<STR_LIT>' : luke , <EOL> '<STR_LIT>' : vader , <EOL> '<STR_LIT>' : han , <EOL> '<STR_LIT>' : leia , <EOL> '<STR_LIT>' : tarkin , <EOL> } <EOL> threepio = Droid ( <EOL> id = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> friends = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> appears_in = [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] , <EOL> primary_function = '<STR_LIT>' , <EOL> ) <EOL> artoo = Droid ( <EOL> id = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> friends = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> appears_in = [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] , <EOL> primary_function = '<STR_LIT>' , <EOL> ) <EOL> droid_data = { <EOL> '<STR_LIT>' : threepio , <EOL> '<STR_LIT>' : artoo , <EOL> } <EOL> def get_character ( id ) : <EOL> return human_data . get ( id ) or droid_data . get ( id ) <EOL> def get_friends ( character ) : <EOL> return map ( get_character , character . friends ) <EOL> def get_hero ( episode ) : <EOL> if episode == <NUM_LIT:5> : <EOL> return human_data [ '<STR_LIT>' ] <EOL> return droid_data [ '<STR_LIT>' ] <EOL> def get_human ( id ) : <EOL> return human_data . get ( id ) <EOL> def get_droid ( id ) : <EOL> return droid_data . get ( id ) </s>
