#NEWLINE# def __new__( cls , name , bases , attrs ) : #NEWLINE# #INDENT# fields = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for base in bases : #NEWLINE# #INDENT# fields . update ( getattr ( base , '_fields' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# #UNINDENT# for ( key , value ) in attrs . items ( ) : #NEWLINE# #INDENT# if isinstance ( value , Field ) : #NEWLINE# #INDENT# fields [ key ] = ( '_' + key ) #NEWLINE# value . _name = key #NEWLINE# #UNINDENT# #UNINDENT# attrs [ '_fields' ] = value #NEWLINE# attrs [ '_instances' ] = weakref . WeakValueDictionary ( ) #NEWLINE# attrs [ '__slots__' ] = ( list ( attrs . get ( '__slots__' , [ ] ) ) + fields . values ( ) ) #NEWLINE# return super ( _ValidatedImmutableObjectMeta , cls ) . __new__ ( cls , name , bases , attrs )