uniform handling of path argument gievn as a list of strings or a single string in read mode #964
+11
−10
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.
Issue #957 was solved by PR #961 when path is a list of string but not when path is a string.
This PR solves this problem.
However, it also changes other behaviors. For instance, paths were sorted and filtered with not fs.isdir(f) only in read mode and only if a string was given with a wildcard. i.e. list of paths in read mode was not filtered+sorted. Write mode was not filtered+sorted. A single path without wildcard was not filtered+sorted.
This PR is an improvement imho with a more uniform handling of all these cases. dirs are filtered out in all the case, and sorting is also applied in all the cases. However, I hope this does not break expected behaviors that I'm ignoring.