def normalize_leaf(element):
 if (not is_leaf(element)):
  return element
 (left, operator, right) = element
 original = operator
 operator = operator.lower()
 if (operator == '<>'):
  operator = '!='
 if (isinstance(right, bool) and (operator in ('in', 'not in'))):
  _logger.warning(("The domain term '%s' should use the '=' or '!=' operator." % ((left, original, right),)))
  operator = ('=' if (operator == 'in') else '!=')
 if (isinstance(right, (list, tuple)) and (operator in ('=', '!='))):
  _logger.warning(("The domain term '%s' should use the 'in' or 'not in' operator." % ((left, original, right),)))
  operator = ('in' if (operator == '=') else 'not in')
 return (left, operator, right)

def normalize_leaf ( element ) : if ( not is_leaf ( element ) ) : return element ( left , operator , right ) = element original = operator operator = operator . lower ( ) if ( operator == '<>' ) : operator = '!=' if ( isinstance ( right , bool ) and ( operator in ( 'in' , 'not in' ) ) ) : _logger . warning ( ( "The domain term '%s' should use the '=' or '!=' operator." % ( ( left , original , right ) , ) ) ) operator = ( '=' if ( operator == 'in' ) else '!=' ) if ( isinstance ( right , ( list , tuple ) ) and ( operator in ( '=' , '!=' ) ) ) : _logger . warning ( ( "The domain term '%s' should use the 'in' or 'not in' operator." % ( ( left , original , right ) , ) ) ) operator = ( 'in' if ( operator == '=' ) else 'not in' ) return ( left , operator , right )
change a terms operator to some canonical form .