<s> """<STR_LIT>""" <EOL> __author__ = "<STR_LIT>" <EOL> __version__ = "<STR_LIT>" <EOL> import tests . users <EOL> import tests . accounts <EOL> import tests . income <EOL> import tests . expenses <EOL> import unittest <EOL> import sys <EOL> import Tkinter <EOL> import tkMessageBox <EOL> import traceback <EOL> import threading <EOL> import Queue <EOL> import time <EOL> import string <EOL> tk = Tkinter <EOL> class GUITestResult ( unittest . TestResult ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , callback ) : <EOL> unittest . TestResult . __init__ ( self ) <EOL> self . callback = callback <EOL> def addError ( self , test , err ) : <EOL> unittest . TestResult . addError ( self , test , err ) <EOL> self . callback . notifyTestErrored ( test , err ) <EOL> def addFailure ( self , test , err ) : <EOL> unittest . TestResult . addFailure ( self , test , err ) <EOL> self . callback . notifyTestFailed ( test , err ) <EOL> def stopTest ( self , test ) : <EOL> unittest . TestResult . stopTest ( self , test ) <EOL> self . callback . notifyTestFinished ( test ) <EOL> def startTest ( self , test ) : <EOL> unittest . TestResult . startTest ( self , test ) <EOL> self . callback . notifyTestStarted ( test ) <EOL> class RollbackImporter : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> self . previousModules = sys . modules . copy ( ) <EOL> def rollbackImports ( self ) : <EOL> for modname in sys . modules . keys ( ) : <EOL> if not self . previousModules . has_key ( modname ) : <EOL> del ( sys . modules [ modname ] ) <EOL> _ABOUT_TEXT = """<STR_LIT>""" <EOL> _HELP_TEXT = """<STR_LIT>""" <EOL> class TestStartedMessage ( ) : <EOL> def __init__ ( self , test ) : <EOL> self . test = test <EOL> pass <EOL> def __call__ ( self , receiver ) : <EOL> receiver . executeTestStarted ( self . test ) <EOL> pass <EOL> class TestFailedMessage ( ) : <EOL> def __init__ ( self , test , err ) : <EOL> self . test = test <EOL> self . err = err <EOL> pass <EOL> def __call__ ( self , receiver ) : <EOL> receiver . executeTestFailed ( self . test , self . err ) <EOL> pass <EOL> class TestErroredMessage ( ) : <EOL> def __init__ ( self , test , err ) : <EOL> self . test = test <EOL> self . err = err <EOL> pass <EOL> def __call__ ( self , receiver ) : <EOL> receiver . executeTestErrored ( self . test , self . err ) <EOL> pass <EOL> class TestFinishedMessage ( ) : <EOL> def __init__ ( self , test ) : <EOL> self . test = test <EOL> pass <EOL> def __call__ ( self , receiver ) : <EOL> receiver . executeTestFinished ( self . test ) <EOL> pass <EOL> class StoppedMessage ( ) : <EOL> def __init__ ( self ) : <EOL> pass <EOL> def __call__ ( self , receiver ) : <EOL> receiver . executeStopped ( ) <EOL> pass <EOL> class EnhancedGUIRunner ( ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> self . currentResult = None <EOL> self . running = <NUM_LIT:0> <EOL> self . rollbackImporter = None <EOL> apply ( self . initGUI , args , kwargs ) <EOL> self . runClicked ( ) <EOL> def initGUI ( self , root , initialTestName ) : <EOL> """<STR_LIT>""" <EOL> self . root = root <EOL> self . suiteNameVar = tk . StringVar ( ) <EOL> self . suiteNameVar . set ( initialTestName ) <EOL> self . statusVar = tk . StringVar ( ) <EOL> self . statusVar . set ( "<STR_LIT>" ) <EOL> self . runCountVar = tk . IntVar ( ) <EOL> self . failCountVar = tk . IntVar ( ) <EOL> self . errorCountVar = tk . IntVar ( ) <EOL> self . remainingCountVar = tk . IntVar ( ) <EOL> self . stopOnErrorVar = tk . IntVar ( ) <EOL> self . elapsedVar = tk . StringVar ( ) <EOL> self . elapsedVar . set ( "<STR_LIT>" ) <EOL> self . averageVar = tk . StringVar ( ) <EOL> self . averageVar . set ( "<STR_LIT>" ) <EOL> self . top = tk . Frame ( ) <EOL> self . top . pack ( fill = tk . BOTH , expand = <NUM_LIT:1> ) <EOL> self . createWidgets ( ) <EOL> self . queue = Queue . Queue ( ) <EOL> self . currentTestIndex = <NUM_LIT:0> <EOL> def runClicked ( self ) : <EOL> "<STR_LIT>" <EOL> if self . running : return <EOL> self . running = <NUM_LIT:1> <EOL> self . currentTestIndex = <NUM_LIT:0> <EOL> while self . errorListbox . size ( ) : <EOL> self . errorListbox . delete ( <NUM_LIT:0> ) <EOL> testName = self . getSelectedTestName ( ) <EOL> if not testName : <EOL> self . errorDialog ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> return <EOL> if self . rollbackImporter : <EOL> self . rollbackImporter . rollbackImports ( ) <EOL> self . rollbackImporter = RollbackImporter ( ) <EOL> try : <EOL> self . test = unittest . defaultTestLoader . loadTestsFromName ( testName ) <EOL> except : <EOL> exc_type , exc_value , exc_tb = sys . exc_info ( ) <EOL> apply ( traceback . print_exception , sys . exc_info ( ) ) <EOL> self . errorDialog ( "<STR_LIT>" % testName , <EOL> "<STR_LIT>" % ( exc_type , exc_value ) ) <EOL> return <EOL> self . showtests ( self . test ) <EOL> self . currentResult = GUITestResult ( self ) <EOL> self . totalTests = self . test . countTestCases ( ) <EOL> self . notifyRunning ( ) <EOL> self . thread1 = threading . Thread ( target = self . bgRunner ) <EOL> self . thread1 . start ( ) <EOL> self . theLoop ( ) <EOL> def showtests ( self , x ) : <EOL> if isinstance ( x , unittest . TestCase ) : <EOL> print x . id ( ) <EOL> self . errorListbox . insert ( Tkinter . END , x . id ( ) ) <EOL> elif isinstance ( x , unittest . TestSuite ) : <EOL> for thing in x . _tests : <EOL> self . showtests ( thing ) <EOL> def bgRunner ( self ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> self . test . run ( self . currentResult ) <EOL> print "<STR_LIT>" <EOL> self . notifyStopped ( ) <EOL> pass <EOL> def stopClicked ( self ) : <EOL> "<STR_LIT>" <EOL> if self . currentResult : <EOL> self . currentResult . stop ( ) <EOL> print "<STR_LIT>" <EOL> self . stopGoButton . config ( state = tk . DISABLED ) <EOL> def theLoop ( self ) : <EOL> if self . running : <EOL> soFar = time . clock ( ) - self . runStartTime <EOL> self . elapsedVar . set ( time . strftime ( "<STR_LIT>" , <EOL> time . localtime ( soFar ) ) ) <EOL> while self . queue . qsize ( ) : <EOL> try : <EOL> print "<STR_LIT>" <EOL> msg = self . queue . get ( <NUM_LIT:0> ) <EOL> msg ( self ) <EOL> self . top . update ( ) <EOL> except Queue . Empty : <EOL> pass <EOL> self . top . after ( <NUM_LIT:100> , self . theLoop ) <EOL> def createWidgets ( self ) : <EOL> """<STR_LIT>""" <EOL> statusFrame = tk . Frame ( self . top , relief = tk . SUNKEN , borderwidth = <NUM_LIT:2> ) <EOL> statusFrame . pack ( anchor = tk . SW , fill = tk . X , side = tk . BOTTOM ) <EOL> tk . Label ( statusFrame , textvariable = self . statusVar ) . pack ( side = tk . LEFT ) <EOL> rightFrame = tk . Frame ( self . top , borderwidth = <NUM_LIT:3> ) <EOL> rightFrame . pack ( fill = tk . BOTH , side = tk . LEFT , anchor = tk . NW , expand = <NUM_LIT:1> ) <EOL> suiteNameFrame = tk . Frame ( rightFrame , borderwidth = <NUM_LIT:3> ) <EOL> suiteNameFrame . pack ( fill = tk . X ) <EOL> tk . Label ( suiteNameFrame , text = "<STR_LIT>" ) . pack ( side = tk . LEFT ) <EOL> e = tk . Entry ( suiteNameFrame , textvariable = self . suiteNameVar , width = <NUM_LIT> ) <EOL> e . pack ( side = tk . LEFT , fill = tk . X , expand = <NUM_LIT:1> ) <EOL> e . focus_set ( ) <EOL> e . bind ( '<STR_LIT>' , lambda e , self = self : self . runClicked ( ) ) <EOL> stopOnErrorFrame = tk . Frame ( rightFrame , borderwidth = <NUM_LIT:0> ) <EOL> stopOnErrorFrame . pack ( side = tk . TOP , anchor = tk . W ) <EOL> stopOnErrorButton = tk . Checkbutton ( stopOnErrorFrame , text = "<STR_LIT>" , <EOL> variable = self . stopOnErrorVar ) <EOL> stopOnErrorButton . pack ( side = tk . LEFT , expand = <NUM_LIT:0> , anchor = tk . W ) <EOL> stopOnErrorButton . toggle ( ) <EOL> progressFrame = tk . Frame ( rightFrame , relief = tk . GROOVE , borderwidth = <NUM_LIT:2> ) <EOL> progressFrame . pack ( fill = tk . X , expand = <NUM_LIT:0> , anchor = tk . NW ) <EOL> tk . Label ( progressFrame , text = "<STR_LIT>" ) . pack ( anchor = tk . W ) <EOL> self . progressBar = ProgressBar ( progressFrame , relief = tk . SUNKEN , <EOL> borderwidth = <NUM_LIT:2> ) <EOL> self . progressBar . pack ( fill = tk . X , expand = <NUM_LIT:1> ) <EOL> buttonFrame = tk . Frame ( self . top , borderwidth = <NUM_LIT:3> ) <EOL> buttonFrame . pack ( side = tk . LEFT , anchor = tk . NW , fill = tk . Y ) <EOL> self . stopGoButton = tk . Button ( buttonFrame , text = "<STR_LIT>" , <EOL> command = self . runClicked ) <EOL> self . stopGoButton . pack ( fill = tk . X ) <EOL> tk . Button ( buttonFrame , text = "<STR_LIT>" , <EOL> command = self . top . quit ) . pack ( side = tk . BOTTOM , fill = tk . X ) <EOL> tk . Button ( buttonFrame , text = "<STR_LIT>" , <EOL> command = self . showAboutDialog ) . pack ( side = tk . BOTTOM , fill = tk . X ) <EOL> tk . Button ( buttonFrame , text = "<STR_LIT>" , <EOL> command = self . showHelpDialog ) . pack ( side = tk . BOTTOM , fill = tk . X ) <EOL> countFrame = tk . Frame ( progressFrame , borderwidth = <NUM_LIT:2> ) <EOL> countFrame . pack ( fill = tk . X , expand = <NUM_LIT:1> ) <EOL> for label , var in ( ( '<STR_LIT>' , self . runCountVar ) , <EOL> ( '<STR_LIT>' , self . failCountVar ) , <EOL> ( '<STR_LIT>' , self . errorCountVar ) , <EOL> ( '<STR_LIT>' , self . remainingCountVar ) <EOL> ) : <EOL> tk . Label ( countFrame , text = label ) . pack ( side = tk . LEFT ) <EOL> tk . Label ( countFrame , textvariable = var , <EOL> foreground = "<STR_LIT>" ) . pack ( side = tk . LEFT , fill = tk . X , <EOL> expand = <NUM_LIT:1> , anchor = tk . W ) <EOL> timeFrame = tk . Frame ( progressFrame , borderwidth = <NUM_LIT:2> ) <EOL> timeFrame . pack ( fill = tk . X , expand = <NUM_LIT:1> ) <EOL> for label , var in ( ( '<STR_LIT>' , self . elapsedVar ) , <EOL> ( '<STR_LIT>' , self . averageVar ) <EOL> ) : <EOL> tk . Label ( timeFrame , text = label ) . pack ( side = tk . LEFT ) <EOL> tk . Label ( timeFrame , textvariable = var , <EOL> foreground = "<STR_LIT>" ) . pack ( side = tk . LEFT , fill = tk . X , <EOL> expand = <NUM_LIT:1> , anchor = tk . W ) <EOL> tk . Label ( rightFrame , text = "<STR_LIT>" ) . pack ( anchor = tk . W ) <EOL> listFrame = tk . Frame ( rightFrame , relief = tk . SUNKEN , borderwidth = <NUM_LIT:2> ) <EOL> listFrame . grid_rowconfigure ( <NUM_LIT:0> , weight = <NUM_LIT:1> ) <EOL> listFrame . grid_columnconfigure ( <NUM_LIT:0> , weight = <NUM_LIT:1> ) <EOL> self . errorListbox = tk . Listbox ( listFrame , foreground = '<STR_LIT>' , <EOL> selectmode = tk . SINGLE , <EOL> selectborderwidth = <NUM_LIT:0> , <EOL> width = '<STR_LIT>' ) <EOL> self . errorListbox . grid ( row = <NUM_LIT:0> , column = <NUM_LIT:0> , sticky = tk . N + tk . S + tk . E + tk . W ) <EOL> listVScroll = tk . Scrollbar ( listFrame , command = self . errorListbox . yview ) <EOL> listVScroll . grid ( row = <NUM_LIT:0> , column = <NUM_LIT:1> , sticky = tk . N + tk . S ) <EOL> listHScroll = tk . Scrollbar ( listFrame , command = self . errorListbox . xview , <EOL> orient = Tkinter . HORIZONTAL ) <EOL> listHScroll . grid ( row = <NUM_LIT:1> , column = <NUM_LIT:0> , sticky = tk . E + tk . W ) <EOL> self . errorListbox . bind ( "<STR_LIT>" , <EOL> lambda e , self = self : self . showSelectedError ( ) ) <EOL> self . errorListbox . configure ( yscrollcommand = listVScroll . set ) <EOL> self . errorListbox . configure ( xscrollcommand = listHScroll . set ) <EOL> listFrame . pack ( fill = tk . BOTH , expand = <NUM_LIT:1> ) <EOL> def getSelectedTestName ( self ) : <EOL> return self . suiteNameVar . get ( ) <EOL> def errorDialog ( self , title , message ) : <EOL> tkMessageBox . showerror ( parent = self . root , title = title , <EOL> message = message ) <EOL> def notifyRunning ( self ) : <EOL> self . runStartTime = time . clock ( ) <EOL> self . runCountVar . set ( <NUM_LIT:0> ) <EOL> self . failCountVar . set ( <NUM_LIT:0> ) <EOL> self . errorCountVar . set ( <NUM_LIT:0> ) <EOL> self . elapsedVar . set ( "<STR_LIT>" ) <EOL> self . averageVar . set ( "<STR_LIT>" ) <EOL> self . remainingCountVar . set ( self . totalTests ) <EOL> self . errorInfo = [ ] <EOL> self . stopGoButton . config ( command = self . stopClicked , text = "<STR_LIT>" ) <EOL> self . progressBar . setProgressFraction ( <NUM_LIT:0.0> ) <EOL> self . top . update_idletasks ( ) <EOL> def notifyStopped ( self ) : <EOL> self . queue . put ( StoppedMessage ( ) ) <EOL> pass <EOL> def executeStopped ( self ) : <EOL> print "<STR_LIT>" <EOL> self . stopGoButton . config ( state = tk . ACTIVE ) <EOL> self . stopGoButton . config ( command = self . runClicked , text = "<STR_LIT>" ) <EOL> self . statusVar . set ( "<STR_LIT>" ) <EOL> self . top . update_idletasks ( ) <EOL> self . running = <NUM_LIT:0> <EOL> pass <EOL> def notifyTestStarted ( self , test ) : <EOL> self . queue . put ( TestStartedMessage ( test ) ) <EOL> pass <EOL> def setDisplayStatus ( self , position , status ) : <EOL> str = self . errorListbox . get ( position ) <EOL> parts = str . split ( '<STR_LIT>' , <NUM_LIT:1> ) <EOL> if len ( parts ) == <NUM_LIT:2> : <EOL> if parts [ <NUM_LIT:0> ] == '<STR_LIT>' or parts [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> return <EOL> else : <EOL> str = parts [ <NUM_LIT:1> ] <EOL> str = status + '<STR_LIT>' + str <EOL> self . errorListbox . insert ( position , str ) <EOL> self . errorListbox . delete ( position + <NUM_LIT:1> ) <EOL> if status == '<STR_LIT>' : <EOL> self . errorListbox . itemconfig ( position , fg = '<STR_LIT>' ) <EOL> elif status == '<STR_LIT>' : <EOL> self . errorListbox . itemconfig ( position , fg = '<STR_LIT>' ) <EOL> elif status == '<STR_LIT>' : <EOL> self . errorListbox . itemconfig ( position , fg = '<STR_LIT>' ) <EOL> elif status == '<STR_LIT>' : <EOL> self . errorListbox . itemconfig ( position , fg = '<STR_LIT>' ) <EOL> if position > <NUM_LIT:0> : <EOL> self . errorListbox . select_clear ( position - <NUM_LIT:1> ) <EOL> self . errorListbox . select_set ( position ) <EOL> self . errorListbox . see ( min ( position + <NUM_LIT:4> , self . errorListbox . size ( ) ) ) <EOL> pass <EOL> def executeTestStarted ( self , test ) : <EOL> self . statusVar . set ( str ( test ) ) <EOL> self . setDisplayStatus ( self . currentTestIndex , '<STR_LIT>' ) <EOL> self . top . update_idletasks ( ) <EOL> pass <EOL> def notifyTestFailed ( self , test , err ) : <EOL> if self . stopOnErrorVar . get ( ) == <NUM_LIT:1> : <EOL> self . currentResult . stop ( ) <EOL> self . queue . put ( TestFailedMessage ( test , err ) ) <EOL> pass <EOL> def executeTestFailed ( self , test , err ) : <EOL> self . failCountVar . set ( <NUM_LIT:1> + self . failCountVar . get ( ) ) <EOL> self . errorInfo . append ( ( test , err ) ) <EOL> self . setDisplayStatus ( self . currentTestIndex , '<STR_LIT>' ) <EOL> pass <EOL> def notifyTestErrored ( self , test , err ) : <EOL> if self . stopOnErrorVar . get ( ) == <NUM_LIT:1> : <EOL> self . currentResult . stop ( ) <EOL> self . queue . put ( TestErroredMessage ( test , err ) ) <EOL> pass <EOL> def executeTestErrored ( self , test , err ) : <EOL> self . errorCountVar . set ( <NUM_LIT:1> + self . errorCountVar . get ( ) ) <EOL> self . errorInfo . append ( ( test , err ) ) <EOL> self . setDisplayStatus ( self . currentTestIndex , '<STR_LIT>' ) <EOL> pass <EOL> def notifyTestFinished ( self , test ) : <EOL> self . queue . put ( TestFinishedMessage ( test ) ) <EOL> pass <EOL> def executeTestFinished ( self , test ) : <EOL> self . remainingCountVar . set ( self . remainingCountVar . get ( ) - <NUM_LIT:1> ) <EOL> self . runCountVar . set ( <NUM_LIT:1> + self . runCountVar . get ( ) ) <EOL> fractionDone = float ( self . runCountVar . get ( ) ) / float ( self . totalTests ) <EOL> fillColor = ( self . errorCountVar . get ( ) > <NUM_LIT:0> or self . failCountVar . get ( ) > <NUM_LIT:0> ) and "<STR_LIT>" or "<STR_LIT>" <EOL> self . progressBar . setProgressFraction ( fractionDone , fillColor ) <EOL> soFar = time . clock ( ) - self . runStartTime <EOL> self . averageVar . set ( time . strftime ( "<STR_LIT>" , <EOL> time . localtime ( soFar / self . runCountVar . get ( ) ) ) ) <EOL> self . setDisplayStatus ( self . currentTestIndex , '<STR_LIT>' ) <EOL> if self . currentTestIndex >= len ( self . errorInfo ) : <EOL> self . errorInfo . append ( ( test , None ) ) <EOL> self . currentTestIndex = self . currentTestIndex + <NUM_LIT:1> <EOL> pass <EOL> def showAboutDialog ( self ) : <EOL> tkMessageBox . showinfo ( parent = self . root , title = "<STR_LIT>" , <EOL> message = _ABOUT_TEXT ) <EOL> def showHelpDialog ( self ) : <EOL> tkMessageBox . showinfo ( parent = self . root , title = "<STR_LIT>" , <EOL> message = _HELP_TEXT ) <EOL> def showSelectedError ( self ) : <EOL> selection = self . errorListbox . curselection ( ) <EOL> if not selection : return <EOL> selected = int ( selection [ <NUM_LIT:0> ] ) <EOL> txt = self . errorListbox . get ( selected ) <EOL> window = tk . Toplevel ( self . root ) <EOL> window . title ( txt ) <EOL> window . protocol ( '<STR_LIT>' , window . quit ) <EOL> if selected < len ( self . errorInfo ) : <EOL> test , error = self . errorInfo [ selected ] <EOL> tk . Label ( window , text = str ( test ) , <EOL> foreground = ( error is None ) and "<STR_LIT>" or "<STR_LIT>" , <EOL> justify = tk . LEFT ) . pack ( anchor = tk . W ) <EOL> if error is None : <EOL> tk . Label ( window , text = '<STR_LIT>' , justify = tk . LEFT ) . pack ( ) <EOL> else : <EOL> tracebackLines = apply ( traceback . format_exception , error + ( <NUM_LIT:10> , ) ) <EOL> tracebackText = string . join ( tracebackLines , '<STR_LIT>' ) <EOL> tk . Label ( window , text = tracebackText , justify = tk . LEFT ) . pack ( ) <EOL> else : <EOL> tk . Label ( window , text = '<STR_LIT>' , justify = tk . LEFT ) . pack ( ) <EOL> tk . Button ( window , text = "<STR_LIT>" , <EOL> command = window . quit ) . pack ( side = tk . BOTTOM ) <EOL> window . bind ( '<STR_LIT>' , lambda e , w = window : w . quit ( ) ) <EOL> window . mainloop ( ) <EOL> window . destroy ( ) <EOL> class ProgressBar ( tk . Frame ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> apply ( tk . Frame . __init__ , ( self , ) + args , kwargs ) <EOL> self . canvas = tk . Canvas ( self , height = '<STR_LIT>' , width = '<STR_LIT>' , <EOL> background = '<STR_LIT>' , borderwidth = <NUM_LIT:3> ) <EOL> self . canvas . pack ( fill = tk . X , expand = <NUM_LIT:1> ) <EOL> self . rect = self . text = None <EOL> self . canvas . bind ( '<STR_LIT>' , self . paint ) <EOL> self . setProgressFraction ( <NUM_LIT:0.0> ) <EOL> def setProgressFraction ( self , fraction , color = '<STR_LIT>' ) : <EOL> self . fraction = fraction <EOL> self . color = color <EOL> self . paint ( ) <EOL> self . canvas . update_idletasks ( ) <EOL> def paint ( self , * args ) : <EOL> totalWidth = self . canvas . winfo_width ( ) <EOL> width = int ( self . fraction * float ( totalWidth ) ) <EOL> height = self . canvas . winfo_height ( ) <EOL> if self . rect is not None : self . canvas . delete ( self . rect ) <EOL> if self . text is not None : self . canvas . delete ( self . text ) <EOL> self . rect = self . canvas . create_rectangle ( <NUM_LIT:0> , <NUM_LIT:0> , width , height , <EOL> fill = self . color ) <EOL> percentString = "<STR_LIT>" % ( <NUM_LIT> * self . fraction ) <EOL> self . text = self . canvas . create_text ( totalWidth / <NUM_LIT:2> , height / <NUM_LIT:2> , <EOL> anchor = tk . CENTER , <EOL> text = percentString ) <EOL> def main ( initialTestName = "<STR_LIT>" ) : <EOL> root = tk . Tk ( ) <EOL> root . title ( "<STR_LIT>" ) <EOL> runner = EnhancedGUIRunner ( root , initialTestName ) <EOL> root . protocol ( '<STR_LIT>' , root . quit ) <EOL> root . mainloop ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> if len ( sys . argv ) == <NUM_LIT:2> : <EOL> main ( sys . argv [ <NUM_LIT:1> ] ) <EOL> else : <EOL> main ( ) </s>
