#NEWLINE# def __new__( cls , name , bases , d ) : #NEWLINE# #INDENT# state = d . get ( 'initial_state' ) #NEWLINE# if ( state == None ) : #NEWLINE# #INDENT# for base in bases : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# state = base . initial_state #NEWLINE# break #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# ( before , after ) = ( [ ] , [ ] ) #NEWLINE# for ( name , func ) in d . items ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# after += [ ( name , end , func ) for ( start , end ) in func . after ] #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# before += [ ( start , end , func ) for ( start , end ) in func . before ] #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# d [ '_after_transitions' ] = after #NEWLINE# d [ '_before_transitions' ] = before #NEWLINE# d [ '_state' ] = state #NEWLINE# return type . __new__ ( cls , name , bases , d )