code: def test_ls_broken_dir(tmp_dir, dvc, M):
      from dvc_data.index import DataIndexDirError
  
      tmp_dir.dvc_gen(
          {
              "broken": {"baz": "baz"},
          }
      )
  
      shutil.rmtree(tmp_dir / "broken")
      dvc.cache.local.clear()
  
      tmp_dir.dvc_gen(
          {
              "foo": "foo",
              "dir": {"bar": "bar"},
          }
      )
  
      entries = Repo.ls(os.fspath(tmp_dir))
      assert entries == [
          {
              "isdir": False,
              "isexec": False,
              "isout": False,
              "path": ".dvcignore",
              "size": M.instance_of(int),
          },
          {
              "isdir": True,
              "isexec": False,
              "isout": True,
              "path": "broken",
              "size": 3,
          },
          {
              "isdir": False,
              "isexec": False,
              "isout": False,
              "path": "broken.dvc",
              "size": M.instance_of(int),
          },
          {
              "isdir": True,
              "isexec": False,
              "isout": True,
              "path": "dir",
              "size": M.instance_of(int),
          },
          {
              "isdir": False,
              "isexec": False,
              "isout": False,
              "path": "dir.dvc",
              "size": M.instance_of(int),
          },
          {
              "isdir": False,
              "isexec": False,
              "isout": True,
              "path": "foo",
              "size": 3,
          },
          {
              "isdir": False,
              "isexec": False,
              "isout": False,
              "path": "foo.dvc",
              "size": M.instance_of(int),
          },
      ]
  
      with pytest.raises(DataIndexDirError):
          Repo.ls(os.fspath(tmp_dir), "broken")
  
      with pytest.raises(DataIndexDirError):
          Repo.ls(os.fspath(tmp_dir), recursive=True)
  
imports: import os
  import shutil
  import textwrap
  from operator import itemgetter
  import pytest
  from dvc.repo import Repo
  from dvc.scm import CloneError
label_desc: Use image node_id 33 for calling a global function with example usage: test_ls_broken_dir(tmp_dir, dvc, M) without return types