@@ -15,11 +15,16 @@ from collections.abc import Callable, Generator, Iterator, Sequence
15
15
from io import BufferedRandom , BufferedReader , BufferedWriter , FileIO , TextIOWrapper
16
16
from os import PathLike , stat_result
17
17
from 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
19
19
from typing_extensions import Never , Self , deprecated
20
20
21
+ _PathT = TypeVar ("_PathT" , bound = PurePath )
22
+
21
23
__all__ = ["PurePath" , "PurePosixPath" , "PureWindowsPath" , "Path" , "PosixPath" , "WindowsPath" ]
22
24
25
+ if sys .version_info >= (3 , 14 ):
26
+ from pathlib .types import PathInfo
27
+
23
28
if sys .version_info >= (3 , 13 ):
24
29
__all__ += ["UnsupportedOperation" ]
25
30
@@ -63,7 +68,9 @@ class PurePath(PathLike[str]):
63
68
def as_uri (self ) -> str : ...
64
69
def is_absolute (self ) -> bool : ...
65
70
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 ):
67
74
def is_relative_to (self , other : StrPath , / , * _deprecated : StrPath ) -> bool : ...
68
75
else :
69
76
def is_relative_to (self , * other : StrPath ) -> bool : ...
@@ -73,7 +80,9 @@ class PurePath(PathLike[str]):
73
80
else :
74
81
def match (self , path_pattern : str ) -> bool : ...
75
82
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 ):
77
86
def relative_to (self , other : StrPath , / , * _deprecated : StrPath , walk_up : bool = False ) -> Self : ...
78
87
else :
79
88
def relative_to (self , * other : StrPath ) -> Self : ...
@@ -154,17 +163,25 @@ class Path(PurePath):
154
163
def mkdir (self , mode : int = 0o777 , parents : bool = False , exist_ok : bool = False ) -> None : ...
155
164
156
165
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]
168
185
169
186
# Adapted from builtins.open
170
187
# Text mode: always returns a TextIOWrapper
@@ -253,9 +270,6 @@ class Path(PurePath):
253
270
254
271
def resolve (self , strict : bool = False ) -> Self : ...
255
272
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
-
259
273
def symlink_to (self , target : StrOrBytesPath , target_is_directory : bool = False ) -> None : ...
260
274
if sys .version_info >= (3 , 10 ):
261
275
def hardlink_to (self , target : StrOrBytesPath ) -> None : ...
@@ -286,9 +300,6 @@ class Path(PurePath):
286
300
self , top_down : bool = ..., on_error : Callable [[OSError ], object ] | None = ..., follow_symlinks : bool = ...
287
301
) -> Iterator [tuple [Self , list [str ], list [str ]]]: ...
288
302
289
- if sys .version_info >= (3 , 14 ):
290
- def rmtree (self , ignore_errors : bool = False , on_error : Callable [[OSError ], object ] | None = None ) -> None : ...
291
-
292
303
class PosixPath (Path , PurePosixPath ): ...
293
304
class WindowsPath (Path , PureWindowsPath ): ...
294
305
0 commit comments