#NEWLINE# def __init__( cls , class_name , bases , attrs ) : #NEWLINE# #INDENT# if ( not hasattr ( cls , 'registry' ) ) : #NEWLINE# #INDENT# cls . registry = OrderedDict ( ) #NEWLINE# cls . decl_root = cls #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# decl_bases = set ( ( base . decl_root for base in bases if ( hasattr ( base , 'decl_root' ) and ( base is not base . decl_root ) ) ) ) #NEWLINE# if ( len ( decl_bases ) > 1 ) : #NEWLINE# #INDENT# raise TypeError ( 'When multiply-inheriting graph elements, they must share the same declarative base class. Note: Each call to declarative_*() returns a new base class.' ) #NEWLINE# #UNINDENT# if ( cls . decl_type is DeclarativeType . Vertex ) : #NEWLINE# #INDENT# cls . registry_name = attrs . get ( 'element_type' , cls . __name__ . lower ( ) ) #NEWLINE# plural = attrs . get ( 'element_plural' ) #NEWLINE# if plural : #NEWLINE# #INDENT# cls . registry_plural = plural #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# label = attrs . get ( 'label' ) #NEWLINE# if label : #NEWLINE# #INDENT# cls . registry_name = cls . registry_plural = label #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cls . registry_name = cls . __name__ . lower ( ) #NEWLINE# #UNINDENT# #UNINDENT# for prop in cls . __dict__ . values ( ) : #NEWLINE# #INDENT# if ( not isinstance ( label , Property ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# prop . _context = cls #NEWLINE# #UNINDENT# cls . registry [ cls . registry_name ] = cls #NEWLINE# #UNINDENT# return super ( DeclarativeMeta , cls ) . __init__ ( class_name , bases , attrs )