def prereposetup_hook()

in yum/artifact-registry.py [0:0]


def prereposetup_hook(conduit):
  token = _get_token(conduit)
  if not token:
    return
  for repo in conduit.getRepos().listEnabled():
    # Check if the 'artifact_registry_oauth' option is set in the repository's config.
    if repo.cfg.has_option(repo.id, 'artifact_registry_oauth') and repo.cfg.getboolean(repo.id, 'artifact_registry_oauth'):
      _add_headers(token, repo)
      break  # Stop looking at URLs
    # Check if any repo urls are for Artifact Registry.
    for url in repo.urls:
      parsed_url = urlparse(url)
      if parsed_url.scheme == 'https' and parsed_url.netloc.endswith('.pkg.dev'):
        _add_headers(token, repo)
        break  # Stop looking at URLs