-
Notifications
You must be signed in to change notification settings - Fork 425
Correct find behaviour with different combinations of arguments for ZipFileSystem
#1976
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
Conversation
martindurant
left a comment
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.
Looking good, just a couple of simple questions.
| raise ValueError("maxdepth must be at least 1") | ||
|
|
||
| def to_parts(_path: str): | ||
| return list(filter(None, _path.replace("\\", "/").split("/"))) |
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.
"\" is a single slash because of escaping - is that the intent?
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.
Yes, '\' needs to be escaped otherwise using r'\' should be equivalent.
fsspec/implementations/zip.py
Outdated
| def _matching_starts(file_path): | ||
| file_parts = filter(lambda s: bool(s), file_path.split("/")) | ||
| return all(a == b for a, b in zip(path_parts, file_parts)) | ||
| path_depth = len(path_parts := to_parts(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.
I find it clearer to write out
| path_depth = len(path_parts := to_parts(path)) | |
| path_parts = to_parts(path) | |
| path_depth = len(path_parts) |
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.
Updated.
Fixes: #1974 #1975