#NEWLINE# def __init__( cls , name , bases , dictionary ) : #NEWLINE# #INDENT# if ( not name . endswith ( 'Base' ) ) : #NEWLINE# #INDENT# assert ( 'kind' in dictionary ) , name #NEWLINE# kind = dictionary [ 'kind' ] #NEWLINE# assert ( type ( kind ) is str ) , name #NEWLINE# assert ( kind not in NodeCheckMetaClass . kinds ) , name #NEWLINE# NodeCheckMetaClass . kinds [ kind ] = cls #NEWLINE# NodeCheckMetaClass . kinds [ name ] = cls #NEWLINE# def convert( value ) : #NEWLINE# #INDENT# if ( value in ( 'AND' , 'OR' , 'NOT' ) ) : #NEWLINE# #INDENT# return value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return value . title ( ) #NEWLINE# #UNINDENT# #UNINDENT# kind_to_name_part = '' . join ( [ convert ( x ) for x in kind . split ( '_' ) ] ) #NEWLINE# assert name . endswith ( kind_to_name_part ) , ( name , kind_to_name_part ) #NEWLINE# checker_method = ( 'is' + kind_to_name_part ) #NEWLINE# def checkKind( self ) : #NEWLINE# #INDENT# return ( self . kind == kind ) #NEWLINE# #UNINDENT# if ( not hasattr ( NodeBase , checker_method ) ) : #NEWLINE# #INDENT# setattr ( NodeBase , checker_method , checkKind ) #NEWLINE# #UNINDENT# #UNINDENT# type . __init__ ( cls , name , bases , dictionary )