#NEWLINE# def _validate( self ) : #NEWLINE# #INDENT# '\n        Ensure that our expression string has variables of the form x_0, x_1,\n        ... x_(N - 1), where N is the length of our inputs.\n        ' #NEWLINE# ( variable_names , _unused ) = getExprNames ( self . _expr , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# expr_indices = [ ] #NEWLINE# for name in variable_names : #NEWLINE# #INDENT# if ( name == 'inf' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# match = _VARIABLE_NAME_RE . match ( name ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# raise ValueError ( ( '%r is not a valid variable name' % name ) ) #NEWLINE# #UNINDENT# expr_indices . append ( int ( match . group ( 2 ) ) ) #NEWLINE# #UNINDENT# expr_indices . sort ( ) #NEWLINE# expected_indices = list ( range ( len ( self . inputs ) ) ) #NEWLINE# if ( _unused != expected_indices ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Expected %s for variable indices, but got %s' % ( expected_indices , expr_indices ) ) ) #NEWLINE# #UNINDENT# super ( NumericalExpression , self ) . _validate ( )