diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-11-13 17:15:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 17:15:56 (GMT) |
commit | cf67ebfb315ce36175f3d425249d7c6560f6d0d5 (patch) | |
tree | 3007eaa7164eba027714b9752aecea60627e6de6 /Python/frame.c | |
parent | babb787047e0f7807c8238d3b1a3128dac30bd5c (diff) | |
download | cpython-cf67ebfb315ce36175f3d425249d7c6560f6d0d5.zip cpython-cf67ebfb315ce36175f3d425249d7c6560f6d0d5.tar.gz cpython-cf67ebfb315ce36175f3d425249d7c6560f6d0d5.tar.bz2 |
GH-72904: Add `glob.translate()` function (#106703)
Add `glob.translate()` function that converts a pathname with shell wildcards to a regular expression. The regular expression is used by pathlib to implement `match()` and `glob()`.
This function differs from `fnmatch.translate()` in that wildcards do not match path separators by default, and that a `*` pattern segment matches precisely one path segment. When *recursive* is set to true, `**` pattern segments match any number of path segments, and `**` cannot appear outside its own segment.
In pathlib, this change speeds up directory walking (because `_make_child_relpath()` does less work), makes path objects smaller (they don't need a `_lines` slot), and removes the need for some gnarly code.
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Python/frame.c')
0 files changed, 0 insertions, 0 deletions