urlpattern 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- # This file is autogenerated by maturin v1.11.5
1
+ # This file is autogenerated by maturin v1.12.0
2
2
  # To update, run
3
3
  #
4
- # maturin generate-ci --pytest github
4
+ # maturin generate-ci github
5
5
  #
6
6
  name: CI
7
7
 
@@ -53,31 +53,6 @@ jobs:
53
53
  with:
54
54
  name: wheels-linux-${{ matrix.platform.target }}
55
55
  path: dist
56
- - name: pytest
57
- if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
58
- shell: bash
59
- run: |
60
- set -e
61
- python3 -m venv .venv
62
- source .venv/bin/activate
63
- pip install urlpattern --find-links dist --force-reinstall
64
- pip install pytest
65
- pytest
66
- - name: pytest
67
- if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }}
68
- uses: uraimo/run-on-arch-action@v2
69
- with:
70
- arch: ${{ matrix.platform.target }}
71
- distro: ubuntu22.04
72
- githubToken: ${{ github.token }}
73
- install: |
74
- apt-get update
75
- apt-get install -y --no-install-recommends python3 python3-pip
76
- pip3 install -U pip pytest
77
- run: |
78
- set -e
79
- pip3 install urlpattern --find-links dist --force-reinstall
80
- pytest
81
56
 
82
57
  musllinux:
83
58
  runs-on: ${{ matrix.platform.runner }}
@@ -109,36 +84,6 @@ jobs:
109
84
  with:
110
85
  name: wheels-musllinux-${{ matrix.platform.target }}
111
86
  path: dist
112
- - name: pytest
113
- if: ${{ startsWith(matrix.platform.target, 'x86_64') }}
114
- uses: addnab/docker-run-action@v3
115
- with:
116
- image: alpine:latest
117
- options: -v ${{ github.workspace }}:/io -w /io
118
- run: |
119
- set -e
120
- apk add py3-pip py3-virtualenv
121
- python3 -m virtualenv .venv
122
- source .venv/bin/activate
123
- pip install urlpattern --no-index --find-links dist --force-reinstall
124
- pip install pytest
125
- pytest
126
- - name: pytest
127
- if: ${{ !startsWith(matrix.platform.target, 'x86') }}
128
- uses: uraimo/run-on-arch-action@v2
129
- with:
130
- arch: ${{ matrix.platform.target }}
131
- distro: alpine_latest
132
- githubToken: ${{ github.token }}
133
- install: |
134
- apk add py3-virtualenv
135
- run: |
136
- set -e
137
- python3 -m virtualenv .venv
138
- source .venv/bin/activate
139
- pip install pytest
140
- pip install urlpattern --find-links dist --force-reinstall
141
- pytest
142
87
 
143
88
  windows:
144
89
  runs-on: ${{ matrix.platform.runner }}
@@ -171,15 +116,6 @@ jobs:
171
116
  with:
172
117
  name: wheels-windows-${{ matrix.platform.target }}
173
118
  path: dist
174
- - name: pytest
175
- shell: bash
176
- run: |
177
- set -e
178
- python3 -m venv .venv
179
- source .venv/Scripts/activate
180
- pip install urlpattern --find-links dist --force-reinstall
181
- pip install pytest
182
- pytest
183
119
 
184
120
  macos:
185
121
  runs-on: ${{ matrix.platform.runner }}
@@ -206,14 +142,6 @@ jobs:
206
142
  with:
207
143
  name: wheels-macos-${{ matrix.platform.target }}
208
144
  path: dist
209
- - name: pytest
210
- run: |
211
- set -e
212
- python3 -m venv .venv
213
- source .venv/bin/activate
214
- pip install urlpattern --find-links dist --force-reinstall
215
- pip install pytest
216
- pytest
217
145
 
218
146
  sdist:
219
147
  runs-on: ubuntu-latest
@@ -11,12 +11,6 @@ dependencies = [
11
11
  "memchr",
12
12
  ]
