(self, path, detail=True, dvc_only=False, **kwargs)
| 376 | return False |
| 377 | |
| 378 | def ls(self, path, detail=True, dvc_only=False, **kwargs): # noqa: C901, PLR0912 |
| 379 | key = self._get_key_from_relative(path) |
| 380 | repo, dvc_fs, subkey = self._get_subrepo_info(key) |
| 381 | |
| 382 | dvc_infos = {} |
| 383 | dvc_info = {} |
| 384 | if dvc_fs: |
| 385 | dvc_path = _get_dvc_path(dvc_fs, subkey) |
| 386 | with suppress(FileNotFoundError): |
| 387 | dvc_info = dvc_fs.info(dvc_path) |
| 388 | if dvc_info["type"] == "file": |
| 389 | dvc_infos[""] = dvc_info |
| 390 | else: |
| 391 | for info in dvc_fs.ls(dvc_path, detail=True): |
| 392 | dvc_infos[dvc_fs.name(info["name"])] = info |
| 393 | |
| 394 | fs_infos = {} |
| 395 | fs_info = {} |
| 396 | ignore_subrepos = kwargs.get("ignore_subrepos", True) |
| 397 | if not dvc_only: |
| 398 | fs = self.repo.fs |
| 399 | fs_path = self._from_key(key) |
| 400 | try: |
| 401 | fs_info = fs.info(fs_path) |
| 402 | if fs_info["type"] == "file": |
| 403 | fs_infos[""] = fs_info |
| 404 | else: |
| 405 | for info in repo.dvcignore.ls( |
| 406 | fs, fs_path, detail=True, ignore_subrepos=ignore_subrepos |
| 407 | ): |
| 408 | fs_infos[fs.name(info["name"])] = info |
| 409 | except (FileNotFoundError, NotADirectoryError): |
| 410 | pass |
| 411 | |
| 412 | if not (fs_info or dvc_info): |
| 413 | # broken symlink or TreeError |
| 414 | raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) |
| 415 | |
| 416 | if fs_info and dvc_info and dvc_info["type"] != fs_info["type"]: |
| 417 | dvc_infos.clear() # invalidate dvc_info if file type differs |
| 418 | |
| 419 | dvcfiles = kwargs.get("dvcfiles", False) |
| 420 | |
| 421 | infos = [] |
| 422 | paths = [] |
| 423 | names = set(dvc_infos.keys()) | set(fs_infos.keys()) |
| 424 | |
| 425 | for name in names: |
| 426 | if not dvcfiles and _is_dvc_file(name): |
| 427 | continue |
| 428 | |
| 429 | entry_path = self.join(path, name) if name else path |
| 430 | info = _merge_info( |
| 431 | repo, (*subkey, name), fs_infos.get(name), dvc_infos.get(name) |
| 432 | ) |
| 433 | info["name"] = entry_path |
| 434 | infos.append(info) |
| 435 | paths.append(entry_path) |
no test coverage detected