urlpattern 0.1.0__cp311-none-win32.whl
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/__init__.py +5 -0
- urlpattern/__init__.pyi +58 -0
- urlpattern/py.typed +0 -0
- urlpattern/urlpattern.cp311-win32.pyd +0 -0
- urlpattern-0.1.0.dist-info/METADATA +69 -0
- urlpattern-0.1.0.dist-info/RECORD +8 -0
- urlpattern-0.1.0.dist-info/WHEEL +4 -0
- urlpattern-0.1.0.dist-info/license_files/LICENSE.txt +21 -0
urlpattern/__init__.py
ADDED
urlpattern/__init__.pyi
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from typing_extensions import TypeAlias, TypedDict, overload
|
|
2
|
+
|
|
3
|
+
URLPatternInput: TypeAlias = str | URLPatternInit
|
|
4
|
+
|
|
5
|
+
class URLPattern:
|
|
6
|
+
@overload
|
|
7
|
+
def __init__(input: URLPatternInput, baseURL: str): ...
|
|
8
|
+
@overload
|
|
9
|
+
def __init__(input: URLPatternInput = {}): ...
|
|
10
|
+
def test(input: URLPatternInput = {}, baseURL: str | None = None) -> bool: ...
|
|
11
|
+
def exec(
|
|
12
|
+
input: URLPatternInput = {}, baseURL: str | None = None
|
|
13
|
+
) -> URLPatternResult | None: ...
|
|
14
|
+
@property
|
|
15
|
+
def protocol(self) -> str: ...
|
|
16
|
+
@property
|
|
17
|
+
def username(self) -> str: ...
|
|
18
|
+
@property
|
|
19
|
+
def password(self) -> str: ...
|
|
20
|
+
@property
|
|
21
|
+
def hostname(self) -> str: ...
|
|
22
|
+
@property
|
|
23
|
+
def port(self) -> str: ...
|
|
24
|
+
@property
|
|
25
|
+
def pathname(self) -> str: ...
|
|
26
|
+
@property
|
|
27
|
+
def search(self) -> str: ...
|
|
28
|
+
@property
|
|
29
|
+
def hash(self) -> str: ...
|
|
30
|
+
|
|
31
|
+
class URLPatternInit(TypedDict):
|
|
32
|
+
protocol: str
|
|
33
|
+
username: str
|
|
34
|
+
password: str
|
|
35
|
+
hostname: str
|
|
36
|
+
port: str
|
|
37
|
+
pathname: str
|
|
38
|
+
search: str
|
|
39
|
+
hash: str
|
|
40
|
+
baseURL: str
|
|
41
|
+
|
|
42
|
+
class URLPatternResult(TypedDict):
|
|
43
|
+
inputs: list[URLPatternInput]
|
|
44
|
+
|
|
45
|
+
protocol: URLPatternComponentResult
|
|
46
|
+
username: URLPatternComponentResult
|
|
47
|
+
password: URLPatternComponentResult
|
|
48
|
+
hostname: URLPatternComponentResult
|
|
49
|
+
port: URLPatternComponentResult
|
|
50
|
+
pathname: URLPatternComponentResult
|
|
51
|
+
search: URLPatternComponentResult
|
|
52
|
+
hash: URLPatternComponentResult
|
|
53
|
+
|
|
54
|
+
class URLPatternComponentResult(TypedDict):
|
|
55
|
+
input: str
|
|
56
|
+
groups: dict[str, str]
|
|
57
|
+
|
|
58
|
+
URLPatternCompatible: TypeAlias = str | URLPatternInit | URLPattern
|
urlpattern/py.typed
ADDED
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: urlpattern
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Rust
|
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
License-File: LICENSE.txt
|
|
21
|
+
Summary: An implementation of the URL Pattern Standard for Python written in Rust
|
|
22
|
+
Keywords: urlpattern
|
|
23
|
+
Author: 방성범 (Bang Seongbeom) <bangseongbeom@gmail.com>
|
|
24
|
+
Author-email: "방성범 (Bang Seongbeom)" <bangseongbeom@gmail.com>
|
|
25
|
+
License: MIT
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
28
|
+
Project-URL: Homepage, https://github.com/urlpattern/python-urlpattern
|
|
29
|
+
Project-URL: Repository, https://github.com/urlpattern/python-urlpattern.git
|
|
30
|
+
Project-URL: Issues, https://github.com/urlpattern/python-urlpattern/issues
|
|
31
|
+
|
|
32
|
+
# URL Pattern
|
|
33
|
+
|
|
34
|
+
An implementation of [the URL Pattern Standard](https://urlpattern.spec.whatwg.org/) for Python written in Rust
|
|
35
|
+
|
|
36
|
+
This is 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).
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
On Linux/UNIX or macOS:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pip install urlpattern
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
On Windows:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
py -m pip install urlpattern
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Example
|
|
53
|
+
|
|
54
|
+
```py
|
|
55
|
+
from urlpattern import URLPattern
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
pattern = URLPattern("https://example.com/*")
|
|
59
|
+
print(pattern.test("https://example.com/foo/bar")) # output: True
|
|
60
|
+
|
|
61
|
+
pattern = URLPattern({"pathname": "/:foo/:bar"})
|
|
62
|
+
result = pattern.exec("/abc/def", "https://test.example")
|
|
63
|
+
print(result["pathname"]["groups"]["foo"]) # output: abc
|
|
64
|
+
print(result["pathname"]["groups"]["bar"]) # output: def
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
[MIT License](/LICENSE)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
urlpattern-0.1.0.dist-info/METADATA,sha256=CyMvzUN2XQoDJeEOl7KWHeMMwFrESch21HHuHzkM6QI,2349
|
|
2
|
+
urlpattern-0.1.0.dist-info/WHEEL,sha256=ogvzlzVSDq6E5spbmEmJae_ofILdXZlnjMZFm-16eCE,91
|
|
3
|
+
urlpattern-0.1.0.dist-info/license_files/LICENSE.txt,sha256=_qapitbsCkJk_1XOkLpKwq-BiN5jH65q65PF4jnvJhg,1102
|
|
4
|
+
urlpattern/__init__.py,sha256=Yh9wWY3jN3l1xnfDMxdJFCrv7hLaidjhrUcnDS71DIU,123
|
|
5
|
+
urlpattern/__init__.pyi,sha256=C8gpGklhGK1V12jvSa-60pyoODvJGcyDRUOLSUE2_9g,1631
|
|
6
|
+
urlpattern/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
urlpattern/urlpattern.cp311-win32.pyd,sha256=l0qhbgtL9VlkirSgCFJBMAQVwm2kzzxU-hoQkt0Jc8s,2005504
|
|
8
|
+
urlpattern-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 방성범 (Bang Seongbeom)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|