code: def __init__(self, path=None, puke_if_exists=True):
      if not path:
          path = tempfile.mktemp(
              **get_tempfile_kwargs(
                  {"dir": dl_cfg.get("datalad.tests.temp.dir")},
                  prefix="testrepo",
              )
          )
          # to be removed upon teardown
          _TEMP_PATHS_GENERATED.append(path)
      if puke_if_exists and exists(path):
          raise RuntimeError(
              "Directory %s for test repo already exist" % path
          )
      # swallow logs so we don't print all those about crippled FS etc
      with swallow_logs():
          self.repo = self.REPO_CLASS(path)
          # For additional testing of our datalad remote to not interfere
          # and manage to handle all http urls and requests:
          if self.REPO_CLASS is AnnexRepo and os.environ.get(
              "DATALAD_TESTS_DATALADREMOTE"
          ):
              init_datalad_remote(self.repo, "datalad", autoenable=True)
  
      self._created = False
  
imports: import os
  import tempfile
  from abc import ABCMeta, abstractmethod
  from os.path import exists
  from os.path import join
  from datalad import cfg
  from datalad.customremotes.base import init_datalad_remote
  from ..None import __version__
  from ..support.annexrepo import AnnexRepo
  from ..support.external_versions import external_versions
  from ..support.gitrepo import GitRepo
  from ..support.network import get_local_file_url
  from ..utils import swallow_logs, swallow_outputs
  from .None import _TEMP_PATHS_GENERATED
  from .utils_pytest import get_tempfile_kwargs
label_desc: Use image node_id 1 to create a new TestRepo object from inherited base classes: object with example: obj = TestRepo(path, puke_if_exists)