#NEWLINE# def __new__( cls , name , bases , d ) : #NEWLINE# #INDENT# fields = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for base in bases : #NEWLINE# #INDENT# if hasattr ( base , '_fields' ) : #NEWLINE# #INDENT# fields . update ( base . _fields ) #NEWLINE# #UNINDENT# #UNINDENT# for ( attrname , attrval ) in d . items ( ) : #NEWLINE# #INDENT# if isinstance ( attrval , Field ) : #NEWLINE# #INDENT# if ( not attrval . name ) : #NEWLINE# #INDENT# attrval . name = attrname #NEWLINE# #UNINDENT# fields [ attrname ] = attrval #NEWLINE# #UNINDENT# #UNINDENT# d [ '_fields' ] = fields #NEWLINE# return type . __new__ ( cls , name , bases , d )