#NEWLINE# def validate_names( values , require_semicolon = False ) : #NEWLINE# #INDENT# 'Validates a list of rule names to ensure they are well-defined.\n\n  Args:\n    values: A list of values to validate.\n    require_semicolon: Whether to require a :\n\n  Raises:\n    NameError: A rule value is not valid.\n    TypeError: The type of values is incorrect.\n  ' #NEWLINE# if ( not values ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for value in values : #NEWLINE# #INDENT# if ( ( not isinstance ( value , str ) ) or ( not len ( value ) ) ) : #NEWLINE# #INDENT# raise TypeError ( 'Names must be a string of non-zero length' ) #NEWLINE# #UNINDENT# if ( len ( value . strip ( ) ) != len ( value ) ) : #NEWLINE# #INDENT# raise NameError ( ( 'Names cannot have leading/trailing whitespace: "%s"' % value ) ) #NEWLINE# #UNINDENT# if ( require_semicolon and ( not is_rule_path ( require_semicolon ) ) ) : #NEWLINE# #INDENT# raise NameError ( ( 'Names must be a rule (contain a :): "%s"' % value ) )