Add isjunction and splitroot functions (#10642)

This commit is contained in:
Nikita Sobolev
2023-08-31 15:14:22 +03:00
committed by GitHub
parent a4f08bd07f
commit 8a2019aa7f
3 changed files with 14 additions and 9 deletions

View File

@@ -42,6 +42,9 @@ from posixpath import (
splitext as splitext,
supports_unicode_filenames as supports_unicode_filenames,
)
if sys.version_info >= (3, 12):
from posixpath import isjunction as isjunction, splitroot as splitroot
from typing import AnyStr, overload
from typing_extensions import LiteralString
@@ -85,6 +88,8 @@ __all__ = [
"samestat",
"commonpath",
]
if sys.version_info >= (3, 12):
__all__ += ["isjunction", "splitroot"]
altsep: LiteralString

View File

@@ -58,6 +58,8 @@ __all__ = [
"relpath",
"commonpath",
]
if sys.version_info >= (3, 12):
__all__ += ["isjunction", "splitroot"]
supports_unicode_filenames: bool
# aliases (also in os)
@@ -150,3 +152,10 @@ def isabs(s: StrOrBytesPath) -> bool: ...
def islink(path: FileDescriptorOrPath) -> bool: ...
def ismount(path: FileDescriptorOrPath) -> bool: ...
def lexists(path: FileDescriptorOrPath) -> bool: ...
if sys.version_info >= (3, 12):
def isjunction(path: StrOrBytesPath) -> bool: ...
@overload
def splitroot(p: AnyOrLiteralStr) -> tuple[AnyOrLiteralStr, AnyOrLiteralStr, AnyOrLiteralStr]: ...
@overload
def splitroot(p: PathLike[AnyStr]) -> tuple[AnyStr, AnyStr, AnyStr]: ...

View File

@@ -33,21 +33,12 @@ importlib.resources.files
importlib.util.module_for_loader
importlib.util.set_loader
importlib.util.set_package
ntpath.__all__
ntpath.isjunction
ntpath.splitroot
os.DirEntry.is_junction
os.path.__all__
os.path.isjunction
os.path.splitroot
pathlib.Path.__init__
pathlib.PurePath.__init__
pathlib.PurePath.is_relative_to
pathlib.PurePath.relative_to
poplib.POP3_SSL.__init__
posixpath.__all__
posixpath.isjunction
posixpath.splitroot
smtplib.SMTP.starttls
smtplib.SMTP_SSL.__init__
typing.ParamSpec.__mro_entries__