#NEWLINE# def _pre_check( check_compiled = True , check_storage_ensured = True , check_validated = True ) : #NEWLINE# #INDENT# 'Engine state precondition checking decorator.' #NEWLINE# def decorator( meth ) : #NEWLINE# #INDENT# do_what = meth . __name__ #NEWLINE# @ six . wraps ( meth ) #NEWLINE# def wrapper( self , * args , **kwargs ) : #NEWLINE# #INDENT# if ( check_compiled and ( not self . _compiled ) ) : #NEWLINE# #INDENT# raise exc . InvalidState ( ( 'Can not %s an engine which has not been compiled' % do_what ) ) #NEWLINE# #UNINDENT# if ( check_storage_ensured and ( not self . _storage_ensured ) ) : #NEWLINE# #INDENT# raise exc . InvalidState ( ( 'Can not %s an engine which has not had its storage populated' % do_what ) ) #NEWLINE# #UNINDENT# if ( check_validated and ( not self . _validated ) ) : #NEWLINE# #INDENT# raise exc . InvalidState ( ( 'Can not %s an engine which has not been validated' % do_what ) ) #NEWLINE# #UNINDENT# return meth ( self , * args , ** kwargs ) #NEWLINE# #UNINDENT# return wrapper #NEWLINE# #UNINDENT# return decorator