<s> """<STR_LIT>""" <EOL> from mpf . system . device import Device <EOL> class PlayfieldTransfer ( Device ) : <EOL> config_section = '<STR_LIT>' <EOL> collection = '<STR_LIT>' <EOL> class_label = '<STR_LIT>' <EOL> def __init__ ( self , machine , name , config , collection = None , validate = True ) : <EOL> super ( PlayfieldTransfer , self ) . __init__ ( machine , name , config , <EOL> collection , validate = validate ) <EOL> self . machine . events . add_handler ( '<STR_LIT>' , <EOL> self . configure_switch ) <EOL> self . target = self . config [ '<STR_LIT>' ] <EOL> self . source = self . config [ '<STR_LIT>' ] <EOL> def configure_switch ( self ) : <EOL> self . machine . switch_controller . add_switch_handler ( <EOL> switch_name = self . config [ '<STR_LIT>' ] . name , <EOL> callback = self . _ball_went_through , <EOL> state = <NUM_LIT:1> , ms = <NUM_LIT:0> ) <EOL> def _ball_went_through ( self ) : <EOL> self . log . debug ( "<STR_LIT>" , self . source . name , <EOL> self . target . name ) <EOL> self . machine . events . post ( '<STR_LIT>' + self . source . name + '<STR_LIT>' , <EOL> callback = self . _ball_went_through2 ) <EOL> def _ball_went_through2 ( self ) : <EOL> self . machine . events . post ( '<STR_LIT>' + self . source . name , <EOL> balls = <NUM_LIT:1> ) <EOL> self . machine . events . post ( '<STR_LIT>' + self . name + '<STR_LIT>' , <EOL> balls = <NUM_LIT:1> , <EOL> target = self . target , <EOL> timeout = <NUM_LIT:0> , <EOL> callback = self . _ball_went_through3 ) <EOL> def _ball_went_through3 ( self , balls , target , timeout ) : <EOL> self . machine . events . post ( '<STR_LIT>' + self . name + '<STR_LIT>' , <EOL> balls = <NUM_LIT:1> , <EOL> target = self . target , <EOL> callback = self . _ball_went_through4 ) <EOL> def _ball_went_through4 ( self , balls , target ) : <EOL> self . machine . events . post ( '<STR_LIT>' + self . target . name + '<STR_LIT>' ) </s>
