@@ -167,12 +167,13 @@ no limit.
167167#### `glob.glob` {: #glob}
168168
169169```py3
170- def glob(patterns, *, flags=0, root_dir=None, dir_fd=None, limit=1000):
170+ def glob(patterns, *, flags=0, root_dir=None, dir_fd=None, limit=1000, exclude=None ):
171171```
172172
173173` glob ` takes a pattern (or list of patterns), flags, and an optional root directory (string or path-like object) and/or
174- directory file descriptor. It also allows configuring the [ max pattern limit] ( #multi-pattern-limits ) . When executed it
175- will crawl the file system returning matching files.
174+ directory file descriptor. It also allows configuring the [ max pattern limit] ( #multi-pattern-limits ) . Exclusion patterns
175+ can be specified via the ` exclude ` parameter which takes a pattern or a list of patterns.When executed it will crawl the
176+ file system returning matching files.
176177
177178!!! warning "Path-like Input Support"
178179 Path-like object input support is only available in Python 3.6+ as the path-like protocol was added in Python 3.6.
@@ -299,10 +300,13 @@ Additionally, you can use `dir_fd` and specify a root directory with a directory
299300!!! new "New 8.2"
300301 ` dir_fd ` parameter was added in 8.2.
301302
303+ !!! new "New 8.4"
304+ ` exclude ` parameter was added.
305+
302306#### ` glob.iglob ` {: #iglob}
303307
304308``` py3
305- def iglob (patterns , * , flags = 0 , root_dir = None , dir_fd = None , limit = 1000 ):
309+ def iglob (patterns , * , flags = 0 , root_dir = None , dir_fd = None , limit = 1000 , exclude = None ):
306310```
307311
308312` iglob ` is just like [ ` glob ` ] ( #glob ) except it returns an iterator.
@@ -322,15 +326,19 @@ def iglob(patterns, *, flags=0, root_dir=None, dir_fd=None, limit=1000):
322326!!! new "New 8.2"
323327 ` dir_fd ` parameter was added in 8.2.
324328
329+ !!! new "New 8.4"
330+ ` exclude ` parameter was added.
331+
325332#### ` glob.globmatch ` {: #globmatch}
326333
327334``` py3
328- def globmatch (filename , patterns , * , flags = 0 , root_dir = None , dir_fd = None , limit = 1000 ):
335+ def globmatch (filename , patterns , * , flags = 0 , root_dir = None , dir_fd = None , limit = 1000 , exclude = None ):
329336```
330337
331338` globmatch ` takes a file name (string or path-like object), a pattern (or list of patterns), flags, and an optional root
332- directory and/or file descriptor. It also allows configuring the [ max pattern limit] ( #multi-pattern-limits ) . It will
333- return a boolean indicating whether the file path was matched by the pattern(s).
339+ directory and/or file descriptor. It also allows configuring the [ max pattern limit] ( #multi-pattern-limits ) . Exclusion
340+ patterns can be specified via the ` exclude ` parameter which takes a pattern or a list of patterns. It will return a
341+ boolean indicating whether the file path was matched by the pattern(s).
334342
335343``` pycon3
336344>>> from wcmatch import glob
@@ -457,16 +465,20 @@ True
457465!!! new "New 8.2"
458466 ` dir_fd ` parameter was added in 8.2.
459467
468+ !!! new "New 8.4"
469+ ` exclude ` parameter was added.
470+
460471#### ` glob.globfilter ` {: #globfilter}
461472
462473``` py3
463- def globfilter (filenames , patterns , * , flags = 0 , root_dir = None , dir_fd = None , limit = 1000 ):
474+ def globfilter (filenames , patterns , * , flags = 0 , root_dir = None , dir_fd = None , limit = 1000 , method = None ):
464475```
465476
466477` globfilter ` takes a list of file paths (strings or path-like objects), a pattern (or list of patterns), flags, and an
467- optional root directory and/or directory file descriptor. It also allows configuring the
468- [ max pattern limit] ( #multi-pattern-limits ) . It returns a list of all files paths that matched the pattern(s). The same
469- logic used for [ ` globmatch ` ] ( #globmatch ) is used for ` globfilter ` , albeit more efficient for processing multiple files.
478+ optional root directory and/or directory file descriptor. It also allows configuring the
479+ [ max pattern limit] ( #multi-pattern-limits ) . Exclusion patterns can be specified via the ` exclude ` parameter which takes
480+ a pattern or a list of patterns.It returns a list of all files paths that matched the pattern(s). The same logic used
481+ for [ ` globmatch ` ] ( #globmatch ) is used for ` globfilter ` , albeit more efficient for processing multiple files.
470482
471483!!! warning "Path-like Input Support"
472484 Path-like object input support is only available in Python 3.6+ as the path-like protocol was added in Python 3.6.
@@ -492,16 +504,20 @@ be matched by `GLOBSTAR`. See [`globmatch`](#globmatch) for examples.
492504!!! new "New 8.2"
493505 ` dir_fd ` parameter was added in 8.2.
494506
507+ !!! new "New 8.4"
508+ ` exclude ` parameter was added.
509+
495510#### ` glob.translate ` {: #translate}
496511
497512``` py3
498- def translate (patterns , * , flags = 0 , limit = 1000 ):
513+ def translate (patterns , * , flags = 0 , limit = 1000 , exclude = None ):
499514```
500515
501516` translate ` takes a file pattern (or list of patterns) and flags. It also allows configuring the [ max pattern
502- limit] ( #multi-pattern-limits ) . It returns two lists: one for inclusion patterns and one for exclusion patterns. The
503- lists contain the regular expressions used for matching the given patterns. It should be noted that a file is considered
504- matched if it matches at least one inclusion pattern and matches ** none** of the exclusion patterns.
517+ limit] ( #multi-pattern-limits ) . Exclusion patterns can be specified via the ` exclude ` parameter which takes a pattern or
518+ a list of patterns. It returns two lists: one for inclusion patterns and one for exclusion patterns. The lists contain
519+ the regular expressions used for matching the given patterns. It should be noted that a file is considered matched if it
520+ matches at least one inclusion pattern and matches ** none** of the exclusion patterns.
505521
506522``` pycon3
507523>>> from wcmatch import glob
@@ -531,6 +547,9 @@ we wrap the entire group to be captured: `#!py3 '+(a)'` --> `#!py3 r'((a)+)'`.
531547!!! new "New 7.1"
532548 Translate patterns now provide capturing groups for [ ` EXTGLOB ` ] ( #extglob ) groups.
533549
550+ !!! new "New 8.4"
551+ ` exclude ` parameter was added.
552+
534553#### ` glob.escape ` {: #escape}
535554
536555``` py3
@@ -759,6 +778,9 @@ unless the file matches the excluded pattern. This is done with the [`NEGATEALL`
759778` NEGATE ` enables [ ` DOTGLOB ` ] ( #dotglob ) in all exclude patterns, this cannot be disabled. This will not affect the
760779inclusion patterns.
761780
781+ If ` NEGATE ` is set and exclusion patterns are passed via a matching or glob function's ` exclude ` parameter, ` NEGATE `
782+ will be ignored and the ` exclude ` patterns will be used instead. Either ` exclude ` or ` NEGATE ` should be used, not both.
783+
762784#### ` glob.NEGATEALL, glob.A ` {: #negateall}
763785
764786` NEGATEALL ` can force exclusion patterns, when no inclusion pattern is provided, to assume all files match unless the
0 commit comments