-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps: bump dvc-objects, dvc-data and scmrepo #10280
Conversation
dvc_info = dvc_fs.info(dvc_path) | ||
if dvc_info["type"] == "file": | ||
dvc_infos[""] = dvc_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since fs.ls()
is now expected to return result even if it's a file, we are keeping it in a special ""
(root) key so that we can return result for the file easily.
Later, we check if the type of the path matches in both fs.info()
and dvc_fs.info()
.
If they mismatch (eg: when a path data
is tracked as a file in dvc, but is now a directory in the workspace or vice versa), we invalidate dvc_fs.info()
and then return fs.info()
.
This is the behaviour that we have in the tests.
if fs.isfile(fs_path): | ||
infos[os.path.basename(path)] = fs.info(fs_path) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have switched the if-else
here, since fs.walk()
also returns result for files now.
@@ -459,7 +468,7 @@ def _info( # noqa: C901, PLR0912 | |||
continue | |||
|
|||
if not dvc_info and not fs_info: | |||
raise FileNotFoundError | |||
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to improve error message as we now log the message for dvc ls
.
I had to do that because you'd see an unexpected error
in case of FileNotFoundErrror
.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #10280 +/- ##
==========================================
- Coverage 90.43% 90.42% -0.01%
==========================================
Files 494 494
Lines 37782 37775 -7
Branches 5463 5467 +4
==========================================
- Hits 34167 34157 -10
- Misses 2984 2985 +1
- Partials 631 633 +2 ☔ View full report in Codecov by Sentry. |
* deps: bump dvc-objects, dvc-data and scmrepo * bump dvc-azure * fix typo
Related:
There are two changes in this PR.
TqdmCallback
.fs.ls(file)
to return results instead of raisingNotADirectoryError
.