parameters: (self, enums)
return_statement: return stripped
docstring: Check enumerated values for duplicates.
  
          -  enums - list of `<enum>` Elements
  
          returns the list with duplicates stripped
docstring_summary: Check enumerated values for duplicates.
docstring_tokens: Check enumerated values for duplicates .
function: def checkDuplicateEnums(self, enums):
          """Check enumerated values for duplicates.
  
          -  enums - list of `<enum>` Elements
  
          returns the list with duplicates stripped"""
          # Dictionaries indexed by name and numeric value.
          # Entries are [ Element, numVal, strVal ] matching name or value
  
          nameMap = {}
          valueMap = {}
  
          stripped = []
          for elem in enums:
              name = elem.get('name')
              (numVal, strVal) = self.enumToValue(elem, True)
  
              if name in nameMap:
                  # Duplicate name found; check values
                  (name2, numVal2, strVal2) = nameMap[name]
  
                  # Duplicate enum values for the same name are benign. This
                  # happens when defining the same enum conditionally in
                  # several extension blocks.
                  if (strVal2 == strVal or (numVal is not None
                                            and numVal == numVal2)):
                      True
                      # self.logMsg('info', 'checkDuplicateEnums: Duplicate enum (' + name +
                      #             ') found with the same value:' + strVal)
                  else:
                      self.logMsg('warn', 'checkDuplicateEnums: Duplicate enum (' + name
                                  + ') found with different values:' + strVal
                                  + ' and ' + strVal2)
  
                  # Don't add the duplicate to the returned list
                  continue
              elif numVal in valueMap:
                  # Duplicate value found (such as an alias); report it, but
                  # still add this enum to the list.
                  (name2, numVal2, strVal2) = valueMap[numVal]
  
                  msg = 'Two enums found with the same value: {} = {} = {}'.format(
                      name, name2.get('name'), strVal)
                  self.logMsg('error', msg)
  
              # Track this enum to detect followon duplicates
              nameMap[name] = [elem, numVal, strVal]
              if numVal is not None:
                  valueMap[numVal] = [elem, numVal, strVal]
  
              # Add this enum to the list
              stripped.append(elem)
  
          # Return the list
          return stripped
function_tokens: def checkDuplicateEnums ( self , enums ) : # Dictionaries indexed by name and numeric value. # Entries are [ Element, numVal, strVal ] matching name or value nameMap = { } valueMap = { } stripped = [ ] for elem in enums : name = elem . get ( 'name' ) ( numVal , strVal ) = self . enumToValue ( elem , True ) if name in nameMap : # Duplicate name found; check values ( name2 , numVal2 , strVal2 ) = nameMap [ name ] # Duplicate enum values for the same name are benign. This # happens when defining the same enum conditionally in # several extension blocks. if ( strVal2 == strVal or ( numVal is not None and numVal == numVal2 ) ) : True # self.logMsg('info', 'checkDuplicateEnums: Duplicate enum (' + name + #             ') found with the same value:' + strVal) else : self . logMsg ( 'warn' , 'checkDuplicateEnums: Duplicate enum (' + name + ') found with different values:' + strVal + ' and ' + strVal2 ) # Don't add the duplicate to the returned list continue elif numVal in valueMap : # Duplicate value found (such as an alias); report it, but # still add this enum to the list. ( name2 , numVal2 , strVal2 ) = valueMap [ numVal ] msg = 'Two enums found with the same value: {} = {} = {}' . format ( name , name2 . get ( 'name' ) , strVal ) self . logMsg ( 'error' , msg ) # Track this enum to detect followon duplicates nameMap [ name ] = [ elem , numVal , strVal ] if numVal is not None : valueMap [ numVal ] = [ elem , numVal , strVal ] # Add this enum to the list stripped . append ( elem ) # Return the list return stripped