#NEWLINE# def __init__( self , name , load = True , force = False ) : #NEWLINE# #INDENT# self . _name = name #NEWLINE# EventDispatcher . __init__ ( self ) #NEWLINE# self . finished_event = Event ( ) #NEWLINE# defn_filename = path . join ( config . dirs . user_data_dir , 'programs' , ( '%s.yaml' % self . name ) ) #NEWLINE# state_filename = path . join ( config . dirs . user_data_dir , 'state' , ( '%s.yaml' % self . name ) ) #NEWLINE# try : #NEWLINE# #INDENT# self . state = PersistentDict ( state_filename ) #NEWLINE# #UNINDENT# except yaml . error . YAMLError : #NEWLINE# #INDENT# log . error ( ( 'Yaml parser error. could not parse state file %s' % state_filename ) ) #NEWLINE# if force : #NEWLINE# #INDENT# log . warn ( 'Removing state file and continuing' ) #NEWLINE# os . unlink ( state_filename ) #NEWLINE# self . state = PersistentDict ( state_filename ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = 'Invalid state file. run `chalmers stop --force` to clear the state file' #NEWLINE# raise errors . ChalmersError ( msg ) #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# self . raw_data = PersistentDict ( defn_filename ) #NEWLINE# #UNINDENT# except yaml . error . YAMLError : #NEWLINE# #INDENT# log . error ( ( 'Yaml parser error. could not parse definition file %s' % defn_filename ) ) #NEWLINE# if force : #NEWLINE# #INDENT# self . raw_data = PersistentDict ( defn_filename , load = False ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = 'Invalid definition file. Run `chalmers edit %s` to fix the definition file' #NEWLINE# raise errors . ChalmersError ( ( msg % defn_filename ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . mk_data ( ) #NEWLINE# self . _p0 = None #NEWLINE# self . pipe_output = False