testing/libfuzzer/gen_fuzzer_owners.py
def GetOwnersIfThirdParty(source):
  """Return owners using the closest OWNERS file if in third_party."""
  match_index = source.find(THIRD_PARTY_SEARCH_STRING)
  if match_index == -1:
    # Not in third_party, skip.
    return None

  path_prefix = source[:match_index + len(THIRD_PARTY_SEARCH_STRING)]
  path_after_third_party = source[len(path_prefix):].split(os.path.sep)

  # Test all the paths after third_party/<libname>, making sure that we don't
  # test third_party/OWNERS itself, otherwise we'd default to CCing them for
  # all fuzzer issues without OWNERS, which wouldn't be nice.
  while path_after_third_party:
    owners_file_path = path_prefix + \
        os.path.join(*(path_after_third_party + [OWNERS_FILENAME]))

    if os.path.exists(owners_file_path):
      return open(owners_file_path).read()

    path_after_third_party.pop()

  return None
Return owners using the closest OWNERS file if in third_party.
Return owners using the closest OWNERS file if in third_party.
Return owners using the closest OWNERS file if in third_party .
def GetOwnersIfThirdParty(source):
  match_index = source.find(THIRD_PARTY_SEARCH_STRING)
  if match_index == -1:
    return None
  path_prefix = source[:match_index + len(THIRD_PARTY_SEARCH_STRING)]
  path_after_third_party = source[len(path_prefix):].split(os.path.sep)
  while path_after_third_party:
    owners_file_path = path_prefix + \
        os.path.join(*(path_after_third_party + [OWNERS_FILENAME]))
    if os.path.exists(owners_file_path):
      return open(owners_file_path).read()
    path_after_third_party.pop()
  return None
def GetOwnersIfThirdParty ( source ) : match_index = source . find ( THIRD_PARTY_SEARCH_STRING ) if match_index == - 1 : return None path_prefix = source [ : match_index + len ( THIRD_PARTY_SEARCH_STRING ) ] path_after_third_party = source [ len ( path_prefix ) : ] . split ( os . path . sep ) while path_after_third_party : owners_file_path = path_prefix + os . path . join ( * ( path_after_third_party + [ OWNERS_FILENAME ] ) ) if os . path . exists ( owners_file_path ) : return open ( owners_file_path ) . read ( ) path_after_third_party . pop ( ) return None
Return owners using the closest OWNERS file if in third_party.
Return owners using the closest OWNERS file if in third_party .
"""Return owners using the closest OWNERS file if in third_party.""" # Not in third_party, skip. # Test all the paths after third_party/<libname>, making sure that we don't # test third_party/OWNERS itself, otherwise we'd default to CCing them for # all fuzzer issues without OWNERS, which wouldn't be nice.
source