tools/metrics/histograms/expand_owners.py
def _MakeOwners(document, path, emails_with_dom_elements):
  """Makes DOM Elements for owners and returns the elements.

  The owners are extracted from the OWNERS file with the given path and
  deduped using the given set emails_with_dom_elements. This set has email
  addresses that were explicitly listed as histogram owners, e.g.
  <owner>liz@chromium.org</owner>. If a histogram has multiple OWNERS file
  paths, e.g. <owner>src/cc/OWNERS</owner> and <owner>src/ui/OWNERS</owner>,
  then the given set also contains any email addresses that have already been
  extracted from OWNERS files.

  New owners that are extracted from the given file are also added to
  emails_with_dom_elements.

  Args:
    document: The Document to which the new owners elements will belong.
    path: The absolute path to an OWNERS file.
    emails_with_dom_elements: The set of email addresses that already have
      corresponding DOM Elements.

  Returns:
    A collection of DOM Elements made from owners in the given OWNERS file.
  """
  owner_elements = []
  # TODO(crbug.com/987709): An OWNERS file API would be ideal.
  emails_from_owners_file = _ExtractEmailAddressesFromOWNERS(path)
  if not emails_from_owners_file:
    raise Error('No emails could be derived from {}.'.format(path))

  # A list is used to respect the order of email addresses in the OWNERS file.
  deduped_emails_from_owners_file = []
  for email in emails_from_owners_file:
    if email not in emails_with_dom_elements:
      deduped_emails_from_owners_file.append(email)
      emails_with_dom_elements.add(email)

  for email in deduped_emails_from_owners_file:
    owner_element = document.createElement('owner')
    owner_element.appendChild(document.createTextNode(email))
    owner_elements.append(owner_element)
  return owner_elements
Makes DOM Elements for owners and returns the elements.

  The owners are extracted from the OWNERS file with the given path and
  deduped using the given set emails_with_dom_elements. This set has email
  addresses that were explicitly listed as histogram owners, e.g.
  <owner>liz@chromium.org</owner>. If a histogram has multiple OWNERS file
  paths, e.g. <owner>src/cc/OWNERS</owner> and <owner>src/ui/OWNERS</owner>,
  then the given set also contains any email addresses that have already been
  extracted from OWNERS files.

  New owners that are extracted from the given file are also added to
  emails_with_dom_elements.

  Args:
    document: The Document to which the new owners elements will belong.
    path: The absolute path to an OWNERS file.
    emails_with_dom_elements: The set of email addresses that already have
      corresponding DOM Elements.

  Returns:
    A collection of DOM Elements made from owners in the given OWNERS file.
  
Makes DOM Elements for owners and returns the elements.
The owners are extracted from the OWNERS file with the given path and
deduped using the given set emails_with_dom_elements. This set has email
addresses that were explicitly listed as histogram owners, e.g.

New owners that are extracted from the given file are also added to
emails_with_dom_elements.
Makes DOM Elements for owners and returns the elements . The owners are extracted from the OWNERS file with the given path and deduped using the given set emails_with_dom_elements . This set has email addresses that were explicitly listed as histogram owners e . g . New owners that are extracted from the given file are also added to emails_with_dom_elements .
def _MakeOwners(document, path, emails_with_dom_elements):
  owner_elements = []
  emails_from_owners_file = _ExtractEmailAddressesFromOWNERS(path)
  if not emails_from_owners_file:
    raise Error('No emails could be derived from {}.'.format(path))
  deduped_emails_from_owners_file = []
  for email in emails_from_owners_file:
    if email not in emails_with_dom_elements:
      deduped_emails_from_owners_file.append(email)
      emails_with_dom_elements.add(email)
  for email in deduped_emails_from_owners_file:
    owner_element = document.createElement('owner')
    owner_element.appendChild(document.createTextNode(email))
    owner_elements.append(owner_element)
  return owner_elements
def _MakeOwners ( document , path , emails_with_dom_elements ) : owner_elements = [ ] emails_from_owners_file = _ExtractEmailAddressesFromOWNERS ( path ) if not emails_from_owners_file : raise Error ( 'No emails could be derived from {}.' . format ( path ) ) deduped_emails_from_owners_file = [ ] for email in emails_from_owners_file : if email not in emails_with_dom_elements : deduped_emails_from_owners_file . append ( email ) emails_with_dom_elements . add ( email ) for email in deduped_emails_from_owners_file : owner_element = document . createElement ( 'owner' ) owner_element . appendChild ( document . createTextNode ( email ) ) owner_elements . append ( owner_element ) return owner_elements
Makes DOM Elements for owners and returns the elements.
Makes DOM Elements for owners and returns the elements .
"""Makes DOM Elements for owners and returns the elements.

  The owners are extracted from the OWNERS file with the given path and
  deduped using the given set emails_with_dom_elements. This set has email
  addresses that were explicitly listed as histogram owners, e.g.
  <owner>liz@chromium.org</owner>. If a histogram has multiple OWNERS file
  paths, e.g. <owner>src/cc/OWNERS</owner> and <owner>src/ui/OWNERS</owner>,
  then the given set also contains any email addresses that have already been
  extracted from OWNERS files.

  New owners that are extracted from the given file are also added to
  emails_with_dom_elements.

  Args:
    document: The Document to which the new owners elements will belong.
    path: The absolute path to an OWNERS file.
    emails_with_dom_elements: The set of email addresses that already have
      corresponding DOM Elements.

  Returns:
    A collection of DOM Elements made from owners in the given OWNERS file.
  """ # TODO(crbug.com/987709): An OWNERS file API would be ideal. # A list is used to respect the order of email addresses in the OWNERS file.
A collection of DOM Elements made from owners in the given OWNERS file.
A collection of DOM Elements made from owners in the given OWNERS file .
document
The Document to which the new owners elements will belong.
The Document to which the new owners elements will belong .
path
The absolute path to an OWNERS file.
The absolute path to an OWNERS file .
emails_with_dom_elements
The set of email addresses that already have
corresponding DOM Elements.
The set of email addresses that already have corresponding DOM Elements .