@@ -252,22 +252,12 @@ pattern(s).
252
252
253
253
` match ` mimics Python's ` pathlib ` version of ` match ` . Python's ` match ` uses a right to left evaluation. Wildcard Match
254
254
emulates this behavior as well. What this means is that when provided with a path ` some/path/name ` , the patterns ` name ` ,
255
- ` path/name ` and ` some/path/name ` will all match.
256
-
257
- Because the path is evaluated right to left, dot files may not prevent matches when ` DOTGLOB ` is disabled.
258
-
259
- ``` pycon3
260
- >>> from wcmatch import pathlib
261
- >>> pathlib.PurePath('.dotfile/file').match('file')
262
- True
263
- >>> pathlib.PurePath('../.dotfile/file').match('file')
264
- True
265
- ```
255
+ ` path/name ` and ` some/path/name ` will all match. Essentially, it matches what [ ` rglob ` ] ( #rglob ) returns.
266
256
267
257
` match ` does not access the filesystem, but you can force the path to access the filesystem if you give it the
268
258
[ ` REALPATH ` ] ( #realpath ) flag. We do not restrict this, but we do not enable it by default.
269
- [ ` REALPATH ` ] ( #realpath ) simply forces the match to check the filesystem to see if the file exists and is a
270
- directory or not.
259
+ [ ` REALPATH ` ] ( #realpath ) simply forces the match to check the filesystem to see if the file exists, if it is a
260
+ directory or not, and whether it is a symlink .
271
261
272
262
Since [ ` Path ` ] ( #path ) is derived from [ ` PurePath ` ] ( #purepath ) , this method is also available in
273
263
[ ` Path ` ] ( #path ) objects.
@@ -302,8 +292,8 @@ a list of patterns. It will return a boolean indicating whether the objects file
302
292
303
293
` globmatch ` does not access the filesystem, but you can force the path to access the filesystem if you give it the
304
294
[ ` REALPATH ` ] ( #realpath ) flag. We do not restrict this, but we do not enable it by default.
305
- [ ` REALPATH ` ] ( #realpath ) simply forces the match to check the filesystem to see if the file exists and is a
306
- directory or not.
295
+ [ ` REALPATH ` ] ( #realpath ) simply forces the match to check the filesystem to see if the file exists, if it is a
296
+ directory or not, and whether it is a symlink .
307
297
308
298
Since [ ` Path ` ] ( #path ) is derived from [ ` PurePath ` ] ( #purepath ) , this method is also available in
309
299
[ ` Path ` ] ( #path ) objects.
@@ -323,6 +313,19 @@ True
323
313
` exclude ` parameter was added.
324
314
///
325
315
316
+ #### ` PurePath.full_match ` {: #full_match}
317
+
318
+ /// new | new 10.0
319
+ ///
320
+
321
+ ``` py3
322
+ def full_match (self , patterns , * , flags = 0 , limit = 1000 , exclude = None ):
323
+ ```
324
+
325
+ Python 3.13 added the new ` full_match ` method to ` PurePath ` objects. Essentially, this does for normal ` pathlib `
326
+ what our existing ` PurePath.globmatch ` has been doing prior to Python 3.13. We've added an alias for
327
+ ` PurePath.full_match ` that redirects to [ ` PurePath.globmatch ` ] ( #globmatch ) for completeness.
328
+
326
329
#### ` Path.glob ` {: #glob}
327
330
328
331
``` py3
@@ -446,10 +449,27 @@ When `MINUSNEGATE` is used with [`NEGATE`](#negate), exclusion patterns are reco
446
449
447
450
` GLOBSTAR ` enables the feature where ` ** ` matches zero or more directories.
448
451
452
+ #### ` glob.GLOBSTARLONG, glob.GL ` {: #globstarlong}
453
+
454
+ /// new | New 10.0
455
+ ///
456
+
457
+ When ` GLOBSTARLONG ` is enabled ` *** ` will act like ` ** ` , but will cause symlinks to be traversed as well.
458
+
459
+ Enabling ` GLOBSTARLONG ` automatically enables [ ` GLOBSTAR ` ] ( #globstar ) .
460
+
461
+ [ ` FOLLOW ` ] ( #follow ) will be ignored and ` *** ` will be required to traverse a symlink. But it should be noted that when
462
+ using [ ` MATCHBASE ` ] ( #matchbase ) and [ ` FOLLOW ` ] ( #follow ) with ` GLOBSTARLONG ` , that [ ` FOLLOW ` ] ( #follow ) will cause the
463
+ implicit leading ` ** ` that [ ` MATCHBASE ` ] ( #matchbase ) applies to act as an implicit ` *** ` .
464
+
449
465
#### ` pathlib.FOLLOW, pathlib.L ` {: #follow}
450
466
451
467
` FOLLOW ` will cause ` GLOBSTAR ` patterns (` ** ` ) to match and traverse symlink directories.
452
468
469
+ ` FOLLOW ` will have no affect if using [ ` GLOBSTARLONG ` ] ( #globstarlong ) and an explicit ` *** ` will be required to traverse
470
+ a symlink. ` FOLLOW ` will have an affect if enabled with [ ` GLOBSTARLONG ` ] ( #globstarlong ) and [ ` MATCHBASE ` ] ( #matchbase )
471
+ and will cause the implicit leading ` ** ` that ` MATCHBASE ` applies to act as an implicit ` *** ` .
472
+
453
473
#### ` pathlib.REALPATH, pathlib.P ` {: #realpath}
454
474
455
475
In the past, only ` glob ` and ` iglob ` operated on the filesystem, but with ` REALPATH ` , other functions will now operate
@@ -466,6 +486,10 @@ that the path must meet the following in order to match:
466
486
- Path must exist.
467
487
- Directories that are symlinks will not be matched by [ ` GLOBSTAR ` ] ( #globstar ) patterns (` ** ` ) unless the
468
488
[ ` FOLLOW ` ] ( #follow ) flag is enabled.
489
+ - If [ ` GLOBSTARLONG ` ] ( #globstarlong ) is enabled, ` *** ` will traverse symlinks, [ ` FOLLOW ` ] ( #follow ) will be ignored
490
+ except if [ ` MATCHBASE ` ] ( #matchbase ) is also enabled, in that case, the implicit leading ` ** ` added by
491
+ [ ` MATCHBASE ` ] ( #matchbase ) will act as ` *** ` . This also affects the implicit leading ` ** ` adding by
492
+ [ ` rglob ` ] ( #rglob ) .
469
493
- When presented with a pattern where the match must be a directory, but the file path being compared doesn't indicate
470
494
the file is a directory with a trailing slash, the command will look at the filesystem to determine if it is a
471
495
directory.
0 commit comments