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.
@@ -1,4 +1,4 @@
1
- # This file is autogenerated by maturin v1.12.0
1
+ # This file is autogenerated by maturin v1.12.3
2
2
  # To update, run
3
3
  #
4
4
  # maturin generate-ci github
@@ -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.182"
144
+ version = "0.2.183"
145
145
  source = "registry+https://github.com/rust-lang/crates.io-index"
146
- checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
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.3"
162
+ version = "1.21.4"
163
163
  source = "registry+https://github.com/rust-lang/crates.io-index"
164
- checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
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.1"
198
+ version = "0.28.2"
199
199
  source = "registry+https://github.com/rust-lang/crates.io-index"
200
- checksum = "14c738662e2181be11cb82487628404254902bb3225d8e9e99c31f3ef82a405c"
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.1"
212
+ version = "0.28.2"
213
213
  source = "registry+https://github.com/rust-lang/crates.io-index"
214
- checksum = "f9ca0864a7dd3c133a7f3f020cbff2e12e88420da854c35540fd20ce2d60e435"
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.1"
221
+ version = "0.28.2"
222
222
  source = "registry+https://github.com/rust-lang/crates.io-index"
223
- checksum = "9dfc1956b709823164763a34cc42bbfd26b8730afa77809a3df8b94a3ae3b059"
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.1"
231
+ version = "0.28.2"
232
232
  source = "registry+https://github.com/rust-lang/crates.io-index"
233
- checksum = "29dc660ad948bae134d579661d08033fbb1918f4529c3bbe3257a68f2009ddf2"
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.1"
243
+ version = "0.28.2"
244
244
  source = "registry+https://github.com/rust-lang/crates.io-index"
245
- checksum = "e78cd6c6d718acfcedf26c3d21fe0f053624368b0d44298c55d7138fde9331f7"
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.44"
256
+ version = "1.0.45"
265
257
  source = "registry+https://github.com/rust-lang/crates.io-index"
266
- checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
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.9"
288
+ version = "0.8.10"
297
289
  source = "registry+https://github.com/rust-lang/crates.io-index"
298
- checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
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.115"
336
+ version = "2.0.117"
345
337
  source = "registry+https://github.com/rust-lang/crates.io-index"
346
- checksum = "6e614ed320ac28113fa64972c4262d5dbc89deacdfd00c34a3e4cea073243c12"
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.4"
358
+ version = "0.13.5"
367
359
  source = "registry+https://github.com/rust-lang/crates.io-index"
368
- checksum = "b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba"
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.23"
374
+ version = "1.0.24"
383
375
  source = "registry+https://github.com/rust-lang/crates.io-index"
384
- checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e"
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 = "python-urlpattern"
3
- version = "0.1.9"
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.0"
19
- deno_urlpattern = { package = "urlpattern", version = "0.6.0" }
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.1.9
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
- # URL Pattern
33
+ # urlpattern
34
34
 
35
35
  [![PyPI - Version](https://img.shields.io/pypi/v/urlpattern)](https://pypi.org/project/urlpattern/)
36
36
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/urlpattern)](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({"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
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
- # URL Pattern
1
+ # urlpattern
2
2
 
3
3
  [![PyPI - Version](https://img.shields.io/pypi/v/urlpattern)](https://pypi.org/project/urlpattern/)
4
4
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/urlpattern)](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({"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
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
  ]
@@ -76,6 +76,8 @@ class URLPattern:
76
76
  def search(self) -> str: ...
77
77
  @property
78
78
  def hash(self) -> str: ...
79
+ @property
80
+ def hasRegExpGroups(self) -> bool: ...
79
81
 
80
82
  class URLPatternInit(TypedDict, total=False):
81
83
  protocol: str
@@ -1,8 +0,0 @@
1
- {
2
- "python.defaultInterpreterPath": "${workspaceFolder}/.venv",
3
- "python.testing.pytestArgs": [
4
- "tests"
5
- ],
6
- "python.testing.unittestEnabled": false,
7
- "python.testing.pytestEnabled": true
8
- }
File without changes
File without changes
File without changes
File without changes