Modify walk(), is_file(), and is_dir() to have the option to follow symlinks - #2
Merged
Conversation
* Add missing dep `typing` Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
* Install the toml extra_requires for setuptools_scm in setup_requires Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
JonoYang
force-pushed
the
visit-symlinks
branch
from
October 20, 2020 21:51
fb837e5 to
49ae11f
Compare
pombredanne
reviewed
Oct 20, 2020
|
|
||
|
|
||
| def is_file(location): | ||
| def is_file(location, allow_symlinks=False): |
Member
There was a problem hiding this comment.
What about using the same name as in the standard lib?
https://docs.python.org/3/library/os.html?highlight=link#os.link
https://docs.python.org/3/library/os.html?highlight=link#follow-symlinks
If
follow_symlinksis False, and the last element of the path to operate on is a symbolic link, the function will operate on the symbolic link itself rather than the file pointed to by the link. (For POSIX systems, Python will call the l... variant of the function.)
Member
Author
There was a problem hiding this comment.
That's a good idea, I'll change it.
* Test that resource_iter can follow symlinks Signed-off-by: Jono Yang <jyang@nexb.com>
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.
This PR modifies walk(), is_file(), and is_dir() to have the option to follow symlinks. This is needed for the situations where we are forced to deal with symlinked files.