13
13
 
14
- [[package]]
15
- name = "autocfg"
16
- version = "1.5.0"
17
- source = "registry+https://github.com/rust-lang/crates.io-index"
18
- checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
19
-
20
14
  [[package]]
21
15
  name = "displaydoc"
22
16
  version = "0.2.5"
@@ -145,20 +139,11 @@ dependencies = [
145
139
  "icu_properties",
146
140
  ]
147
141
 
148
- [[package]]
149
- name = "indoc"
150
- version = "2.0.7"
151
- source = "registry+https://github.com/rust-lang/crates.io-index"
152
- checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
153
- dependencies = [
154
- "rustversion",
155
- ]
156
-
157
142
  [[package]]
158
143
  name = "libc"
159
- version = "0.2.180"
144
+ version = "0.2.182"
160
145
  source = "registry+https://github.com/rust-lang/crates.io-index"
161
- checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
146
+ checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
162
147
 
163
148
  [[package]]
164
149
  name = "litemap"
@@ -168,18 +153,9 @@ checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
168
153
 
169
154
  [[package]]
170
155
  name = "memchr"
171
- version = "2.7.6"
156
+ version = "2.8.0"
172
157
  source = "registry+https://github.com/rust-lang/crates.io-index"
173
- checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
174
-
175
- [[package]]
176
- name = "memoffset"
177
- version = "0.9.1"
178
- source = "registry+https://github.com/rust-lang/crates.io-index"
179
- checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
180
- dependencies = [
181
- "autocfg",
182
- ]
158
+ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
183
159
 
184
160
  [[package]]
185
161
  name = "once_cell"
@@ -195,9 +171,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
195
171
 
196
172
  [[package]]
197
173
  name = "portable-atomic"
198
- version = "1.13.0"
174
+ version = "1.13.1"
199
175
  source = "registry+https://github.com/rust-lang/crates.io-index"
200
- checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950"
176
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
201
177
 
202
178
  [[package]]
203
179
  name = "potential_utf"
