#NEWLINE# def __setitem__( self , key , value ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# key = int ( key ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# raise Exception ( ( 'Transient2d.__setitem__() error: ' + "'key'could not be cast to int:{0}" . format ( str ( e ) ) ) ) #NEWLINE# #UNINDENT# nper = self . model . nper #NEWLINE# if ( ( key > self . model . nper ) or ( key < 0 ) ) : #NEWLINE# #INDENT# raise Exception ( ( 'Transient2d.__setitem__() error: ' + 'key {0} not in nper range {1}:{2}' . format ( key , 0 , nper ) ) ) #NEWLINE# #UNINDENT# self . transient_2ds [ key ] = self . __get_2d_instance ( key , value )