os.path etc: update for py313 (#11965)

This commit is contained in:
Shantanu
2024-05-18 14:57:44 -07:00
committed by GitHub
parent 2756f16a11
commit 87edeb65d8
3 changed files with 20 additions and 1 deletions

View File

@@ -20,6 +20,8 @@ __all__ = [
]
if sys.version_info >= (3, 12):
__all__ += ["islink"]
if sys.version_info >= (3, 13):
__all__ += ["isjunction", "isdevdrive", "lexists"]
# All overloads can return empty string. Ideally, Literal[""] would be a valid
# Iterable[T], so that list[T] | Literal[""] could be used as a return
@@ -50,3 +52,8 @@ def getctime(filename: FileDescriptorOrPath) -> float: ...
def samefile(f1: FileDescriptorOrPath, f2: FileDescriptorOrPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...
if sys.version_info >= (3, 13):
def isjunction(path: StrOrBytesPath) -> bool: ...
def isdevdrive(path: StrOrBytesPath) -> bool: ...
def lexists(path: StrOrBytesPath) -> bool: ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import BytesPath, StrPath
from _typeshed import BytesPath, StrOrBytesPath, StrPath
from genericpath import (
commonprefix as commonprefix,
exists as exists,
@@ -47,6 +47,8 @@ from typing_extensions import LiteralString
if sys.version_info >= (3, 12):
from posixpath import isjunction as isjunction, splitroot as splitroot
if sys.version_info >= (3, 13):
from genericpath import isdevdrive as isdevdrive
__all__ = [
"normcase",
@@ -90,6 +92,8 @@ __all__ = [
]
if sys.version_info >= (3, 12):
__all__ += ["isjunction", "splitroot"]
if sys.version_info >= (3, 13):
__all__ += ["isdevdrive", "isreserved"]
altsep: LiteralString
@@ -117,3 +121,6 @@ if sys.platform == "win32":
else:
realpath = abspath
if sys.version_info >= (3, 13):
def isreserved(path: StrOrBytesPath) -> bool: ...

View File

@@ -14,6 +14,9 @@ from genericpath import (
sameopenfile as sameopenfile,
samestat as samestat,
)
if sys.version_info >= (3, 13):
from genericpath import isdevdrive as isdevdrive
from os import PathLike
from typing import AnyStr, overload
from typing_extensions import LiteralString
@@ -60,6 +63,8 @@ __all__ = [
]
if sys.version_info >= (3, 12):
__all__ += ["isjunction", "splitroot"]
if sys.version_info >= (3, 13):
__all__ += ["isdevdrive"]
supports_unicode_filenames: bool
# aliases (also in os)