@@ -219,35 +195,32 @@ dependencies = [
219
195
 
220
196
  [[package]]
221
197
  name = "pyo3"
222
- version = "0.27.2"
198
+ version = "0.28.1"
223
199
  source = "registry+https://github.com/rust-lang/crates.io-index"
224
- checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d"
200
+ checksum = "14c738662e2181be11cb82487628404254902bb3225d8e9e99c31f3ef82a405c"
225
201
  dependencies = [
226
- "indoc",
227
202
  "libc",
228
- "memoffset",
229
203
  "once_cell",
230
204
  "portable-atomic",
231
205
  "pyo3-build-config",
232
206
  "pyo3-ffi",
233
207
  "pyo3-macros",
234
- "unindent",
235
208
  ]
236
209
 
237
210
  [[package]]
238
211
  name = "pyo3-build-config"
239
- version = "0.27.2"
212
+ version = "0.28.1"
240
213
  source = "registry+https://github.com/rust-lang/crates.io-index"
241
- checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6"
214
+ checksum = "f9ca0864a7dd3c133a7f3f020cbff2e12e88420da854c35540fd20ce2d60e435"
242
215
  dependencies = [
243
216
  "target-lexicon",
244
217
  ]
245
218
 
246
219
  [[package]]
247
220
  name = "pyo3-ffi"
248
- version = "0.27.2"
221
+ version = "0.28.1"
249
222
  source = "registry+https://github.com/rust-lang/crates.io-index"
250
- checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089"
223
+ checksum = "9dfc1956b709823164763a34cc42bbfd26b8730afa77809a3df8b94a3ae3b059"
251
224
  dependencies = [
252
225
  "libc",
253
226
  "pyo3-build-config",
@@ -255,9 +228,9 @@ dependencies = [
255
228
 
256
229
  [[package]]
257
230
  name = "pyo3-macros"
258
- version = "0.27.2"
231
+ version = "0.28.1"
259
232
  source = "registry+https://github.com/rust-lang/crates.io-index"
260
- checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02"
233
+ checksum = "29dc660ad948bae134d579661d08033fbb1918f4529c3bbe3257a68f2009ddf2"
261
234
  dependencies = [
262
235
  "proc-macro2",
263
236
  "pyo3-macros-backend",
@@ -267,9 +240,9 @@ dependencies = [
267
240
 
268
241
  [[package]]
269
242
  name = "pyo3-macros-backend"
270
- version = "0.27.2"
243
+ version = "0.28.1"
271
244
  source = "registry+https://github.com/rust-lang/crates.io-index"
272
- checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9"
245
+ checksum = "e78cd6c6d718acfcedf26c3d21fe0f053624368b0d44298c55d7138fde9331f7"
273
246
  dependencies = [
274
247
  "heck",
275
248
  "proc-macro2",
@@ -280,7 +253,7 @@ dependencies = [
280
253
 
281
254
  [[package]]
282
255
  name = "python-urlpattern"
283
- version = "0.1.7"
256
+ version = "0.1.9"
284
257
  dependencies = [
285
258
  "pyo3",
286
259
  "urlpattern",
@@ -297,9 +270,9 @@ dependencies = [
297
270
 
298
271
  [[package]]
299
272
  name = "regex"
300
- version = "1.12.2"
273
+ version = "1.12.3"
301
274
  source = "registry+https://github.com/rust-lang/crates.io-index"
302
- checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
275
+ checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
303
276
  dependencies = [
304
277
  "aho-corasick",
305
278
  "memchr",
@@ -309,9 +282,9 @@ dependencies = [
309
282
 
310
283
  [[package]]
311
284
  name = "regex-automata"
312
- version = "0.4.13"
285
+ version = "0.4.14"
313
286
  source = "registry+https://github.com/rust-lang/crates.io-index"
314
- checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
287
+ checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
315
288
  dependencies = [
316
289
  "aho-corasick",
317
290
  "memchr",
@@ -320,15 +293,9 @@ dependencies = [
320
293
 
321
294
  [[package]]
322
295
  name = "regex-syntax"
323
- version = "0.8.8"
296
+ version = "0.8.9"
324
297
  source = "registry+https://github.com/rust-lang/crates.io-index"
325
- checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
326
-
327
- [[package]]
328
- name = "rustversion"
329
- version = "1.0.22"
330
- source = "registry+https://github.com/rust-lang/crates.io-index"
331
- checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
298
+ checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
332
299
 
333
300
  [[package]]
334
301
  name = "serde"
@@ -374,9 +341,9 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
374
341
 
375
342
  [[package]]
376
343
  name = "syn"
377
- version = "2.0.114"
344
+ version = "2.0.115"
378
345
  source = "registry+https://github.com/rust-lang/crates.io-index"
379
- checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
346
+ checksum = "6e614ed320ac28113fa64972c4262d5dbc89deacdfd00c34a3e4cea073243c12"
380
347
  dependencies = [
381
348
  "proc-macro2",
382
349
  "quote",
@@ -412,15 +379,9 @@ dependencies = [
412
379
 
413
380
  [[package]]
414
381
  name = "unicode-ident"
415
- version = "1.0.22"
416
- source = "registry+https://github.com/rust-lang/crates.io-index"
417
- checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
418
-
419
- [[package]]
420
- name = "unindent"
421
- version = "0.2.4"
382
+ version = "1.0.23"
422
383
  source = "registry+https://github.com/rust-lang/crates.io-index"
423
- checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
384
+ checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e"
424
385
 
425
386
  [[package]]
426
387
  name = "url"
@@ -436,9 +397,9 @@ dependencies = [
436
397
 
437
398
  [[package]]
438
399
  name = "urlpattern"
439
- version = "0.5.2"
400
+ version = "0.6.0"
440
401
  source = "registry+https://github.com/rust-lang/crates.io-index"
441
- checksum = "37ffe0983283c841b6c6e9f116833a0061cc690c0eb67994d65bbdfa5cd3f24e"
402
+ checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b"
442
403
  dependencies = [
443
404
  "icu_properties",
444
405
  "regex",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "python-urlpattern"
3
- version = "0.1.7"
3
+ version = "0.1.9"
4
4
  authors = ["방성범 (Bang Seongbeom) <bangseongbeom@gmail.com>"]
5
5
  edition = "2024"
6
6
  description = "An implementation of the URL Pattern Standard for Python written in Rust."
@@ -15,5 +15,5 @@ readme = "README.md"
15
15
  crate-type = ["cdylib"]
16
16
 
17
17
  [dependencies]
18
- pyo3 = "0.27.2"
19
- deno_urlpattern = { package = "urlpattern", version = "0.5.2" }
18
+ pyo3 = "0.28.0"
19
+ deno_urlpattern = { package = "urlpattern", version = "0.6.0" }
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: urlpattern
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
7
7
  Classifier: Operating System :: OS Independent
8
8
  Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
9
10
  Classifier: Programming Language :: Python :: 3.8
10
11
  Classifier: Programming Language :: Python :: 3.9
11
12
  Classifier: Programming Language :: Python :: 3.10
@@ -13,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
13
14
  Classifier: Programming Language :: Python :: 3.12
14
15
  Classifier: Programming Language :: Python :: 3.13
15
16
  Classifier: Programming Language :: Python :: 3.14
16
- Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: Free Threading
17
18
  Classifier: Programming Language :: Python :: Implementation :: CPython
18
19
  Classifier: Programming Language :: Python :: Implementation :: PyPy
19
20
  Classifier: Programming Language :: Rust
@@ -44,6 +45,8 @@ The URL Pattern Standard is a web standard for URL pattern matching. It is usefu
44
45
 
45
46
  It's a thin wrapper of [denoland/rust-urlpattern](https://github.com/denoland/rust-urlpattern) with [PyO3](https://github.com/PyO3/pyo3) + [Maturin](https://github.com/PyO3/maturin).
46
47
 
48
+ The naming conventions follow [the standard](https://urlpattern.spec.whatwg.org/) as closely as possible, similar to [xml.dom](https://docs.python.org/3/library/xml.dom.html).
49
+
47
50
  ## Installation
48
51
 
49
52
  On Linux/UNIX or macOS:
@@ -86,6 +89,16 @@ result = pattern.exec({"pathname": "/users/4163/"})
86
89
  print(result["pathname"]["groups"]["id"]) # output: 4163
87
90
  ```
88
91
 
92
+ ### `baseURL`
93
+
94
+ ```py
95
+ from urlpattern import URLPattern
96
+
97
+ pattern = URLPattern({"pathname": "/admin/*"}, "https://example.com")
98
+ print(pattern.test({"pathname": "/admin/main/"}, "https://example.com")) # output: True
99
+ print(pattern.test("/admin/main/", "https://example.com")) # output: True
100
+ ```
101
+
89
102
  ### `ignoreCase`
90
103
 
91
104
  ```py
@@ -100,7 +113,7 @@ print(pattern.test("https://example.com/test")) # output: True
100
113
  print(pattern.test("https://example.com/TeST")) # output: True
101
114
  ```
102
115
 
103
- ### Simple WSGI app
116
+ ### A simple WSGI app
104
117
 
105
118
  ```py
106
119
  from wsgiref.simple_server import make_server
@@ -13,6 +13,8 @@ The URL Pattern Standard is a web standard for URL pattern matching. It is usefu
13
13
 
14
14
  It's a thin wrapper of [denoland/rust-urlpattern](https://github.com/denoland/rust-urlpattern) with [PyO3](https://github.com/PyO3/pyo3) + [Maturin](https://github.com/PyO3/maturin).
15
15
 
16
+ The naming conventions follow [the standard](https://urlpattern.spec.whatwg.org/) as closely as possible, similar to [xml.dom](https://docs.python.org/3/library/xml.dom.html).
17
+
16
18
  ## Installation
17
19
 
18
20
  On Linux/UNIX or macOS:
@@ -55,6 +57,16 @@ result = pattern.exec({"pathname": "/users/4163/"})
55
57
  print(result["pathname"]["groups"]["id"]) # output: 4163
56
58
  ```
57
59
 
60
+ ### `baseURL`
61
+
62
+ ```py
63
+ from urlpattern import URLPattern
64
+
65
+ pattern = URLPattern({"pathname": "/admin/*"}, "https://example.com")
66
+ print(pattern.test({"pathname": "/admin/main/"}, "https://example.com")) # output: True
67
+ print(pattern.test("/admin/main/", "https://example.com")) # output: True
68
+ ```
69
+
58
70
  ### `ignoreCase`
59
71
 
60
72
  ```py
@@ -69,7 +81,7 @@ print(pattern.test("https://example.com/test")) # output: True
69
81
  print(pattern.test("https://example.com/TeST")) # output: True
70
82
  ```
71
83
 
72
- ### Simple WSGI app
84
+ ### A simple WSGI app
73
85
 
74
86
  ```py
75
87
  from wsgiref.simple_server import make_server
@@ -15,6 +15,7 @@ classifiers = [
15
15
  "License :: OSI Approved :: MIT License",
16
16
  "Operating System :: OS Independent",
17
17
  "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3 :: Only",
18
19
  "Programming Language :: Python :: 3.8",
19
20
  "Programming Language :: Python :: 3.9",
20
21
  "Programming Language :: Python :: 3.10",
@@ -22,7 +23,7 @@ classifiers = [
22
23
  "Programming Language :: Python :: 3.12",
23
24
  "Programming Language :: Python :: 3.13",
24
25
  "Programming Language :: Python :: 3.14",
25
- "Programming Language :: Python :: 3 :: Only",
26
+ "Programming Language :: Python :: Free Threading",
26
27
  "Programming Language :: Python :: Implementation :: CPython",
27
28
  "Programming Language :: Python :: Implementation :: PyPy",
28
29
  "Programming Language :: Rust",
@@ -35,6 +36,3 @@ dynamic = ["version"]
35
36
  Homepage = "https://github.com/urlpattern/python-urlpattern"
36
37
  Repository = "https://github.com/urlpattern/python-urlpattern.git"
37
38
  Issues = "https://github.com/urlpattern/python-urlpattern/issues"
38
-
39
- [tool.maturin]
40
- features = ["pyo3/extension-module"]
@@ -1,5 +1,6 @@
1
1
  #![allow(non_snake_case)]
2
2
 
3
+ use std::borrow::Cow;
3
4
  use std::collections::HashMap;
4
5
 
5
6
  use pyo3::{
@@ -201,13 +202,13 @@ pub enum UrlPatternInput<'py> {
201
202
  Init(Bound<'py, PyDict>),
202
203
  }
203
204
 
204
- impl<'py> TryFrom<UrlPatternInput<'py>> for deno_urlpattern::quirks::StringOrInit {
205
+ impl<'py> TryFrom<UrlPatternInput<'py>> for deno_urlpattern::quirks::StringOrInit<'static> {
205
206
  type Error = pyo3::PyErr;
206
207
 
207
208
  fn try_from(input: UrlPatternInput<'py>) -> Result<Self, Self::Error> {
208
209
  Ok(match input {
209
210
  UrlPatternInput::String(pattern) => {
210
- deno_urlpattern::quirks::StringOrInit::String(pattern)
211
+ deno_urlpattern::quirks::StringOrInit::String(Cow::Owned(pattern))
211
212
  }
212
213
  UrlPatternInput::Init(init) => deno_urlpattern::quirks::StringOrInit::Init(
213
214
  deno_urlpattern::quirks::UrlPatternInit {
@@ -254,7 +255,10 @@ impl<'py> TryFrom<UrlPatternInput<'py>> for deno_urlpattern::quirks::StringOrIni
254
255
  }
255
256
 
256
257
  pub struct UrlPatternResult {
257
- pub inputs: (deno_urlpattern::quirks::StringOrInit, Option<String>),
258
+ pub inputs: (
259
+ deno_urlpattern::quirks::StringOrInit<'static>,
260
+ Option<String>,
261
+ ),
258
262
  pub protocol: UrlPatternComponentResult,
259
263
  pub username: UrlPatternComponentResult,
260
264
  pub password: UrlPatternComponentResult,
@@ -278,7 +282,7 @@ impl<'py> IntoPyObject<'py> for UrlPatternResult {
278
282
 
279
283
  match string_or_init {
280
284
  deno_urlpattern::quirks::StringOrInit::String(string) => {
281
- list.append(string).unwrap();
285
+ list.append(string.into_owned()).unwrap();
282
286
  }
283
287
  deno_urlpattern::quirks::StringOrInit::Init(init) => {
284
288
  let init_dict = PyDict::new(py);
@@ -353,7 +357,7 @@ impl From<deno_urlpattern::Error> for Error {
353
357
  }
354
358
 
355
359
  /// A Python module implemented in Rust.
356
- #[pymodule(gil_used = false)]
360
+ #[pymodule]
357
361
  mod urlpattern {
358
362
  #[pymodule_export]
359
363
  use super::UrlPattern;
@@ -0,0 +1,107 @@
1
+ from typing import Optional, TypedDict, Union, overload
2
+
3
+ from typing_extensions import TypeAlias
4
+
5
+ URLPatternInput: TypeAlias = Union[str, URLPatternInit]
6
+
7
+ class URLPatternOptions(TypedDict, total=False):
8
+ ignoreCase: bool
9
+
10
+ class URLPattern:
11
+ @overload
12
+ def __init__(
13
+ self,
14
+ input: str,
15
+ baseURL: str,
16
+ options: URLPatternOptions = {},
17
+ ) -> None: ...
18
+ @overload
19
+ def __init__(
20
+ self,
21
+ input: str,
22
+ baseURL: str,
23
+ options: None,
24
+ ) -> None: ...
25
+ @overload
26
+ def __init__(
27
+ self,
28
+ input: URLPatternInit,
29
+ baseURL: str,
30
+ options: URLPatternOptions = {},
31
+ ) -> None: ...
32
+ @overload
33
+ def __init__(
34
+ self,
35
+ input: URLPatternInit,
36
+ baseURL: str,
37
+ options: None,
38
+ ) -> None: ...
39
+ @overload
40
+ def __init__(self, input: str, options: URLPatternOptions = {}) -> None: ...
41
+ @overload
42
+ def __init__(self, input: str, options: None) -> None: ...
43
+ @overload
44
+ def __init__(
45
+ self, input: URLPatternInit = {}, options: URLPatternOptions = {}
46
+ ) -> None: ...
47
+ @overload
48
+ def __init__(self, input: URLPatternInit, options: None) -> None: ...
49
+ @overload
50
+ def test(self, input: str, baseURL: Optional[str] = None) -> bool: ...
51
+ @overload
52
+ def test(
53
+ self, input: URLPatternInit = {}, baseURL: Optional[str] = None
54
+ ) -> bool: ...
55
+ @overload
56
+ def exec(
57
+ self, input: str, baseURL: Optional[str] = None
58
+ ) -> Optional[URLPatternResult]: ...
59
+ @overload
60
+ def exec(
61
+ self, input: URLPatternInit = {}, baseURL: Optional[str] = None
62
+ ) -> Optional[URLPatternResult]: ...
63
+ @property
64
+ def protocol(self) -> str: ...
65
+ @property
66
+ def username(self) -> str: ...
67
+ @property
68
+ def password(self) -> str: ...
69
+ @property
70
+ def hostname(self) -> str: ...
71
+ @property
72
+ def port(self) -> str: ...
73
+ @property
74
+ def pathname(self) -> str: ...
75
+ @property
76
+ def search(self) -> str: ...
77
+ @property
78
+ def hash(self) -> str: ...
79
+
80
+ class URLPatternInit(TypedDict, total=False):
81
+ protocol: str
82
+ username: str
83
+ password: str
84
+ hostname: str
85
+ port: str
86
+ pathname: str
87
+ search: str
88
+ hash: str
89
+ baseURL: str
90
+
91
+ class URLPatternResult(TypedDict):
92
+ inputs: list[URLPatternInput]
93
+
94
+ protocol: URLPatternComponentResult
95
+ username: URLPatternComponentResult
96
+ password: URLPatternComponentResult
97
+ hostname: URLPatternComponentResult
98
+ port: URLPatternComponentResult
99
+ pathname: URLPatternComponentResult
100
+ search: URLPatternComponentResult
101
+ hash: URLPatternComponentResult
102
+
103
+ class URLPatternComponentResult(TypedDict):
104
+ input: str
105
+ groups: dict[str, str]
106
+
107
+ URLPatternCompatible: TypeAlias = Union[str, URLPatternInit, URLPattern]
@@ -1,68 +0,0 @@
1
- from typing_extensions import TypeAlias, TypedDict, overload
2
-
3
- URLPatternInput: TypeAlias = str | URLPatternInit
4
-
5
- class URLPatternOptions(TypedDict, total=False):
6
- ignoreCase: bool
7
-
8
- class URLPattern:
9
- @overload
10
- def __init__(
11
- self,
12
- input: URLPatternInput,
13
- baseURL: str,
14
- options: URLPatternOptions | None = None,
15
- ): ...
16
- @overload
17
- def __init__(
18
- self, input: URLPatternInput, options: URLPatternOptions | None = None
19
- ): ...
20
- def test(self, input: URLPatternInput = {}, baseURL: str | None = None) -> bool: ...
21
- def exec(
22
- self, input: URLPatternInput = {}, baseURL: str | None = None
23
- ) -> URLPatternResult | None: ...
24
- @property
25
- def protocol(self) -> str: ...
26
- @property
27
- def username(self) -> str: ...
28
- @property
29
- def password(self) -> str: ...
30
- @property
31
- def hostname(self) -> str: ...
32
- @property
33
- def port(self) -> str: ...
34
- @property
35
- def pathname(self) -> str: ...
36
- @property
37
- def search(self) -> str: ...
38
- @property
39
- def hash(self) -> str: ...
40
-
41
- class URLPatternInit(TypedDict, total=False):
42
- protocol: str
43
- username: str
44
- password: str
45
- hostname: str
46
- port: str
47
- pathname: str
48
- search: str
49
- hash: str
50
- baseURL: str
51
-
52
- class URLPatternResult(TypedDict):
53
- inputs: list[URLPatternInput]
54
-
55
- protocol: URLPatternComponentResult
56
- username: URLPatternComponentResult
57
- password: URLPatternComponentResult
58
- hostname: URLPatternComponentResult
59
- port: URLPatternComponentResult
60
- pathname: URLPatternComponentResult
61
- search: URLPatternComponentResult
62
- hash: URLPatternComponentResult
63
-
64
- class URLPatternComponentResult(TypedDict):
65
- input: str
66
- groups: dict[str, str]
67
-
68
- URLPatternCompatible: TypeAlias = str | URLPatternInit | URLPattern
File without changes
File without changes
File without changes
File without changes