tools/metrics/actions/action_utils.py
def _CreateActionToSuffixesDict(action_suffix_nodes):
  """Creates a dict of action name to list of Suffix objects for that action.

  Args:
    action_suffix_nodes: a list of action-suffix nodes

  Returns:
    A dictionary of action name to list of Suffix objects for that action.
  """
  action_to_suffixes_dict = {}
  for action_suffix_node in action_suffix_nodes:
    separator = _GetAttribute(action_suffix_node, 'separator', '_')
    ordering = _GetAttribute(action_suffix_node, 'ordering', 'suffix')
    suffixes = [Suffix(suffix_node.getAttribute('name'),
                       suffix_node.getAttribute('label'),
                       separator, ordering) for suffix_node in
                action_suffix_node.getElementsByTagName('suffix')]

    action_nodes = action_suffix_node.getElementsByTagName('affected-action')
    for action_node in action_nodes:
      action_name = action_node.getAttribute('name')
      # If <affected-action> has <with-suffix> child nodes, only those suffixes
      # should be used with that action. filter the list of suffix names if so.
      action_suffix_names = [suffix_node.getAttribute('name') for suffix_node in
                             action_node.getElementsByTagName('with-suffix')]
      if action_suffix_names:
        action_suffixes = [suffix for suffix in suffixes if suffix.name in
                           action_suffix_names]
      else:
        action_suffixes = list(suffixes)

      if action_name in action_to_suffixes_dict:
        action_to_suffixes_dict[action_name] += action_suffixes
      else:
        action_to_suffixes_dict[action_name] = action_suffixes

  return action_to_suffixes_dict
Creates a dict of action name to list of Suffix objects for that action.

  Args:
    action_suffix_nodes: a list of action-suffix nodes

  Returns:
    A dictionary of action name to list of Suffix objects for that action.
  
Creates a dict of action name to list of Suffix objects for that action.
Creates a dict of action name to list of Suffix objects for that action .
def _CreateActionToSuffixesDict(action_suffix_nodes):
  action_to_suffixes_dict = {}
  for action_suffix_node in action_suffix_nodes:
    separator = _GetAttribute(action_suffix_node, 'separator', '_')
    ordering = _GetAttribute(action_suffix_node, 'ordering', 'suffix')
    suffixes = [Suffix(suffix_node.getAttribute('name'),
                       suffix_node.getAttribute('label'),
                       separator, ordering) for suffix_node in
                action_suffix_node.getElementsByTagName('suffix')]
    action_nodes = action_suffix_node.getElementsByTagName('affected-action')
    for action_node in action_nodes:
      action_name = action_node.getAttribute('name')
      action_suffix_names = [suffix_node.getAttribute('name') for suffix_node in
                             action_node.getElementsByTagName('with-suffix')]
      if action_suffix_names:
        action_suffixes = [suffix for suffix in suffixes if suffix.name in
                           action_suffix_names]
      else:
        action_suffixes = list(suffixes)
      if action_name in action_to_suffixes_dict:
        action_to_suffixes_dict[action_name] += action_suffixes
      else:
        action_to_suffixes_dict[action_name] = action_suffixes
  return action_to_suffixes_dict
def _CreateActionToSuffixesDict ( action_suffix_nodes ) : action_to_suffixes_dict = { } for action_suffix_node in action_suffix_nodes : separator = _GetAttribute ( action_suffix_node , 'separator' , '_' ) ordering = _GetAttribute ( action_suffix_node , 'ordering' , 'suffix' ) suffixes = [ Suffix ( suffix_node . getAttribute ( 'name' ) , suffix_node . getAttribute ( 'label' ) , separator , ordering ) for suffix_node in action_suffix_node . getElementsByTagName ( 'suffix' ) ] action_nodes = action_suffix_node . getElementsByTagName ( 'affected-action' ) for action_node in action_nodes : action_name = action_node . getAttribute ( 'name' ) action_suffix_names = [ suffix_node . getAttribute ( 'name' ) for suffix_node in action_node . getElementsByTagName ( 'with-suffix' ) ] if action_suffix_names : action_suffixes = [ suffix for suffix in suffixes if suffix . name in action_suffix_names ] else : action_suffixes = list ( suffixes ) if action_name in action_to_suffixes_dict : action_to_suffixes_dict [ action_name ] += action_suffixes else : action_to_suffixes_dict [ action_name ] = action_suffixes return action_to_suffixes_dict
Creates a dict of action name to list of Suffix objects for that action.
Creates a dict of action name to list of Suffix objects for that action .
"""Creates a dict of action name to list of Suffix objects for that action.

  Args:
    action_suffix_nodes: a list of action-suffix nodes

  Returns:
    A dictionary of action name to list of Suffix objects for that action.
  """ # If <affected-action> has <with-suffix> child nodes, only those suffixes # should be used with that action. filter the list of suffix names if so.
A dictionary of action name to list of Suffix objects for that action.
A dictionary of action name to list of Suffix objects for that action .
action_suffix_nodes
a list of action-suffix nodes
a list of action - suffix nodes