tools/metrics/histograms/populate_enums.py
def PopulateEnumWithUkmEvents(doc, enum, ukm_events):
  """Populates the enum node with a list of ukm events.

  Args:
    doc: The document to create the node in.
    enum: The enum node needed to be populated.
    ukm_events: A list of ukm event nodes.
  """
  event_details = [_GetEventDetails(event) for event in ukm_events]
  event_details.sort(key=lambda event: event.hash)

  for event in event_details:
    node = doc.createElement('int')
    node.attributes['value'] = str(event.hash)
    label = event.name
    # If the event is obsolete, mark it in the int's label.
    if event.is_obsolete:
      label += ' (Obsolete)'
    node.attributes['label'] = label
    enum.appendChild(node)
Populates the enum node with a list of ukm events.

  Args:
    doc: The document to create the node in.
    enum: The enum node needed to be populated.
    ukm_events: A list of ukm event nodes.
  
Populates the enum node with a list of ukm events.
Populates the enum node with a list of ukm events .
def PopulateEnumWithUkmEvents(doc, enum, ukm_events):
  event_details = [_GetEventDetails(event) for event in ukm_events]
  event_details.sort(key=lambda event: event.hash)
  for event in event_details:
    node = doc.createElement('int')
    node.attributes['value'] = str(event.hash)
    label = event.name
    if event.is_obsolete:
      label += ' (Obsolete)'
    node.attributes['label'] = label
    enum.appendChild(node)
def PopulateEnumWithUkmEvents ( doc , enum , ukm_events ) : event_details = [ _GetEventDetails ( event ) for event in ukm_events ] event_details . sort ( key = lambda event : event . hash ) for event in event_details : node = doc . createElement ( 'int' ) node . attributes [ 'value' ] = str ( event . hash ) label = event . name if event . is_obsolete : label += ' (Obsolete)' node . attributes [ 'label' ] = label enum . appendChild ( node )
Populates the enum node with a list of ukm events.
Populates the enum node with a list of ukm events .
"""Populates the enum node with a list of ukm events.

  Args:
    doc: The document to create the node in.
    enum: The enum node needed to be populated.
    ukm_events: A list of ukm event nodes.
  """ # If the event is obsolete, mark it in the int's label.
doc
The document to create the node in.
The document to create the node in .
enum
The enum node needed to be populated.
The enum node needed to be populated .
ukm_events
A list of ukm event nodes.
A list of ukm event nodes .