diff --git a/stdlib/posixpath.pyi b/stdlib/posixpath.pyi index 8d880a072dfb..fb2fcaccac96 100644 --- a/stdlib/posixpath.pyi +++ b/stdlib/posixpath.pyi @@ -72,9 +72,9 @@ devnull: LiteralString # Overloads are necessary to work around python/mypy#3644. @overload -def abspath(path: PathLike[AnyStr]) -> AnyStr: ... +def abspath(path: StrPath) -> str: ... @overload -def abspath(path: AnyStr) -> AnyStr: ... +def abspath(path: BytesPath) -> bytes: ... @overload def basename(p: PathLike[AnyStr]) -> AnyStr: ... @overload @@ -84,13 +84,13 @@ def dirname(p: PathLike[AnyStr]) -> AnyStr: ... @overload def dirname(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... @overload -def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... +def expanduser(path: StrPath) -> str: ... @overload -def expanduser(path: AnyStr) -> AnyStr: ... +def expanduser(path: BytesPath) -> bytes: ... @overload -def expandvars(path: PathLike[AnyStr]) -> AnyStr: ... +def expandvars(path: StrPath) -> str: ... @overload -def expandvars(path: AnyStr) -> AnyStr: ... +def expandvars(path: BytesPath) -> bytes: ... @overload def normcase(s: PathLike[AnyStr]) -> AnyStr: ... @overload @@ -118,15 +118,15 @@ def join(__a: BytesPath, *paths: BytesPath) -> bytes: ... if sys.version_info >= (3, 10): @overload - def realpath(filename: PathLike[AnyStr], *, strict: bool = ...) -> AnyStr: ... + def realpath(filename: StrPath, *, strict: bool = ...) -> str: ... @overload - def realpath(filename: AnyStr, *, strict: bool = ...) -> AnyStr: ... + def realpath(filename: BytesPath, *, strict: bool = ...) -> bytes: ... else: @overload - def realpath(filename: PathLike[AnyStr]) -> AnyStr: ... + def realpath(filename: StrPath) -> str: ... @overload - def realpath(filename: AnyStr) -> AnyStr: ... + def realpath(filename: BytesPath) -> bytes: ... @overload def relpath(path: LiteralString, start: LiteralString | None = ...) -> LiteralString: ...