From ae34688034b94216b698f95d83dc8560ae7a7976 Mon Sep 17 00:00:00 2001 From: Stanislav Zmiev Date: Wed, 19 Oct 2022 00:22:08 +0400 Subject: [PATCH] Add `pathlib.Path.walk()` (#8921) --- stdlib/pathlib.pyi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index 2a0f1760c..4adfc2333 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -8,7 +8,7 @@ from _typeshed import ( Self, StrPath, ) -from collections.abc import Generator, Sequence +from collections.abc import Callable, Generator, Iterator, Sequence from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper from os import PathLike, stat_result from types import TracebackType @@ -198,6 +198,10 @@ class Path(PurePath): def write_text(self, data: str, encoding: str | None = ..., errors: str | None = ...) -> int: ... if sys.version_info >= (3, 8): def link_to(self, target: StrPath | bytes) -> None: ... + if sys.version_info >= (3, 12): + def walk( + self: Self, top_down: bool = ..., on_error: Callable[[OSError], object] | None = ..., follow_symlinks: bool = ... + ) -> Iterator[tuple[Self, list[str], list[str]]]: ... class PosixPath(Path, PurePosixPath): ... class WindowsPath(Path, PureWindowsPath): ...