<s> """<STR_LIT>""" <EOL> from twisted . internet import reactor <EOL> from starpy import fastagi <EOL> import utilapplication <EOL> import logging , time <EOL> log = logging . getLogger ( '<STR_LIT>' ) <EOL> def testFunction ( agi ) : <EOL> """<STR_LIT>""" <EOL> log . debug ( '<STR_LIT>' ) <EOL> df = agi . streamFile ( '<STR_LIT>' ) <EOL> def onFailed ( reason ) : <EOL> log . error ( "<STR_LIT>" , reason . getTraceback ( ) ) <EOL> return None <EOL> def cleanup ( result ) : <EOL> agi . finish ( ) <EOL> return result <EOL> def onSaid ( resultLine ) : <EOL> """<STR_LIT>""" <EOL> t = time . time ( ) <EOL> t2 = t + <NUM_LIT> <EOL> df = agi . sayDateTime ( t2 , format = '<STR_LIT>' ) <EOL> def onDateFinished ( resultLine ) : <EOL> df = agi . wait ( t2 - <NUM_LIT> - time . time ( ) ) <EOL> def onDoBeep ( result ) : <EOL> df = agi . streamFile ( '<STR_LIT>' ) <EOL> return df <EOL> def waitTwo ( result ) : <EOL> return agi . streamFile ( '<STR_LIT>' ) <EOL> return df . addCallback ( onDoBeep ) . addCallback ( waitTwo ) <EOL> return df . addCallback ( onDateFinished ) <EOL> return df . addCallback ( <EOL> onSaid <EOL> ) . addErrback ( <EOL> onFailed <EOL> ) . addCallbacks ( <EOL> cleanup , cleanup , <EOL> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> logging . basicConfig ( ) <EOL> fastagi . log . setLevel ( logging . INFO ) <EOL> APPLICATION = utilapplication . UtilApplication ( ) <EOL> reactor . callWhenRunning ( APPLICATION . agiSpecifier . run , testFunction ) <EOL> reactor . run ( ) </s>
