Skip to content

posixpath: Rearrange overloads #7957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions stdlib/posixpath.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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: ...
Expand Down