@@ -15,11 +15,16 @@ from collections.abc import Callable, Generator, Iterator, Sequence
1515from io import BufferedRandom , BufferedReader , BufferedWriter , FileIO , TextIOWrapper
1616from os import PathLike , stat_result
1717from types import GenericAlias , TracebackType
18- from typing import IO , Any , BinaryIO , ClassVar , Literal , overload
18+ from typing import IO , Any , BinaryIO , ClassVar , Literal , TypeVar , overload
1919from typing_extensions import Never , Self , deprecated
2020
21+ _PathT = TypeVar ("_PathT" , bound = PurePath )
22+
2123__all__ = ["PurePath" , "PurePosixPath" , "PureWindowsPath" , "Path" , "PosixPath" , "WindowsPath" ]
2224
25+ if sys .version_info >= (3 , 14 ):
26+ from pathlib .types import PathInfo
27+
2328if sys .version_info >= (3 , 13 ):
2429 __all__ += ["UnsupportedOperation" ]
2530
@@ -63,7 +68,9 @@ class PurePath(PathLike[str]):
6368 def as_uri (self ) -> str : ...
6469 def is_absolute (self ) -> bool : ...
6570 def is_reserved (self ) -> bool : ...
66- if sys .version_info >= (3 , 12 ):
71+ if sys .version_info >= (3 , 14 ):
72+ def is_relative_to (self , other : StrPath ) -> bool : ...
73+ elif sys .version_info >= (3 , 12 ):
6774 def is_relative_to (self , other : StrPath , / , * _deprecated : StrPath ) -> bool : ...
6875 else :
6976 def is_relative_to (self , * other : StrPath ) -> bool : ...
@@ -73,7 +80,9 @@ class PurePath(PathLike[str]):
7380 else :
7481 def match (self , path_pattern : str ) -> bool : ...
7582
76- if sys .version_info >= (3 , 12 ):
83+ if sys .version_info >= (3 , 14 ):
84+ def relative_to (self , other : StrPath , * , walk_up : bool = False ) -> Self : ...
85+ elif sys .version_info >= (3 , 12 ):
7786 def relative_to (self , other : StrPath , / , * _deprecated : StrPath , walk_up : bool = False ) -> Self : ...
7887 else :
7988 def relative_to (self , * other : StrPath ) -> Self : ...
@@ -154,17 +163,25 @@ class Path(PurePath):
154163 def mkdir (self , mode : int = 0o777 , parents : bool = False , exist_ok : bool = False ) -> None : ...
155164
156165 if sys .version_info >= (3 , 14 ):
157- def copy (self , target : StrPath , * , follow_symlinks : bool = True , preserve_metadata : bool = False ) -> None : ...
158- def copytree (
159- self ,
160- target : StrPath ,
161- * ,
162- follow_symlinks : bool = True ,
163- preserve_metadata : bool = False ,
164- dirs_exist_ok : bool = False ,
165- ignore : Callable [[Self ], bool ] | None = None ,
166- on_error : Callable [[OSError ], object ] | None = None ,
167- ) -> None : ...
166+
167+ @property
168+ def info (self ) -> PathInfo : ...
169+ @overload
170+ def move_into (self , target_dir : _PathT ) -> _PathT : ... # type: ignore[overload-overlap]
171+ @overload
172+ def move_into (self , target_dir : StrPath ) -> Self : ... # type: ignore[overload-overlap]
173+ @overload
174+ def move (self , target : _PathT ) -> _PathT : ... # type: ignore[overload-overlap]
175+ @overload
176+ def move (self , target : StrPath ) -> Self : ... # type: ignore[overload-overlap]
177+ @overload
178+ def copy_into (self , target_dir : _PathT , * , follow_symlinks : bool = True , preserve_metadata : bool = False ) -> _PathT : ... # type: ignore[overload-overlap]
179+ @overload
180+ def copy_into (self , target_dir : StrPath , * , follow_symlinks : bool = True , preserve_metadata : bool = False ) -> Self : ... # type: ignore[overload-overlap]
181+ @overload
182+ def copy (self , target : _PathT , * , follow_symlinks : bool = True , preserve_metadata : bool = False ) -> _PathT : ... # type: ignore[overload-overlap]
183+ @overload
184+ def copy (self , target : StrPath , * , follow_symlinks : bool = True , preserve_metadata : bool = False ) -> Self : ... # type: ignore[overload-overlap]
168185
169186 # Adapted from builtins.open
170187 # Text mode: always returns a TextIOWrapper
@@ -253,9 +270,6 @@ class Path(PurePath):
253270
254271 def resolve (self , strict : bool = False ) -> Self : ...
255272 def rmdir (self ) -> None : ...
256- if sys .version_info >= (3 , 14 ):
257- def delete (self , ignore_errors : bool = False , on_error : Callable [[OSError ], object ] | None = None ) -> None : ...
258-
259273 def symlink_to (self , target : StrOrBytesPath , target_is_directory : bool = False ) -> None : ...
260274 if sys .version_info >= (3 , 10 ):
261275 def hardlink_to (self , target : StrOrBytesPath ) -> None : ...
@@ -286,9 +300,6 @@ class Path(PurePath):
286300 self , top_down : bool = ..., on_error : Callable [[OSError ], object ] | None = ..., follow_symlinks : bool = ...
287301 ) -> Iterator [tuple [Self , list [str ], list [str ]]]: ...
288302
289- if sys .version_info >= (3 , 14 ):
290- def rmtree (self , ignore_errors : bool = False , on_error : Callable [[OSError ], object ] | None = None ) -> None : ...
291-
292303class PosixPath (Path , PurePosixPath ): ...
293304class WindowsPath (Path , PureWindowsPath ): ...
294305
0 commit comments