gh-99547: Add isjunction methods for checking if a path is a junction (GH-99548)

This commit is contained in:
Charles Machalow 2022-11-22 09:19:34 -08:00 committed by GitHub
parent c2102136be
commit 1b2de89bce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 182 additions and 24 deletions

View file

@ -35,7 +35,7 @@ __all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"samefile","sameopenfile","samestat",
"curdir","pardir","sep","pathsep","defpath","altsep","extsep",
"devnull","realpath","supports_unicode_filenames","relpath",
"commonpath"]
"commonpath", "isjunction"]
def _get_sep(path):
@ -169,6 +169,16 @@ def islink(path):
return False
return stat.S_ISLNK(st.st_mode)
# Is a path a junction?
def isjunction(path):
"""Test whether a path is a junction
Junctions are not a part of posix semantics"""
os.fspath(path)
return False
# Being true for dangling symbolic links is also useful.
def lexists(path):