code: def _set_direct_mode(self, enable_direct_mode=True):
      """Switch to direct or indirect mode
  
      WARNING!  To be used only for internal development purposes.
                We no longer support direct mode and thus setting it in a
                repository would render it unusable for DataLad
  
      Parameters
      ----------
      enable_direct_mode: bool
          True means switch to direct mode,
          False switches to indirect mode
  
      Raises
      ------
      CommandNotAvailableError
          in case you try to switch to indirect mode on a crippled filesystem
      """
      if self.is_crippled_fs() and not enable_direct_mode:
          # TODO: ?? DIRECT - should we call git annex upgrade?
          raise CommandNotAvailableError(
              cmd="git-annex indirect",
              msg="Can't switch to indirect mode on that filesystem.",
          )
  
      self.call_annex(["direct" if enable_direct_mode else "indirect"]),
      self.config.reload()
  
      # For paranoid we will just re-request
      self._direct_mode = None
      assert self.is_direct_mode() == enable_direct_mode
  
imports: from unittest.mock import patch
  from datalad.support import path
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.exceptions import CommandNotAvailableError, DirectModeNoLongerSupportedError
  from datalad.tests.utils_pytest import SkipTest, assert_in, assert_raises, with_tempfile
label_desc: Use image node_id 1 for calling a global function with example usage: _set_direct_mode(enable_direct_mode) without return types