<s> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class InvalidData ( Exception ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class Step ( object ) : <EOL> """<STR_LIT>""" <EOL> def __str__ ( self ) : <EOL> raise NotImplementedError ( ) <EOL> def validate ( self ) : <EOL> raise NotImplementedError ( ) <EOL> class ProcessManager ( object ) : <EOL> """<STR_LIT>""" <EOL> def __iter__ ( self ) : <EOL> raise NotImplementedError ( ) <EOL> def __getitem__ ( self , step_id ) : <EOL> for step in self : <EOL> if str ( step ) == step_id : <EOL> return step <EOL> raise KeyError ( '<STR_LIT>' % ( step_id , ) ) <EOL> def validate_step ( self , step ) : <EOL> try : <EOL> step . validate ( ) <EOL> except InvalidData : <EOL> return False <EOL> return True <EOL> def get_next_step ( self ) : <EOL> for step in self : <EOL> if not self . validate_step ( step ) : <EOL> return step <EOL> def get_errors ( self ) : <EOL> errors = { } <EOL> for step in self : <EOL> try : <EOL> step . validate ( ) <EOL> except InvalidData as error : <EOL> errors [ str ( step ) ] = error <EOL> return errors <EOL> def is_complete ( self ) : <EOL> return self . get_next_step ( ) is None </s>
