code: def validate_complete_sphinx(path_to_botorch: str) -> None:
      """Validate that Sphinx-based API documentation is complete.
  
      - Every top-level module (e.g., acquisition, models, etc.) should have a
          corresponding .rst sphix source file in sphinx/source.
      - Every single non-package (i.e. py file) module should be included in an
          .rst file `automodule::` directive. Sphinx will then automatically
          include all members from the module in the documentation.
  
      Note: this function does not validate any documentation, only its presence.
  
      Args:
          path_to_botorch: the path to the top-level botorch directory (directory
              that includes botorch library, sphinx, website, etc.).
      """
      # Load top-level modules used in botorch (e.g., acquisition, models)
      # Exclude auxiliary packages
      modules = {
          modname
          for importer, modname, ispkg in pkgutil.walk_packages(
              path=[BOTORCH_LIBRARY_PATH], onerror=lambda x: None
          )
          if modname not in EXCLUDED_MODULES
      }
  
      # Load all rst files (these contain the documentation for Sphinx)
      rstpath = os.path.join(path_to_botorch, SPHINX_RST_PATH)
      rsts = {
          f.replace(".rst", "")
          for f in os.listdir(rstpath)
          if f.endswith(".rst")
      }
  
      # Verify that all top-level modules have a corresponding rst
      missing_rsts = modules.difference(rsts)
      if not len(missing_rsts) == 0:
          raise RuntimeError(
              f"""Not all modules have corresponding rst:
              {missing_rsts}
              Please add them to the appropriate rst file in {SPHINX_RST_PATH}.
              """
          )
  
      # Track all modules that are not in docs (so can print all)
      modules_not_in_docs = []
  
      # Iterate over top-level modules
      for module in modules.intersection(rsts):
          # Parse rst & extract all modules use automodule directive
          modules_in_rst = parse_rst(
              os.path.join(rstpath, module + ".rst")
          )
  
          # Extract all non-package modules
          for _importer, modname, ispkg in pkgutil.walk_packages(
              path=[
                  os.path.join(BOTORCH_LIBRARY_PATH, module)
              ],  # botorch.__path__[0], module),
              prefix="botorch." + module + ".",
              onerror=lambda x: None,
          ):
              if (
                  not ispkg
                  and ".tests" not in modname
                  and modname not in modules_in_rst
              ):
                  modules_not_in_docs.append(modname)
  
      if not len(modules_not_in_docs) == 0:
          raise RuntimeError(
              f"Not all modules are documented: {modules_not_in_docs}"
          )
  
file_path: botorch/scripts/validate_sphinx.py
imports: from __future__ import annotations
  import argparse
  import os
  import pkgutil
  import re
  from typing import Set
label_desc: Use image node_id 2 for calling a global function with example usage: validate_complete_sphinx(path_to_botorch) without return types