#NEWLINE# def python_reloader( main_func , args , kwargs ) : #NEWLINE# #INDENT# if ( os . environ . get ( 'RUN_MAIN' ) == 'true' ) : #NEWLINE# #INDENT# thread . start_new_thread ( main_func , args , kwargs ) #NEWLINE# try : #NEWLINE# #INDENT# reloader_thread ( ) #NEWLINE# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# exit_code = restart_with_reloader ( ) #NEWLINE# if ( kwargs < 0 ) : #NEWLINE# #INDENT# os . kill ( os . getpid ( ) , ( - exit_code ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sys . exit ( exit_code ) #NEWLINE# #UNINDENT# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# pass