@@ -218,6 +218,18 @@ class Path:
218
218
It implements the Python 3.10 version of :class:`pathlib.Path` interface, except for
219
219
the deprecated :meth:`~pathlib.Path.link_to` method.
220
220
221
+ Some methods may be unavailable or have limited functionality, based on the Python
222
+ version:
223
+
224
+ * :meth:`~pathlib.Path.from_uri` (available on Python 3.13 or later)
225
+ * :meth:`~pathlib.Path.full_match` (available on Python 3.13 or later)
226
+ * :meth:`~pathlib.Path.is_junction` (available on Python 3.12 or later)
227
+ * :meth:`~pathlib.Path.match` (the ``case_sensitive`` paramater is only available on
228
+ Python 3.13 or later)
229
+ * :meth:`~pathlib.Path.relative_to` (the ``walk_up`` parameter is only available on
230
+ Python 3.12 or later)
231
+ * :meth:`~pathlib.Path.walk` (available on Python 3.12 or later)
232
+
221
233
Any methods that do disk I/O need to be awaited on. These methods are:
222
234
223
235
* :meth:`~pathlib.Path.absolute`
@@ -233,7 +245,10 @@ class Path:
233
245
* :meth:`~pathlib.Path.is_dir`
234
246
* :meth:`~pathlib.Path.is_fifo`
235
247
* :meth:`~pathlib.Path.is_file`
248
+ * :meth:`~pathlib.Path.is_junction`
236
249
* :meth:`~pathlib.Path.is_mount`
250
+ * :meth:`~pathlib.Path.is_socket`
251
+ * :meth:`~pathlib.Path.is_symlink`
237
252
* :meth:`~pathlib.Path.lchmod`
238
253
* :meth:`~pathlib.Path.lstat`
239
254
* :meth:`~pathlib.Path.mkdir`
@@ -244,11 +259,14 @@ class Path:
244
259
* :meth:`~pathlib.Path.readlink`
245
260
* :meth:`~pathlib.Path.rename`
246
261
* :meth:`~pathlib.Path.replace`
262
+ * :meth:`~pathlib.Path.resolve`
247
263
* :meth:`~pathlib.Path.rmdir`
248
264
* :meth:`~pathlib.Path.samefile`
249
265
* :meth:`~pathlib.Path.stat`
266
+ * :meth:`~pathlib.Path.symlink_to`
250
267
* :meth:`~pathlib.Path.touch`
251
268
* :meth:`~pathlib.Path.unlink`
269
+ * :meth:`~pathlib.Path.walk`
252
270
* :meth:`~pathlib.Path.write_bytes`
253
271
* :meth:`~pathlib.Path.write_text`
254
272
@@ -386,9 +404,6 @@ def is_relative_to(self, other: str | PathLike[str]) -> bool:
386
404
except ValueError :
387
405
return False
388
406
389
- async def is_junction (self ) -> bool :
390
- return await to_thread .run_sync (self ._path .is_junction )
391
-
392
407
async def chmod (self , mode : int , * , follow_symlinks : bool = True ) -> None :
393
408
func = partial (os .chmod , follow_symlinks = follow_symlinks )
394
409
return await to_thread .run_sync (func , self ._path , mode )
@@ -448,6 +463,11 @@ async def is_fifo(self) -> bool:
448
463
async def is_file (self ) -> bool :
449
464
return await to_thread .run_sync (self ._path .is_file , abandon_on_cancel = True )
450
465
466
+ if sys .version_info >= (3 , 12 ):
467
+
468
+ async def is_junction (self ) -> bool :
469
+ return await to_thread .run_sync (self ._path .is_junction )
470
+
451
471
async def is_mount (self ) -> bool :
452
472
return await to_thread .run_sync (
453
473
os .path .ismount , self ._path , abandon_on_cancel = True
0 commit comments