urlpattern 0.1.9__tar.gz → 0.2.0__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.
- {urlpattern-0.1.9 → urlpattern-0.2.0}/.github/workflows/CI.yml +1 -1
- urlpattern-0.2.0/.vscode/settings.json +12 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/Cargo.lock +32 -32
- {urlpattern-0.1.9 → urlpattern-0.2.0}/Cargo.toml +4 -4
- {urlpattern-0.1.9 → urlpattern-0.2.0}/PKG-INFO +8 -5
- {urlpattern-0.1.9 → urlpattern-0.2.0}/README.md +7 -4
- {urlpattern-0.1.9 → urlpattern-0.2.0}/src/lib.rs +6 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/tests/test_lib.py +1 -1
- {urlpattern-0.1.9 → urlpattern-0.2.0}/tests/urlpatterntestdata.json +36 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/urlpattern.pyi +2 -0
- urlpattern-0.1.9/.vscode/settings.json +0 -8
- {urlpattern-0.1.9 → urlpattern-0.2.0}/.devcontainer/devcontainer.json +0 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/.github/dependabot.yml +0 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/.gitignore +0 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/.vscode/extensions.json +0 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/LICENSE +0 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/pyproject.toml +0 -0
- {urlpattern-0.1.9 → urlpattern-0.2.0}/tests/__init__.py +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
|
|
3
|
+
"python.testing.pytestArgs": [
|
|
4
|
+
"tests"
|
|
5
|
+
],
|
|
6
|
+
"python.testing.unittestEnabled": false,
|
|
7
|
+
"python.testing.pytestEnabled": true,
|
|
8
|
+
"[python]": {
|
|
9
|
+
"editor.formatOnSave": true,
|
|
10
|
+
"editor.defaultFormatter": "charliermarsh.ruff"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -141,9 +141,9 @@ dependencies = [
|
|
|
141
141
|
|
|
142
142
|
[[package]]
|
|
143
143
|
name = "libc"
|
|
144
|
-
version = "0.2.
|
|
144
|
+
version = "0.2.183"
|
|
145
145
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
-
checksum = "
|
|
146
|
+
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
|
|
147
147
|
|
|
148
148
|
[[package]]
|
|
149
149
|
name = "litemap"
|
|
@@ -159,9 +159,9 @@ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
|
|
159
159
|
|
|
160
160
|
[[package]]
|
|
161
161
|
name = "once_cell"
|
|
162
|
-
version = "1.21.
|
|
162
|
+
version = "1.21.4"
|
|
163
163
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
164
|
-
checksum = "
|
|
164
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
165
165
|
|
|
166
166
|
[[package]]
|
|
167
167
|
name = "percent-encoding"
|
|
@@ -195,9 +195,9 @@ dependencies = [
|
|
|
195
195
|
|
|
196
196
|
[[package]]
|
|
197
197
|
name = "pyo3"
|
|
198
|
-
version = "0.28.
|
|
198
|
+
version = "0.28.2"
|
|
199
199
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
200
|
-
checksum = "
|
|
200
|
+
checksum = "cf85e27e86080aafd5a22eae58a162e133a589551542b3e5cee4beb27e54f8e1"
|
|
201
201
|
dependencies = [
|
|
202
202
|
"libc",
|
|
203
203
|
"once_cell",
|
|
@@ -209,18 +209,18 @@ dependencies = [
|
|
|
209
209
|
|
|
210
210
|
[[package]]
|
|
211
211
|
name = "pyo3-build-config"
|
|
212
|
-
version = "0.28.
|
|
212
|
+
version = "0.28.2"
|
|
213
213
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
214
|
-
checksum = "
|
|
214
|
+
checksum = "8bf94ee265674bf76c09fa430b0e99c26e319c945d96ca0d5a8215f31bf81cf7"
|
|
215
215
|
dependencies = [
|
|
216
216
|
"target-lexicon",
|
|
217
217
|
]
|
|
218
218
|
|
|
219
219
|
[[package]]
|
|
220
220
|
name = "pyo3-ffi"
|
|
221
|
-
version = "0.28.
|
|
221
|
+
version = "0.28.2"
|
|
222
222
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
223
|
-
checksum = "
|
|
223
|
+
checksum = "491aa5fc66d8059dd44a75f4580a2962c1862a1c2945359db36f6c2818b748dc"
|
|
224
224
|
dependencies = [
|
|
225
225
|
"libc",
|
|
226
226
|
"pyo3-build-config",
|
|
@@ -228,9 +228,9 @@ dependencies = [
|
|
|
228
228
|
|
|
229
229
|
[[package]]
|
|
230
230
|
name = "pyo3-macros"
|
|
231
|
-
version = "0.28.
|
|
231
|
+
version = "0.28.2"
|
|
232
232
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
-
checksum = "
|
|
233
|
+
checksum = "f5d671734e9d7a43449f8480f8b38115df67bef8d21f76837fa75ee7aaa5e52e"
|
|
234
234
|
dependencies = [
|
|
235
235
|
"proc-macro2",
|
|
236
236
|
"pyo3-macros-backend",
|
|
@@ -240,9 +240,9 @@ dependencies = [
|
|
|
240
240
|
|
|
241
241
|
[[package]]
|
|
242
242
|
name = "pyo3-macros-backend"
|
|
243
|
-
version = "0.28.
|
|
243
|
+
version = "0.28.2"
|
|
244
244
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
245
|
-
checksum = "
|
|
245
|
+
checksum = "22faaa1ce6c430a1f71658760497291065e6450d7b5dc2bcf254d49f66ee700a"
|
|
246
246
|
dependencies = [
|
|
247
247
|
"heck",
|
|
248
248
|
"proc-macro2",
|
|
@@ -251,19 +251,11 @@ dependencies = [
|
|
|
251
251
|
"syn",
|
|
252
252
|
]
|
|
253
253
|
|
|
254
|
-
[[package]]
|
|
255
|
-
name = "python-urlpattern"
|
|
256
|
-
version = "0.1.9"
|
|
257
|
-
dependencies = [
|
|
258
|
-
"pyo3",
|
|
259
|
-
"urlpattern",
|
|
260
|
-
]
|
|
261
|
-
|
|
262
254
|
[[package]]
|
|
263
255
|
name = "quote"
|
|
264
|
-
version = "1.0.
|
|
256
|
+
version = "1.0.45"
|
|
265
257
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
266
|
-
checksum = "
|
|
258
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
267
259
|
dependencies = [
|
|
268
260
|
"proc-macro2",
|
|
269
261
|
]
|
|
@@ -293,9 +285,9 @@ dependencies = [
|
|
|
293
285
|
|
|
294
286
|
[[package]]
|
|
295
287
|
name = "regex-syntax"
|
|
296
|
-
version = "0.8.
|
|
288
|
+
version = "0.8.10"
|
|
297
289
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
298
|
-
checksum = "
|
|
290
|
+
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
|
299
291
|
|
|
300
292
|
[[package]]
|
|
301
293
|
name = "serde"
|
|
@@ -341,9 +333,9 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
|
|
341
333
|
|
|
342
334
|
[[package]]
|
|
343
335
|
name = "syn"
|
|
344
|
-
version = "2.0.
|
|
336
|
+
version = "2.0.117"
|
|
345
337
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
346
|
-
checksum = "
|
|
338
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
347
339
|
dependencies = [
|
|
348
340
|
"proc-macro2",
|
|
349
341
|
"quote",
|
|
@@ -363,9 +355,9 @@ dependencies = [
|
|
|
363
355
|
|
|
364
356
|
[[package]]
|
|
365
357
|
name = "target-lexicon"
|
|
366
|
-
version = "0.13.
|
|
358
|
+
version = "0.13.5"
|
|
367
359
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
368
|
-
checksum = "
|
|
360
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
369
361
|
|
|
370
362
|
[[package]]
|
|
371
363
|
name = "tinystr"
|
|
@@ -379,9 +371,9 @@ dependencies = [
|
|
|
379
371
|
|
|
380
372
|
[[package]]
|
|
381
373
|
name = "unicode-ident"
|
|
382
|
-
version = "1.0.
|
|
374
|
+
version = "1.0.24"
|
|
383
375
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
384
|
-
checksum = "
|
|
376
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
385
377
|
|
|
386
378
|
[[package]]
|
|
387
379
|
name = "url"
|
|
@@ -395,6 +387,14 @@ dependencies = [
|
|
|
395
387
|
"serde",
|
|
396
388
|
]
|
|
397
389
|
|
|
390
|
+
[[package]]
|
|
391
|
+
name = "urlpattern"
|
|
392
|
+
version = "0.2.0"
|
|
393
|
+
dependencies = [
|
|
394
|
+
"pyo3",
|
|
395
|
+
"urlpattern 0.6.0",
|
|
396
|
+
]
|
|
397
|
+
|
|
398
398
|
[[package]]
|
|
399
399
|
name = "urlpattern"
|
|
400
400
|
version = "0.6.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
|
-
name = "
|
|
3
|
-
version = "0.
|
|
2
|
+
name = "urlpattern"
|
|
3
|
+
version = "0.2.0"
|
|
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.28.
|
|
19
|
-
|
|
18
|
+
pyo3 = "0.28.2"
|
|
19
|
+
deno-urlpattern = { version = "0.6.0", package = "urlpattern" }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: urlpattern
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -30,7 +30,7 @@ Project-URL: Homepage, https://github.com/urlpattern/python-urlpattern
|
|
|
30
30
|
Project-URL: Issues, https://github.com/urlpattern/python-urlpattern/issues
|
|
31
31
|
Project-URL: Repository, https://github.com/urlpattern/python-urlpattern.git
|
|
32
32
|
|
|
33
|
-
#
|
|
33
|
+
# urlpattern
|
|
34
34
|
|
|
35
35
|
[](https://pypi.org/project/urlpattern/)
|
|
36
36
|
[](https://pypi.org/project/urlpattern/)
|
|
@@ -94,9 +94,12 @@ print(result["pathname"]["groups"]["id"]) # output: 4163
|
|
|
94
94
|
```py
|
|
95
95
|
from urlpattern import URLPattern
|
|
96
96
|
|
|
97
|
-
pattern = URLPattern(
|
|
98
|
-
print(pattern.test(
|
|
99
|
-
print(pattern.test("
|
|
97
|
+
pattern = URLPattern("b", "https://example.com/a/")
|
|
98
|
+
print(pattern.test("a/b", "https://example.com/")) # output: True
|
|
99
|
+
print(pattern.test("b", "https://example.com/a/")) # output: True
|
|
100
|
+
print(
|
|
101
|
+
pattern.test({"pathname": "b", "baseURL": "https://example.com/a/"})
|
|
102
|
+
) # output: True
|
|
100
103
|
```
|
|
101
104
|
|
|
102
105
|
### `ignoreCase`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# urlpattern
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/urlpattern/)
|
|
4
4
|
[](https://pypi.org/project/urlpattern/)
|
|
@@ -62,9 +62,12 @@ print(result["pathname"]["groups"]["id"]) # output: 4163
|
|
|
62
62
|
```py
|
|
63
63
|
from urlpattern import URLPattern
|
|
64
64
|
|
|
65
|
-
pattern = URLPattern(
|
|
66
|
-
print(pattern.test(
|
|
67
|
-
print(pattern.test("
|
|
65
|
+
pattern = URLPattern("b", "https://example.com/a/")
|
|
66
|
+
print(pattern.test("a/b", "https://example.com/")) # output: True
|
|
67
|
+
print(pattern.test("b", "https://example.com/a/")) # output: True
|
|
68
|
+
print(
|
|
69
|
+
pattern.test({"pathname": "b", "baseURL": "https://example.com/a/"})
|
|
70
|
+
) # output: True
|
|
68
71
|
```
|
|
69
72
|
|
|
70
73
|
### `ignoreCase`
|
|
@@ -76,6 +76,7 @@ impl UrlPattern {
|
|
|
76
76
|
dict.set_item("pathname", self.0.pathname()).unwrap();
|
|
77
77
|
dict.set_item("search", self.0.search()).unwrap();
|
|
78
78
|
dict.set_item("hash", self.0.hash()).unwrap();
|
|
79
|
+
dict.set_item("hasRegExpGroups", self.0.has_regexp_groups()).unwrap();
|
|
79
80
|
format!("URLPattern({})", dict)
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -194,6 +195,11 @@ impl UrlPattern {
|
|
|
194
195
|
pub fn get_hash(&self) -> PyResult<&str> {
|
|
195
196
|
Ok(self.0.hash())
|
|
196
197
|
}
|
|
198
|
+
|
|
199
|
+
#[getter]
|
|
200
|
+
pub fn get_hasRegExpGroups(&self) -> PyResult<bool> {
|
|
201
|
+
Ok(self.0.has_regexp_groups())
|
|
202
|
+
}
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
#[derive(FromPyObject)]
|
|
@@ -19,7 +19,7 @@ urlpatterntestdata = json.loads(
|
|
|
19
19
|
|
|
20
20
|
@pytest.mark.parametrize("entry", urlpatterntestdata)
|
|
21
21
|
def test(entry):
|
|
22
|
-
if entry["pattern"] == [{"pathname": "*{}**?"}]:
|
|
22
|
+
if entry["pattern"] == [{"pathname": "*{}**?"}] or entry["pattern"] == ["((?R)):"]:
|
|
23
23
|
pytest.skip("unsupported in the implementation")
|
|
24
24
|
|
|
25
25
|
if entry.get("expected_obj") == "error":
|
|
@@ -3118,5 +3118,41 @@
|
|
|
3118
3118
|
"expected_match": {
|
|
3119
3119
|
"hostname": { "input": "localhost", "groups": { "domain" : "localhost"} }
|
|
3120
3120
|
}
|
|
3121
|
+
},
|
|
3122
|
+
{
|
|
3123
|
+
"pattern": ["((?R)):"],
|
|
3124
|
+
"expected_obj": "error"
|
|
3125
|
+
},
|
|
3126
|
+
{
|
|
3127
|
+
"pattern": ["(\\H):"],
|
|
3128
|
+
"expected_obj": "error"
|
|
3129
|
+
},
|
|
3130
|
+
{
|
|
3131
|
+
"pattern": [
|
|
3132
|
+
{"pathname": "/:foo((?<x>a))"}
|
|
3133
|
+
],
|
|
3134
|
+
"inputs": [
|
|
3135
|
+
{"pathname": "/a"}
|
|
3136
|
+
],
|
|
3137
|
+
"expected_match": {
|
|
3138
|
+
"pathname": {
|
|
3139
|
+
"input": "/a",
|
|
3140
|
+
"groups": {"foo": "a"}
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
},
|
|
3144
|
+
{
|
|
3145
|
+
"pattern": [
|
|
3146
|
+
{"pathname": "/foo/(bar(?<x>baz))"}
|
|
3147
|
+
],
|
|
3148
|
+
"inputs": [
|
|
3149
|
+
{"pathname": "/foo/barbaz"}
|
|
3150
|
+
],
|
|
3151
|
+
"expected_match": {
|
|
3152
|
+
"pathname": {
|
|
3153
|
+
"input": "/foo/barbaz",
|
|
3154
|
+
"groups": {"0": "barbaz"}
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3121
3157
|
}
|
|
3122
3158
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|