<s> import logging <EOL> from . . surveyor import Surveyor <EOL> l = logging . getLogger ( "<STR_LIT>" ) <EOL> class Executor ( Surveyor ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , project , start , final_addr = None , pickle_paths = None , max_run = <NUM_LIT> ) : <EOL> Surveyor . __init__ ( self , project , start = start , pickle_paths = pickle_paths ) <EOL> self . _project = project <EOL> self . _final_addr = final_addr <EOL> self . _max_run = max_run <EOL> self . _done = False <EOL> self . _error_occured = False <EOL> self . _run_counter = <NUM_LIT:0> <EOL> self . found = [ ] <EOL> @ property <EOL> def done ( self ) : <EOL> if self . error_occured : <EOL> return True <EOL> if len ( self . active ) > <NUM_LIT:1> : <EOL> raise Exception ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> elif len ( self . active ) == <NUM_LIT:0> : <EOL> return True <EOL> else : <EOL> path = self . active [ <NUM_LIT:0> ] <EOL> if path . state is not None and path . state . se . is_true ( path . state . ip == self . _final_addr ) : <EOL> self . found . append ( self . active [ <NUM_LIT:0> ] ) <EOL> self . active = [ ] <EOL> return True <EOL> return False <EOL> @ property <EOL> def error_occured ( self ) : <EOL> if len ( self . active ) == <NUM_LIT:0> : <EOL> return True <EOL> elif self . _run_counter > self . _max_run : <EOL> return True <EOL> return False <EOL> @ property <EOL> def last_state ( self ) : <EOL> if self . done or self . error_occured : <EOL> return None <EOL> return self . active [ <NUM_LIT:0> ] . state <EOL> def tick ( self ) : <EOL> self . _run_counter += <NUM_LIT:1> <EOL> Surveyor . tick ( self ) <EOL> if len ( self . active ) > <NUM_LIT:0> : <EOL> l . debug ( "<STR_LIT>" , self . _run_counter , self . active [ <NUM_LIT:0> ] . previous_run ) <EOL> else : <EOL> l . debug ( "<STR_LIT>" , self . _run_counter ) <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % ( <EOL> len ( self . active ) , len ( self . spilled ) , len ( self . found ) , len ( self . deadended ) , len ( self . errored ) , len ( self . unconstrained ) ) <EOL> from . import all_surveyors <EOL> all_surveyors [ '<STR_LIT>' ] = Executor </s>
