CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 16:22:19 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/python/cpython.git
etag: W/"31f231ec7527aad4bd747e77d7690ffc"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=SxxeOJSS%2BV6yrF%2FN9xPKkzC5yM7acuip5c8VIdjf2HdrQDW38YNEI1t6BrAnuOfHflXlyKbDEkGibITt5Z3no9vqA2fr3x%2BNhYzG3EPF%2BwPAYu8NVbr4QHBVdFXiX4W1NIzintmxPOdg44q7JMCRpCQZaXJbkeshfmJ6z%2BWXSUy1iBf7%2FDmZ86s2s4i9pbHFr8QKTb0aTQnoNCBk1ZB4oSVAH81gVstyNjXYcbPxQ23MgjRX6F6BHDBtLvbPZpokvValEXOyoB5pHwltIzU3EA%3D%3D--pfy1N3FxtB6jAyDd--4fAHk5iLDsjOBq0ew8B%2F7Q%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1243387533.1753633338; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 16:22:18 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 16:22:18 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 9EAE:93466:680C22:88AD14:6886523A
GH-72904: Add `glob.translate()` function (#106703) · python/cpython@cf67ebf · GitHub


authored
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit cf67ebf
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>
1 parent babb787 commit cf67ebfCopy full SHA for cf67ebf
File tree
Expand file treeCollapse file tree
7 files changed
+229
-106
lines changedFilter options
- Doc
- library
- whatsnew
- Lib
- test
- Misc/NEWS.d/next/Library
Expand file treeCollapse file tree
7 files changed
+229
-106
lines changed+39Lines changed: 39 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
148 | 187 |
| |
149 | 188 |
| |
150 | 189 |
| |
|
+7Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
183 | 183 |
| |
184 | 184 |
| |
185 | 185 |
| |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
186 | 193 |
| |
187 | 194 |
| |
188 | 195 |
| |
|
+9-2Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
78 | 78 |
| |
79 | 79 |
| |
80 | 80 |
| |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
81 | 86 |
| |
82 | 87 |
| |
83 | 88 |
| |
| |||
89 | 94 |
| |
90 | 95 |
| |
91 | 96 |
| |
92 |
| - | |
| 97 | + | |
93 | 98 |
| |
94 | 99 |
| |
95 | 100 |
| |
| |||
146 | 151 |
| |
147 | 152 |
| |
148 | 153 |
| |
| 154 | + | |
| 155 | + | |
149 | 156 |
| |
| 157 | + | |
150 | 158 |
| |
151 |
| - | |
152 | 159 |
| |
153 | 160 |
| |
154 | 161 |
| |
|
+60Lines changed: 60 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
249 | 249 |
| |
250 | 250 |
| |
251 | 251 |
| |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + |
+21-104Lines changed: 21 additions & 104 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
10 | 9 |
| |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
84 |
| - | |
85 |
| - | |
86 |
| - | |
87 |
| - | |
88 |
| - | |
89 |
| - | |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 | 79 |
| |
95 |
| - | |
| 80 | + | |
96 | 81 |
| |
97 |
| - | |
98 |
| - | |
99 |
| - | |
| 82 | + | |
100 | 83 |
| |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
117 |
| - | |
118 |
| - | |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 |
| - | |
127 |
| - | |
128 |
| - | |
129 |
| - | |
130 |
| - | |
131 |
| - | |
132 |
| - | |
133 |
| - | |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - | |
140 |
| - | |
141 |
| - | |
142 |
| - | |
143 |
| - | |
144 |
| - | |
145 |
| - | |
146 |
| - | |
147 |
| - | |
148 |
| - | |
149 |
| - | |
150 |
| - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
151 | 89 |
| |
152 | 90 |
| |
153 | 91 |
| |
| |||
171 | 109 |
| |
172 | 110 |
| |
173 | 111 |
| |
174 |
| - | |
| 112 | + | |
175 | 113 |
| |
176 | 114 |
| |
177 | 115 |
| |
| |||
297 | 235 |
| |
298 | 236 |
| |
299 | 237 |
| |
300 |
| - | |
301 |
| - | |
302 |
| - | |
303 |
| - | |
304 | 238 |
| |
305 | 239 |
| |
306 | 240 |
| |
| |||
475 | 409 |
| |
476 | 410 |
| |
477 | 411 |
| |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
488 |
| - | |
489 |
| - | |
490 |
| - | |
491 |
| - | |
492 | 412 |
| |
493 | 413 |
| |
494 | 414 |
| |
| |||
763 | 683 |
| |
764 | 684 |
| |
765 | 685 |
| |
766 |
| - | |
| 686 | + | |
| 687 | + | |
767 | 688 |
| |
768 |
| - | |
| 689 | + | |
769 | 690 |
| |
770 |
| - | |
| 691 | + | |
771 | 692 |
| |
772 | 693 |
| |
| 694 | + | |
| 695 | + | |
773 | 696 |
| |
774 | 697 |
| |
775 | 698 |
| |
| |||
1069 | 992 |
| |
1070 | 993 |
| |
1071 | 994 |
| |
1072 |
| - | |
1073 |
| - | |
1074 |
| - | |
1075 | 995 |
| |
1076 | 996 |
| |
1077 | 997 |
| |
1078 |
| - | |
1079 |
| - | |
| 998 | + | |
1080 | 999 |
| |
1081 | 1000 |
| |
1082 |
| - | |
1083 | 1001 |
| |
1084 | 1002 |
| |
1085 |
| - | |
1086 | 1003 |
| |
1087 | 1004 |
| |
1088 | 1005 |
| |
1089 | 1006 |
| |
1090 | 1007 |
| |
1091 |
| - | |
1092 | 1008 |
| |
1093 | 1009 |
| |
1094 | 1010 |
| |
| |||
1139 | 1055 |
| |
1140 | 1056 |
| |
1141 | 1057 |
| |
| 1058 | + | |
1142 | 1059 |
| |
1143 | 1060 |
| |
1144 | 1061 |
| |
| |||
1159 | 1076 |
| |
1160 | 1077 |
| |
1161 | 1078 |
| |
1162 |
| - | |
1163 |
| - | |
1164 |
| - | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
1165 | 1082 |
| |
1166 | 1083 |
| |
1167 | 1084 |
| |
| |||
1174 | 1091 |
| |
1175 | 1092 |
| |
1176 | 1093 |
| |
1177 |
| - | |
| 1094 | + | |
1178 | 1095 |
| |
1179 | 1096 |
| |
1180 | 1097 |
| |
|
You can’t perform that action at this time.
0 commit comments