From a91c89ea94e4d916a800f72b2dfe8fa9201a93b4 Mon Sep 17 00:00:00 2001 From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> Date: Mon, 10 May 2021 22:27:13 -0700 Subject: [PATCH] various path stubs: re-export to reduce duplication (#5382) Co-authored-by: hauntsaninja <> Co-authored-by: Akuli --- stdlib/@python2/os/path.pyi | 2 +- stdlib/genericpath.pyi | 39 +++++++--- stdlib/macpath.pyi | 128 +++++++++++-------------------- stdlib/ntpath.pyi | 147 +++++++++++++++--------------------- stdlib/os/__init__.pyi | 6 +- stdlib/os/path.pyi | 131 +------------------------------- stdlib/posixpath.pyi | 60 +++++++-------- 7 files changed, 164 insertions(+), 349 deletions(-) diff --git a/stdlib/@python2/os/path.pyi b/stdlib/@python2/os/path.pyi index f09642860..c89bc8b69 100644 --- a/stdlib/@python2/os/path.pyi +++ b/stdlib/@python2/os/path.pyi @@ -1,7 +1,6 @@ import os import sys from _typeshed import AnyPath, BytesPath, StrPath -from genericpath import exists as exists from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, overload _T = TypeVar("_T") @@ -40,6 +39,7 @@ else: # Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes # So, fall back to Any def commonprefix(m: Sequence[AnyPath]) -> Any: ... +def exists(path: AnyPath) -> bool: ... def lexists(path: AnyPath) -> bool: ... # These return float if os.stat_float_times() == True, diff --git a/stdlib/genericpath.pyi b/stdlib/genericpath.pyi index 74dc81932..28c94ae16 100644 --- a/stdlib/genericpath.pyi +++ b/stdlib/genericpath.pyi @@ -1,17 +1,32 @@ +import os import sys -from _typeshed import AnyPath -from os.path import commonprefix as commonprefix -from typing import Text +from _typeshed import AnyPath, BytesPath, StrPath, SupportsLessThanT +from typing import List, Sequence, Tuple, Union, overload +from typing_extensions import Literal +# All overloads can return empty string. Ideally, Literal[""] would be a valid +# Iterable[T], so that Union[List[T], Literal[""]] could be used as a return +# type. But because this only works when T is str, we need Sequence[T] instead. +@overload +def commonprefix(m: Sequence[StrPath]) -> str: ... +@overload +def commonprefix(m: Sequence[BytesPath]) -> Union[bytes, Literal[""]]: ... +@overload +def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... +@overload +def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ... def exists(path: AnyPath) -> bool: ... -def isfile(path: Text) -> bool: ... -def isdir(s: Text) -> bool: ... -def getsize(filename: Text) -> int: ... -def getmtime(filename: Text) -> float: ... -def getatime(filename: Text) -> float: ... -def getctime(filename: Text) -> float: ... +def getsize(filename: AnyPath) -> int: ... +def isfile(path: AnyPath) -> bool: ... +def isdir(s: AnyPath) -> bool: ... + +# These return float if os.stat_float_times() == True, +# but int is a subclass of float. +def getatime(filename: AnyPath) -> float: ... +def getmtime(filename: AnyPath) -> float: ... +def getctime(filename: AnyPath) -> float: ... if sys.version_info >= (3, 4): - def samestat(s1: str, s2: str) -> int: ... - def samefile(f1: str, f2: str) -> int: ... - def sameopenfile(fp1: str, fp2: str) -> int: ... + def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... + def sameopenfile(fp1: int, fp2: int) -> bool: ... + def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... diff --git a/stdlib/macpath.pyi b/stdlib/macpath.pyi index b8d665260..296f3a9ba 100644 --- a/stdlib/macpath.pyi +++ b/stdlib/macpath.pyi @@ -1,32 +1,43 @@ -import os import sys from _typeshed import AnyPath, BytesPath, StrPath -from typing import Any, AnyStr, Callable, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload +from genericpath import ( + commonprefix as commonprefix, + exists as exists, + getatime as getatime, + getctime as getctime, + getmtime as getmtime, + getsize as getsize, + isdir as isdir, + isfile as isfile, +) -_T = TypeVar("_T") +if sys.version_info >= (3, 4): + from genericpath import samefile as samefile, sameopenfile as sameopenfile, samestat as samestat + +# Re-export common definitions from posixpath to reduce duplication +from posixpath import ( + abspath as abspath, + curdir as curdir, + defpath as defpath, + devnull as devnull, + expanduser as expanduser, + expandvars as expandvars, + extsep as extsep, + isabs as isabs, + lexists as lexists, + pardir as pardir, + pathsep as pathsep, + sep as sep, + splitdrive as splitdrive, + splitext as splitext, + supports_unicode_filenames as supports_unicode_filenames, +) +from typing import AnyStr, Optional, Text, Tuple, overload + +altsep: Optional[str] if sys.version_info >= (3, 6): from os import PathLike - -# ----- os.path variables ----- -supports_unicode_filenames: bool -# aliases (also in os) -curdir: str -pardir: str -sep: str -altsep: Optional[str] -extsep: str -pathsep: str -defpath: str -devnull: str - -# ----- os.path function stubs ----- -if sys.version_info >= (3, 6): - # Overloads are necessary to work around python/mypy#3644. - @overload - def abspath(path: PathLike[AnyStr]) -> AnyStr: ... - @overload - def abspath(path: AnyStr) -> AnyStr: ... @overload def basename(s: PathLike[AnyStr]) -> AnyStr: ... @overload @@ -36,14 +47,6 @@ if sys.version_info >= (3, 6): @overload def dirname(s: AnyStr) -> AnyStr: ... @overload - def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... - @overload - def expanduser(path: AnyStr) -> AnyStr: ... - @overload - def expandvars(path: PathLike[AnyStr]) -> AnyStr: ... - @overload - def expandvars(path: AnyStr) -> AnyStr: ... - @overload def normcase(path: PathLike[AnyStr]) -> AnyStr: ... @overload def normcase(path: AnyStr) -> AnyStr: ... @@ -57,41 +60,25 @@ if sys.version_info >= (3, 6): def realpath(path: AnyStr) -> AnyStr: ... else: - def abspath(path: AnyStr) -> AnyStr: ... def basename(s: AnyStr) -> AnyStr: ... def dirname(s: AnyStr) -> AnyStr: ... - def expanduser(path: AnyStr) -> AnyStr: ... - def expandvars(path: AnyStr) -> AnyStr: ... def normcase(path: AnyStr) -> AnyStr: ... def normpath(s: AnyStr) -> AnyStr: ... def realpath(path: AnyStr) -> AnyStr: ... -# NOTE: Empty lists results in '' (str) regardless of contained type. -# Also, in Python 2 mixed sequences of Text and bytes results in either Text or bytes -# So, fall back to Any -def commonprefix(m: Sequence[AnyPath]) -> Any: ... +def islink(s: AnyPath) -> bool: ... -if sys.version_info >= (3, 3): - def exists(path: Union[AnyPath, int]) -> bool: ... +if sys.version_info >= (3, 6): + # Mypy complains that the signatures overlap, but things seem to behave correctly anyway. + @overload + def join(s: StrPath, *paths: StrPath) -> Text: ... + @overload + def join(s: BytesPath, *paths: BytesPath) -> bytes: ... + +elif sys.version_info >= (3, 0): + def join(s: AnyStr, *paths: AnyStr) -> AnyStr: ... else: - def exists(path: AnyPath) -> bool: ... - -def lexists(path: AnyPath) -> bool: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: AnyPath) -> float: ... -def getmtime(filename: AnyPath) -> float: ... -def getctime(filename: AnyPath) -> float: ... -def getsize(filename: AnyPath) -> int: ... -def isabs(s: AnyPath) -> bool: ... -def isfile(path: AnyPath) -> bool: ... -def isdir(s: AnyPath) -> bool: ... -def islink(s: AnyPath) -> bool: ... -def ismount(s: AnyPath) -> bool: ... - -if sys.version_info < (3, 0): # Make sure signatures are disjunct, and allow combinations of bytes and unicode. # (Since Python 2 allows that, too) # Note that e.g. os.path.join("a", "b", "c", "d", u"e") will still result in @@ -107,38 +94,11 @@ if sys.version_info < (3, 0): @overload def join(__p1: Text, *p: AnyPath) -> Text: ... -elif sys.version_info >= (3, 6): - # Mypy complains that the signatures overlap, but things seem to behave correctly anyway. - @overload - def join(s: StrPath, *paths: StrPath) -> Text: ... - @overload - def join(s: BytesPath, *paths: BytesPath) -> bytes: ... - -else: - def join(s: AnyStr, *paths: AnyStr) -> AnyStr: ... - -def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... - if sys.version_info >= (3, 6): @overload def split(s: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... - @overload - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... else: def split(s: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -if sys.version_info < (3,): - def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ... diff --git a/stdlib/ntpath.pyi b/stdlib/ntpath.pyi index 6af6cbbc2..d454d7f93 100644 --- a/stdlib/ntpath.pyi +++ b/stdlib/ntpath.pyi @@ -1,97 +1,70 @@ -import os import sys -from _typeshed import AnyPath, BytesPath, StrPath -from genericpath import exists as exists +from _typeshed import BytesPath, StrPath +from genericpath import ( + commonprefix as commonprefix, + exists as exists, + getatime as getatime, + getctime as getctime, + getmtime as getmtime, + getsize as getsize, + isdir as isdir, + isfile as isfile, + samefile as samefile, + sameopenfile as sameopenfile, + samestat as samestat, +) from os import PathLike -from os.path import commonpath as commonpath, commonprefix as commonprefix, lexists as lexists -from typing import AnyStr, Optional, Tuple, TypeVar, overload -_T = TypeVar("_T") +# Re-export common definitions from posixpath to reduce duplication +from posixpath import ( + abspath as abspath, + basename as basename, + commonpath as commonpath, + curdir as curdir, + defpath as defpath, + devnull as devnull, + dirname as dirname, + expanduser as expanduser, + expandvars as expandvars, + extsep as extsep, + isabs as isabs, + islink as islink, + ismount as ismount, + lexists as lexists, + normcase as normcase, + normpath as normpath, + pardir as pardir, + pathsep as pathsep, + relpath as relpath, + sep as sep, + split as split, + splitdrive as splitdrive, + splitext as splitext, + supports_unicode_filenames as supports_unicode_filenames, +) +from typing import AnyStr, Tuple, overload -# ----- os.path variables ----- -supports_unicode_filenames: bool -# aliases (also in os) -curdir: str -pardir: str -sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: Optional[str] -extsep: str -pathsep: str -defpath: str -devnull: str +altsep: str +if sys.version_info < (3, 7) and sys.platform == "win32": + def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated -# ----- os.path function stubs ----- -# Overloads are necessary to work around python/mypy#3644. -@overload -def abspath(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def abspath(path: AnyStr) -> AnyStr: ... -@overload -def basename(p: PathLike[AnyStr]) -> AnyStr: ... -@overload -def basename(p: AnyStr) -> AnyStr: ... -@overload -def dirname(p: PathLike[AnyStr]) -> AnyStr: ... -@overload -def dirname(p: AnyStr) -> AnyStr: ... -@overload -def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def expanduser(path: AnyStr) -> AnyStr: ... -@overload -def expandvars(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def expandvars(path: AnyStr) -> AnyStr: ... -@overload -def normcase(s: PathLike[AnyStr]) -> AnyStr: ... -@overload -def normcase(s: AnyStr) -> AnyStr: ... -@overload -def normpath(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def normpath(path: AnyStr) -> AnyStr: ... -@overload -def realpath(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def realpath(path: AnyStr) -> AnyStr: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: AnyPath) -> float: ... -def getmtime(filename: AnyPath) -> float: ... -def getctime(filename: AnyPath) -> float: ... -def getsize(filename: AnyPath) -> int: ... -def isabs(s: AnyPath) -> bool: ... -def isfile(path: AnyPath) -> bool: ... -def isdir(s: AnyPath) -> bool: ... -def islink(path: AnyPath) -> bool: ... -def ismount(path: AnyPath) -> bool: ... +# Similar to posixpath, but have slightly different argument names @overload def join(path: StrPath, *paths: StrPath) -> str: ... @overload def join(path: BytesPath, *paths: BytesPath) -> bytes: ... -@overload -def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ... -@overload -def relpath(path: StrPath, start: Optional[StrPath] = ...) -> str: ... -def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -@overload -def split(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... -@overload -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitdrive(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -if sys.version_info < (3, 7) and sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated +if sys.platform == "win32": + if sys.version_info >= (3, 10): + @overload + def realpath(path: PathLike[AnyStr], *, strict: bool = ...) -> AnyStr: ... + @overload + def realpath(path: AnyStr, *, strict: bool = ...) -> AnyStr: ... + else: + @overload + def realpath(path: PathLike[AnyStr]) -> AnyStr: ... + @overload + def realpath(path: AnyStr) -> AnyStr: ... + +else: + realpath = abspath diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 24744b62b..2e8561501 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -39,13 +39,13 @@ from typing import ( ) from typing_extensions import Literal -from . import path as path +from . import path as _path if sys.version_info >= (3, 9): from types import GenericAlias -# We need to use something from path, or flake8 and pytype get unhappy -_supports_unicode_filenames = path.supports_unicode_filenames +# This unnecessary alias is to work around various errors +path = _path _T = TypeVar("_T") _AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True) diff --git a/stdlib/os/path.pyi b/stdlib/os/path.pyi index 66d5d6fea..453373898 100644 --- a/stdlib/os/path.pyi +++ b/stdlib/os/path.pyi @@ -1,133 +1,6 @@ -import os import sys -from _typeshed import AnyPath, BytesPath, StrPath, SupportsLessThanT -from genericpath import exists as exists -from os import PathLike -from typing import AnyStr, List, Optional, Sequence, Tuple, Union, overload -from typing_extensions import Literal - -# ----- os.path variables ----- -supports_unicode_filenames: bool -# aliases (also in os) -curdir: str -pardir: str -sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: Optional[str] -extsep: str -pathsep: str -defpath: str -devnull: str - -# ----- os.path function stubs ----- -# Overloads are necessary to work around python/mypy#3644. -@overload -def abspath(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def abspath(path: AnyStr) -> AnyStr: ... -@overload -def basename(p: PathLike[AnyStr]) -> AnyStr: ... -@overload -def basename(p: AnyStr) -> AnyStr: ... -@overload -def dirname(p: PathLike[AnyStr]) -> AnyStr: ... -@overload -def dirname(p: AnyStr) -> AnyStr: ... -@overload -def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def expanduser(path: AnyStr) -> AnyStr: ... -@overload -def expandvars(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def expandvars(path: AnyStr) -> AnyStr: ... -@overload -def normcase(s: PathLike[AnyStr]) -> AnyStr: ... -@overload -def normcase(s: AnyStr) -> AnyStr: ... -@overload -def normpath(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def normpath(path: AnyStr) -> AnyStr: ... if sys.platform == "win32": - if sys.version_info >= (3, 10): - @overload - def realpath(path: PathLike[AnyStr], *, strict: bool = ...) -> AnyStr: ... - @overload - def realpath(path: AnyStr, *, strict: bool = ...) -> AnyStr: ... - else: - @overload - def realpath(path: PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(path: AnyStr) -> AnyStr: ... - + from ntpath import * else: - if sys.version_info >= (3, 10): - @overload - def realpath(filename: PathLike[AnyStr], *, strict: bool = ...) -> AnyStr: ... - @overload - def realpath(filename: AnyStr, *, strict: bool = ...) -> AnyStr: ... - else: - @overload - def realpath(filename: PathLike[AnyStr]) -> AnyStr: ... - @overload - def realpath(filename: AnyStr) -> AnyStr: ... - -@overload -def commonpath(paths: Sequence[StrPath]) -> str: ... -@overload -def commonpath(paths: Sequence[BytesPath]) -> bytes: ... - -# All overloads can return empty string. Ideally, Literal[""] would be a valid -# Iterable[T], so that Union[List[T], Literal[""]] could be used as a return -# type. But because this only works when T is str, we need Sequence[T] instead. -@overload -def commonprefix(m: Sequence[StrPath]) -> str: ... -@overload -def commonprefix(m: Sequence[BytesPath]) -> Union[bytes, Literal[""]]: ... -@overload -def commonprefix(m: Sequence[List[SupportsLessThanT]]) -> Sequence[SupportsLessThanT]: ... -@overload -def commonprefix(m: Sequence[Tuple[SupportsLessThanT, ...]]) -> Sequence[SupportsLessThanT]: ... - -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: AnyPath) -> float: ... -def getmtime(filename: AnyPath) -> float: ... -def getctime(filename: AnyPath) -> float: ... -def getsize(filename: AnyPath) -> int: ... -def lexists(path: AnyPath) -> bool: ... -def isabs(s: AnyPath) -> bool: ... -def isfile(path: AnyPath) -> bool: ... -def isdir(s: AnyPath) -> bool: ... -def islink(path: AnyPath) -> bool: ... -def ismount(path: AnyPath) -> bool: ... -@overload -def join(a: StrPath, *paths: StrPath) -> str: ... -@overload -def join(a: BytesPath, *paths: BytesPath) -> bytes: ... -@overload -def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ... -@overload -def relpath(path: StrPath, start: Optional[StrPath] = ...) -> str: ... -def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... -@overload -def split(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... -@overload -def split(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitdrive(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... -@overload -def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -if sys.version_info < (3, 7) and sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated + from posixpath import * diff --git a/stdlib/posixpath.pyi b/stdlib/posixpath.pyi index 684aec59b..98176eaa0 100644 --- a/stdlib/posixpath.pyi +++ b/stdlib/posixpath.pyi @@ -1,29 +1,32 @@ -import os import sys from _typeshed import AnyPath, BytesPath, StrPath -from genericpath import exists as exists +from genericpath import ( + commonprefix as commonprefix, + exists as exists, + getatime as getatime, + getctime as getctime, + getmtime as getmtime, + getsize as getsize, + isdir as isdir, + isfile as isfile, + samefile as samefile, + sameopenfile as sameopenfile, + samestat as samestat, +) from os import PathLike -from os.path import commonpath as commonpath, commonprefix as commonprefix, lexists as lexists -from typing import AnyStr, Optional, Tuple, TypeVar, overload +from typing import AnyStr, Optional, Sequence, Tuple, overload -_T = TypeVar("_T") - -# ----- os.path variables ----- supports_unicode_filenames: bool # aliases (also in os) curdir: str pardir: str sep: str -if sys.platform == "win32": - altsep: str -else: - altsep: Optional[str] +altsep: Optional[str] extsep: str pathsep: str defpath: str devnull: str -# ----- os.path function stubs ----- # Overloads are necessary to work around python/mypy#3644. @overload def abspath(path: PathLike[AnyStr]) -> AnyStr: ... @@ -53,6 +56,14 @@ def normcase(s: AnyStr) -> AnyStr: ... def normpath(path: PathLike[AnyStr]) -> AnyStr: ... @overload def normpath(path: AnyStr) -> AnyStr: ... +@overload +def commonpath(paths: Sequence[StrPath]) -> str: ... +@overload +def commonpath(paths: Sequence[BytesPath]) -> bytes: ... +@overload +def join(a: StrPath, *paths: StrPath) -> str: ... +@overload +def join(a: BytesPath, *paths: BytesPath) -> bytes: ... if sys.version_info >= (3, 10): @overload @@ -66,28 +77,10 @@ else: @overload def realpath(filename: AnyStr) -> AnyStr: ... -# These return float if os.stat_float_times() == True, -# but int is a subclass of float. -def getatime(filename: AnyPath) -> float: ... -def getmtime(filename: AnyPath) -> float: ... -def getctime(filename: AnyPath) -> float: ... -def getsize(filename: AnyPath) -> int: ... -def isabs(s: AnyPath) -> bool: ... -def isfile(path: AnyPath) -> bool: ... -def isdir(s: AnyPath) -> bool: ... -def islink(path: AnyPath) -> bool: ... -def ismount(path: AnyPath) -> bool: ... -@overload -def join(a: StrPath, *paths: StrPath) -> str: ... -@overload -def join(a: BytesPath, *paths: BytesPath) -> bytes: ... @overload def relpath(path: BytesPath, start: Optional[BytesPath] = ...) -> bytes: ... @overload def relpath(path: StrPath, start: Optional[StrPath] = ...) -> str: ... -def samefile(f1: AnyPath, f2: AnyPath) -> bool: ... -def sameopenfile(fp1: int, fp2: int) -> bool: ... -def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ... @overload def split(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload @@ -100,6 +93,7 @@ def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... def splitext(p: PathLike[AnyStr]) -> Tuple[AnyStr, AnyStr]: ... @overload def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... - -if sys.version_info < (3, 7) and sys.platform == "win32": - def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated +def isabs(s: AnyPath) -> bool: ... +def islink(path: AnyPath) -> bool: ... +def ismount(path: AnyPath) -> bool: ... +def lexists(path: AnyPath) -> bool: ...