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","."]
docstr: Set the doctree versioning method for this environment.
  
  Versioning methods are a builder property; only builders with the same
  versioning method can share the same doctree directory.  Therefore, we
  raise an exception if the user tries to use an environment with an
  incompatible versioning method.
code: def set_versioning_method(
      self, method: str | Callable, compare: bool
  ) -> None:
      """Set the doctree versioning method for this environment.
  
      Versioning methods are a builder property; only builders with the same
      versioning method can share the same doctree directory.  Therefore, we
      raise an exception if the user tries to use an environment with an
      incompatible versioning method.
      """
      condition: bool | Callable
      if callable(method):
          condition = method
      else:
          if method not in versioning_conditions:
              raise ValueError("invalid versioning method: %r" % method)
          condition = versioning_conditions[method]
  
      if self.versioning_condition not in (None, condition):
          raise SphinxError(
              __(
                  "This environment is incompatible with the "
                  "selected builder, please choose another "
                  "doctree directory."
              )
          )
      self.versioning_condition = condition
      self.versioning_compare = compare
  
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 7 for calling the BuildEnvironment obj's underlying member method code with example usage: obj.set_versioning_method(method, compare) without return types