class_docstr: The environment in which the ReST files are translated.
  Stores an inventory of cross-file targets and provides doctree
  transformations to resolve links to them.
class_docstr_tok: ["The","environment","in","which","the","ReST","files","are","translated",".","Stores","an","inventory","of","cross-file","targets","and","provides","doctree","transformations","to","resolve","links","to","them","."]
code: def __init__(self, app: Sphinx):
      self.app: Sphinx = app
      self.doctreedir: Path = app.doctreedir
      self.srcdir: Path = app.srcdir
      self.config: Config = None  # type: ignore[assignment]
      self.config_status: int = CONFIG_UNSET
      self.config_status_extra: str = ""
      self.events: EventManager = app.events
      self.project: Project = app.project
      self.version: dict[str, int] = app.registry.get_envversion(app)
  
      # the method of doctree versioning; see set_versioning_method
      self.versioning_condition: bool | Callable | None = None
      self.versioning_compare: bool | None = None
  
      # all the registered domains, set by the application
      self.domains = _DomainsType()
  
      # the docutils settings for building
      self.settings: dict[str, Any] = default_settings.copy()
      self.settings["env"] = self
  
      # All "docnames" here are /-separated and relative and exclude
      # the source suffix.
  
      # docname -> time of reading (in integer microseconds)
      # contains all read docnames
      self.all_docs: dict[str, int] = {}
      # docname -> set of dependent file
      # names, relative to documentation root
      self.dependencies: dict[str, set[str]] = defaultdict(set)
      # docname -> set of included file
      # docnames included from other documents
      self.included: dict[str, set[str]] = defaultdict(set)
      # docnames to re-read unconditionally on next build
      self.reread_always: set[str] = set()
  
      # docname -> pickled doctree
      self._pickled_doctree_cache: dict[str, bytes] = {}
  
      # docname -> doctree
      self._write_doc_doctree_cache: dict[str, nodes.document] = {}
  
      # File metadata
      # docname -> dict of metadata items
      self.metadata: dict[str, dict[str, Any]] = defaultdict(dict)
  
      # TOC inventory
      # docname -> title node
      self.titles: dict[str, nodes.title] = {}
      # docname -> title node; only different if
      # set differently with title directive
      self.longtitles: dict[str, nodes.title] = {}
      # docname -> table of contents nodetree
      self.tocs: dict[str, nodes.bullet_list] = {}
      # docname -> number of real entries
      self.toc_num_entries: dict[str, int] = {}
  
      # used to determine when to show the TOC
      # in a sidebar (don't show if it's only one item)
      # docname -> dict of sectionid -> number
      self.toc_secnumbers: dict[str, dict[str, tuple[int, ...]]] = {}
      # docname -> dict of figtype -> dict of figureid -> number
      self.toc_fignumbers: dict[
          str, dict[str, dict[str, tuple[int, ...]]]
      ] = {}
  
      # docname -> list of toctree includefiles
      self.toctree_includes: dict[str, list[str]] = {}
      # docname -> set of files (containing its TOCs) to rebuild too
      self.files_to_rebuild: dict[str, set[str]] = {}
      # docnames that have :glob: toctrees
      self.glob_toctrees: set[str] = set()
      # docnames that have :numbered: toctrees
      self.numbered_toctrees: set[str] = set()
  
      # domain-specific inventories, here to be pickled
      # domainname -> domain-specific dict
      self.domaindata: dict[str, dict] = {}
  
      # these map absolute path -> (docnames, unique filename)
      self.images: FilenameUniqDict = FilenameUniqDict()
      # filename -> (set of docnames, destination)
      self.dlfiles: DownloadFiles = DownloadFiles()
  
      # the original URI for images
      self.original_image_uri: dict[str, str] = {}
  
      # temporary data storage while reading a document
      self.temp_data: dict[str, Any] = {}
      # context for cross-references (e.g. current module or class)
      # this is similar to temp_data, but will for example be copied to
      # attributes of "any" cross references
      self.ref_context: dict[str, Any] = {}
  
      # search index data
  
      # docname -> title
      self._search_index_titles: dict[str, str] = {}
      # docname -> filename
      self._search_index_filenames: dict[str, str] = {}
      # stemmed words -> set(docname)
      self._search_index_mapping: dict[str, set[str]] = {}
      # stemmed words in titles -> set(docname)
      self._search_index_title_mapping: dict[str, set[str]] = {}
      # docname -> all titles in document
      self._search_index_all_titles: dict[
          str, list[tuple[str, str]]
      ] = {}
      # docname -> list(index entry)
      self._search_index_index_entries: dict[
          str, list[tuple[str, str, str]]
      ] = {}
      # objtype -> index
      self._search_index_objtypes: dict[tuple[str, str], int] = {}
      # objtype index -> (domain, type, objname (localized))
      self._search_index_objnames: dict[int, tuple[str, str, str]] = {}
  
      # set up environment
      self.setup(app)
  
imports: from __future__ import annotations
  import functools
  import os
  import pickle
  import time
  from collections import defaultdict
  from copy import copy
  from os import path
  from typing import TYPE_CHECKING, Any, Callable, NoReturn
  from sphinx import addnodes
  from sphinx.environment.adapters import toctree
  from sphinx.errors import BuildEnvironmentError, DocumentError, ExtensionError, SphinxError
  from sphinx.locale import __
  from sphinx.transforms import SphinxTransformer
  from sphinx.util import DownloadFiles, FilenameUniqDict, logging
  from sphinx.util.docutils import LoggingReporter
  from sphinx.util.i18n import CatalogRepository, docname_to_domain
  from sphinx.util.nodes import is_translatable
  from sphinx.util.osutil import canon_path, os_path
label_desc: Use image node_id 1 to create a new BuildEnvironment object  with example: obj = BuildEnvironment(app)