code: def find_names(module, names_dict):
      # Refguide entries:
      #
      # - 3 spaces followed by function name, and maybe some spaces, some
      #   dashes, and an explanation; only function names listed in
      #   refguide are formatted like this (mostly, there may be some false
      #   positives)
      #
      # - special directives, such as data and function
      #
      # - (scipy.constants only): quoted list
      #
      patterns = [
          r"^\s\s\s([a-z_0-9A-Z]+)(\s+-+.*)?$",
          r"^\.\. (?:data|function)::\s*([a-z_0-9A-Z]+)\s*$",
      ]
  
      if module.__name__ == "scipy.constants":
          patterns += ["^``([a-z_0-9A-Z]+)``"]
  
      patterns = [re.compile(pattern) for pattern in patterns]
      module_name = module.__name__
  
      for line in module.__doc__.splitlines():
          res = re.search(
              r"^\s*\.\. (?:currentmodule|module):: ([a-z0-9A-Z_.]+)\s*$",
              line,
          )
          if res:
              module_name = res.group(1)
              continue
  
          for pattern in patterns:
              res = re.match(pattern, line)
              if res is not None:
                  name = res.group(1)
                  names_dict.setdefault(module_name, set()).add(name)
                  break
  
imports: import copy
  import doctest
  import glob
  import inspect
  import io
  import os
  import re
  import shutil
  import sys
  import tempfile
  import warnings
  from argparse import ArgumentParser
  from contextlib import contextmanager, redirect_stderr
  from doctest import NORMALIZE_WHITESPACE, ELLIPSIS, IGNORE_EXCEPTION_DETAIL
  import docutils.core
  import numpy
  from docutils.parsers.rst import directives
  from numpydoc.docscrape_sphinx import get_doc_object
  from numpydoc.docscrape import NumpyDocString
  from scipy.stats._distr_params import distcont, distdiscrete
  from scipy import stats
  from sphinx.directives.other import SeeAlso, Only
label_desc: Use image node_id 2 for calling a global function with example usage: find_names(module, names_dict) without return types