Skip to content
Open
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
3 changes: 3 additions & 0 deletions stdlib/pathlib/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class PurePath(PathLike[str]):
def __rtruediv__(self, key: StrPath) -> Self: ...
def __bytes__(self) -> bytes: ...
def as_posix(self) -> str: ...
@deprecated("PurePath.as_uri() is deprecated. Use Path.as_uri() instead.")
def as_uri(self) -> str: ...
Comment on lines +93 to 94
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like a version check wouldn't hurt here.

Suggested change
@deprecated("PurePath.as_uri() is deprecated. Use Path.as_uri() instead.")
def as_uri(self) -> str: ...
if sys.version_info >= (3, 14):
@deprecated("Deprecated since Python 3.14; will be removed in Python 3.19. Use `Path.as_uri()` instead.")
def as_uri(self) -> str: ...
else:
def as_uri(self) -> str: ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the alternative exists in all versions made this unconditional.

def is_absolute(self) -> bool: ...
if sys.version_info >= (3, 13):
Expand Down Expand Up @@ -345,6 +346,8 @@ class Path(PurePath):
self, top_down: bool = True, on_error: Callable[[OSError], object] | None = None, follow_symlinks: bool = False
) -> Iterator[tuple[Self, list[str], list[str]]]: ...

def as_uri(self) -> str: ...

class PosixPath(Path, PurePosixPath):
__slots__ = ()

Expand Down