code: def ls(self, path, detail=True, dvc_only=False, **kwargs):
      key = self._get_key_from_relative(path)
      repo, dvc_fs, subkey = self._get_subrepo_info(key)
  
      dvc_exists = False
      dvc_infos = {}
      if dvc_fs:
          dvc_path = _get_dvc_path(dvc_fs, subkey)
          with suppress(FileNotFoundError, NotADirectoryError):
              for info in dvc_fs.ls(dvc_path, detail=True):
                  dvc_infos[dvc_fs.name(info["name"])] = info
              dvc_exists = True
  
      fs_exists = False
      fs_infos = {}
      ignore_subrepos = kwargs.get("ignore_subrepos", True)
      if not dvc_only:
          fs = self.repo.fs
          fs_path = self._from_key(key)
          try:
              for info in repo.dvcignore.ls(
                  fs,
                  fs_path,
                  detail=True,
                  ignore_subrepos=ignore_subrepos,
              ):
                  fs_infos[fs.name(info["name"])] = info
              fs_exists = True
          except (FileNotFoundError, NotADirectoryError):
              pass
  
      if not (dvc_exists or fs_exists):
          # broken symlink or TreeError
          raise FileNotFoundError(
              errno.ENOENT, os.strerror(errno.ENOENT), path
          )
  
      dvcfiles = kwargs.get("dvcfiles", False)
  
      infos = []
      paths = []
      names = set(dvc_infos.keys()) | set(fs_infos.keys())
  
      for name in names:
          if not dvcfiles and _is_dvc_file(name):
              continue
  
          entry_path = self.join(path, name)
          info = _merge_info(
              repo,
              (*subkey, name),
              fs_infos.get(name),
              dvc_infos.get(name),
          )
          info["name"] = entry_path
          infos.append(info)
          paths.append(entry_path)
  
      if not detail:
          return paths
  
      return infos
  
imports: import errno
  import functools
  import ntpath
  import os
  import posixpath
  import threading
  from collections import deque
  from contextlib import ExitStack, suppress
  from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Type, Union
  from fsspec.spec import AbstractFileSystem
  from funcy import wrap_with
  from dvc.log import logger
  from dvc_objects.fs.base import FileSystem
  from .data import DataFileSystem
label_desc: Use image node_id 25 for calling the _DVCFileSystem obj's underlying member method code with example usage: obj.ls(path, detail, dvc_only) and returns: infos, paths