Repository navigation
Conversation
A pattern ending in a separator, such as "*/", matches only directories in pathlib and in fsspec's glob. UPath.glob() and rglob() built the fsspec pattern with joinpath(), which drops the trailing separator, so files were returned as well.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A glob pattern ending in a separator matches only directories, in
pathliband in fsspec'sglob.UPath.glob("*/")andUPath.rglob("*/")return files as well:glob()andrglob()build the fsspec pattern withself.joinpath(pattern).path, andjoinpathdrops the trailing separator, so fsspec gets/g/*instead of/g/*/. This re-appends the separator when the pattern is a string that ends with one, inglob()and in both branches ofrglob(). PathLike patterns are unchanged.Tests:
"*/"is added to the sharedtest_globparametrization andtest_rglobis parametrized over"*.txt"and"*/", so every backend is compared against pathlib. Without the change, 22 of the glob tests fail; with it, the suite passes locally (2485 passed, 1184 skipped; GitHub and HTTP tests deselected as their dependencies aren't installed here). black, isort and flake8 at the pre-commit versions pass."**/"also returns only directories now on memory and local paths, but it isn't added to the shared tests: for zip and tar, fsspec's archiveglob("**/")doesn't include the archive root, which pathlib does, and that's unrelated to this change.