idna 3.7__tar.gz → 3.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.
- {idna-3.7 → idna-3.9}/HISTORY.rst +21 -0
- {idna-3.7 → idna-3.9}/PKG-INFO +15 -8
- {idna-3.7 → idna-3.9}/README.rst +7 -5
- {idna-3.7 → idna-3.9}/idna/__init__.py +2 -1
- {idna-3.7 → idna-3.9}/idna/codec.py +31 -27
- {idna-3.7 → idna-3.9}/idna/compat.py +6 -4
- idna-3.9/idna/core.py +475 -0
- idna-3.9/idna/idnadata.py +4309 -0
- {idna-3.7 → idna-3.9}/idna/intranges.py +7 -4
- idna-3.9/idna/package_data.py +1 -0
- idna-3.9/idna/uts46data.py +8841 -0
- {idna-3.7 → idna-3.9}/pyproject.toml +17 -2
- idna-3.9/tests/test_idna.py +293 -0
- {idna-3.7 → idna-3.9}/tests/test_idna_codec.py +37 -14
- idna-3.9/tests/test_idna_compat.py +26 -0
- {idna-3.7 → idna-3.9}/tests/test_idna_other.py +2 -5
- idna-3.9/tests/test_idna_uts46.py +220 -0
- {idna-3.7 → idna-3.9}/tests/test_intranges.py +33 -16
- {idna-3.7 → idna-3.9}/tools/idna-data +31 -21
- idna-3.7/idna/core.py +0 -395
- idna-3.7/idna/idnadata.py +0 -4245
- idna-3.7/idna/package_data.py +0 -2
- idna-3.7/idna/uts46data.py +0 -8598
- idna-3.7/tests/test_idna.py +0 -275
- idna-3.7/tests/test_idna_compat.py +0 -19
- idna-3.7/tests/test_idna_uts46.py +0 -190
- {idna-3.7 → idna-3.9}/LICENSE.md +0 -0
- {idna-3.7 → idna-3.9}/idna/py.typed +0 -0
- {idna-3.7 → idna-3.9}/tests/IdnaTestV2.txt +0 -0
- {idna-3.7 → idna-3.9}/tests/__init__.py +0 -0
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
History
|
|
4
4
|
-------
|
|
5
5
|
|
|
6
|
+
3.9 (2024-09-13)
|
|
7
|
+
++++++++++++++++
|
|
8
|
+
|
|
9
|
+
- Update to Unicode 16.0.0
|
|
10
|
+
- Deprecate setup.cfg in favour of pyproject.toml
|
|
11
|
+
- Use ruff for code formatting
|
|
12
|
+
|
|
13
|
+
Thanks to Waket Zheng for contributions to this release.
|
|
14
|
+
|
|
15
|
+
3.8 (2024-08-23)
|
|
16
|
+
++++++++++++++++
|
|
17
|
+
|
|
18
|
+
- Fix regression where IDNAError exception was not being produced for
|
|
19
|
+
certain inputs.
|
|
20
|
+
- Add support for Python 3.13, drop support for Python 3.5 as it is no
|
|
21
|
+
longer testable.
|
|
22
|
+
- Documentation improvements
|
|
23
|
+
- Updates to package testing using Github actions
|
|
24
|
+
|
|
25
|
+
Thanks to Hugo van Kemenade for contributions to this release.
|
|
26
|
+
|
|
6
27
|
3.7 (2024-04-11)
|
|
7
28
|
++++++++++++++++
|
|
8
29
|
|
{idna-3.7 → idna-3.9}/PKG-INFO
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: idna
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.9
|
|
4
4
|
Summary: Internationalized Domain Names in Applications (IDNA)
|
|
5
5
|
Author-email: Kim Davies <kim+pypi@gumleaf.org>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.6
|
|
7
7
|
Description-Content-Type: text/x-rst
|
|
8
8
|
Classifier: Development Status :: 5 - Production/Stable
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
@@ -13,7 +13,6 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.6
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.7
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -21,14 +20,20 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
24
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
25
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
26
26
|
Classifier: Topic :: Internet :: Name Service (DNS)
|
|
27
27
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
28
|
Classifier: Topic :: Utilities
|
|
29
|
+
Requires-Dist: ruff >= 0.6.2 ; extra == "all"
|
|
30
|
+
Requires-Dist: mypy >= 1.11.2 ; extra == "all"
|
|
31
|
+
Requires-Dist: pytest >= 8.3.2 ; extra == "all"
|
|
32
|
+
Requires-Dist: flake8 >= 7.1.1 ; extra == "all"
|
|
29
33
|
Project-URL: Changelog, https://github.com/kjd/idna/blob/master/HISTORY.rst
|
|
30
34
|
Project-URL: Issue tracker, https://github.com/kjd/idna/issues
|
|
31
35
|
Project-URL: Source, https://github.com/kjd/idna
|
|
36
|
+
Provides-Extra: all
|
|
32
37
|
|
|
33
38
|
Internationalized Domain Names in Applications (IDNA)
|
|
34
39
|
=====================================================
|
|
@@ -115,7 +120,9 @@ This library provides one such mapping that was developed by the
|
|
|
115
120
|
Unicode Consortium. Known as `Unicode IDNA Compatibility Processing
|
|
116
121
|
<https://unicode.org/reports/tr46/>`_, it provides for both a regular
|
|
117
122
|
mapping for typical applications, as well as a transitional mapping to
|
|
118
|
-
help migrate from older IDNA 2003 applications.
|
|
123
|
+
help migrate from older IDNA 2003 applications. Strings are
|
|
124
|
+
preprocessed according to Section 4.4 “Preprocessing for IDNA2008”
|
|
125
|
+
prior to the IDNA operations.
|
|
119
126
|
|
|
120
127
|
For example, “Königsgäßchen” is not a permissible label as *LATIN
|
|
121
128
|
CAPITAL LETTER K* is not allowed (nor are capital letters in general).
|
|
@@ -215,7 +222,7 @@ Additional Notes
|
|
|
215
222
|
* **Packages**. The latest tagged release version is published in the
|
|
216
223
|
`Python Package Index <https://pypi.org/project/idna/>`_.
|
|
217
224
|
|
|
218
|
-
* **Version support**. This library supports Python 3.
|
|
225
|
+
* **Version support**. This library supports Python 3.6 and higher.
|
|
219
226
|
As this library serves as a low-level toolkit for a variety of
|
|
220
227
|
applications, many of which strive for broad compatibility with older
|
|
221
228
|
Python versions, there is no rush to remove older interpreter support.
|
|
@@ -223,9 +230,9 @@ Additional Notes
|
|
|
223
230
|
maintenance burden has become too high.
|
|
224
231
|
|
|
225
232
|
* **Python 2**. Python 2 is supported by version 2.x of this library.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
233
|
+
Use "idna<3" in your requirements file if you need this library for
|
|
234
|
+
a Python 2 application. Be advised that these versions are no longer
|
|
235
|
+
actively developed.
|
|
229
236
|
|
|
230
237
|
* **Testing**. The library has a test suite based on each rule of the
|
|
231
238
|
IDNA specification, as well as tests that are provided as part of the
|
{idna-3.7 → idna-3.9}/README.rst
RENAMED
|
@@ -83,7 +83,9 @@ This library provides one such mapping that was developed by the
|
|
|
83
83
|
Unicode Consortium. Known as `Unicode IDNA Compatibility Processing
|
|
84
84
|
<https://unicode.org/reports/tr46/>`_, it provides for both a regular
|
|
85
85
|
mapping for typical applications, as well as a transitional mapping to
|
|
86
|
-
help migrate from older IDNA 2003 applications.
|
|
86
|
+
help migrate from older IDNA 2003 applications. Strings are
|
|
87
|
+
preprocessed according to Section 4.4 “Preprocessing for IDNA2008”
|
|
88
|
+
prior to the IDNA operations.
|
|
87
89
|
|
|
88
90
|
For example, “Königsgäßchen” is not a permissible label as *LATIN
|
|
89
91
|
CAPITAL LETTER K* is not allowed (nor are capital letters in general).
|
|
@@ -183,7 +185,7 @@ Additional Notes
|
|
|
183
185
|
* **Packages**. The latest tagged release version is published in the
|
|
184
186
|
`Python Package Index <https://pypi.org/project/idna/>`_.
|
|
185
187
|
|
|
186
|
-
* **Version support**. This library supports Python 3.
|
|
188
|
+
* **Version support**. This library supports Python 3.6 and higher.
|
|
187
189
|
As this library serves as a low-level toolkit for a variety of
|
|
188
190
|
applications, many of which strive for broad compatibility with older
|
|
189
191
|
Python versions, there is no rush to remove older interpreter support.
|
|
@@ -191,9 +193,9 @@ Additional Notes
|
|
|
191
193
|
maintenance burden has become too high.
|
|
192
194
|
|
|
193
195
|
* **Python 2**. Python 2 is supported by version 2.x of this library.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
Use "idna<3" in your requirements file if you need this library for
|
|
197
|
+
a Python 2 application. Be advised that these versions are no longer
|
|
198
|
+
actively developed.
|
|
197
199
|
|
|
198
200
|
* **Testing**. The library has a test suite based on each rule of the
|
|
199
201
|
IDNA specification, as well as tests that are provided as part of the
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from .package_data import __version__
|
|
2
1
|
from .core import (
|
|
3
2
|
IDNABidiError,
|
|
4
3
|
IDNAError,
|
|
@@ -20,8 +19,10 @@ from .core import (
|
|
|
20
19
|
valid_string_length,
|
|
21
20
|
)
|
|
22
21
|
from .intranges import intranges_contain
|
|
22
|
+
from .package_data import __version__
|
|
23
23
|
|
|
24
24
|
__all__ = [
|
|
25
|
+
"__version__",
|
|
25
26
|
"IDNABidiError",
|
|
26
27
|
"IDNAError",
|
|
27
28
|
"InvalidCodepoint",
|
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
from .core import encode, decode, alabel, ulabel, IDNAError
|
|
2
1
|
import codecs
|
|
3
2
|
import re
|
|
4
|
-
from typing import Any,
|
|
3
|
+
from typing import Any, Optional, Tuple
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
from .core import IDNAError, alabel, decode, encode, ulabel
|
|
6
|
+
|
|
7
|
+
_unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]")
|
|
7
8
|
|
|
8
|
-
class Codec(codecs.Codec):
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
class Codec(codecs.Codec):
|
|
11
|
+
def encode(self, data: str, errors: str = "strict") -> Tuple[bytes, int]:
|
|
12
|
+
if errors != "strict":
|
|
13
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
13
14
|
|
|
14
15
|
if not data:
|
|
15
16
|
return b"", 0
|
|
16
17
|
|
|
17
18
|
return encode(data), len(data)
|
|
18
19
|
|
|
19
|
-
def decode(self, data: bytes, errors: str =
|
|
20
|
-
if errors !=
|
|
21
|
-
raise IDNAError('Unsupported error handling
|
|
20
|
+
def decode(self, data: bytes, errors: str = "strict") -> Tuple[str, int]:
|
|
21
|
+
if errors != "strict":
|
|
22
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
22
23
|
|
|
23
24
|
if not data:
|
|
24
|
-
return
|
|
25
|
+
return "", 0
|
|
25
26
|
|
|
26
27
|
return decode(data), len(data)
|
|
27
28
|
|
|
29
|
+
|
|
28
30
|
class IncrementalEncoder(codecs.BufferedIncrementalEncoder):
|
|
29
31
|
def _buffer_encode(self, data: str, errors: str, final: bool) -> Tuple[bytes, int]:
|
|
30
|
-
if errors !=
|
|
31
|
-
raise IDNAError('Unsupported error handling
|
|
32
|
+
if errors != "strict":
|
|
33
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
32
34
|
|
|
33
35
|
if not data:
|
|
34
|
-
return b
|
|
36
|
+
return b"", 0
|
|
35
37
|
|
|
36
38
|
labels = _unicode_dots_re.split(data)
|
|
37
|
-
trailing_dot = b
|
|
39
|
+
trailing_dot = b""
|
|
38
40
|
if labels:
|
|
39
41
|
if not labels[-1]:
|
|
40
|
-
trailing_dot = b
|
|
42
|
+
trailing_dot = b"."
|
|
41
43
|
del labels[-1]
|
|
42
44
|
elif not final:
|
|
43
45
|
# Keep potentially unfinished label until the next call
|
|
44
46
|
del labels[-1]
|
|
45
47
|
if labels:
|
|
46
|
-
trailing_dot = b
|
|
48
|
+
trailing_dot = b"."
|
|
47
49
|
|
|
48
50
|
result = []
|
|
49
51
|
size = 0
|
|
@@ -54,32 +56,33 @@ class IncrementalEncoder(codecs.BufferedIncrementalEncoder):
|
|
|
54
56
|
size += len(label)
|
|
55
57
|
|
|
56
58
|
# Join with U+002E
|
|
57
|
-
result_bytes = b
|
|
59
|
+
result_bytes = b".".join(result) + trailing_dot
|
|
58
60
|
size += len(trailing_dot)
|
|
59
61
|
return result_bytes, size
|
|
60
62
|
|
|
63
|
+
|
|
61
64
|
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
|
|
62
65
|
def _buffer_decode(self, data: Any, errors: str, final: bool) -> Tuple[str, int]:
|
|
63
|
-
if errors !=
|
|
64
|
-
raise IDNAError('Unsupported error handling
|
|
66
|
+
if errors != "strict":
|
|
67
|
+
raise IDNAError('Unsupported error handling "{}"'.format(errors))
|
|
65
68
|
|
|
66
69
|
if not data:
|
|
67
|
-
return (
|
|
70
|
+
return ("", 0)
|
|
68
71
|
|
|
69
72
|
if not isinstance(data, str):
|
|
70
|
-
data = str(data,
|
|
73
|
+
data = str(data, "ascii")
|
|
71
74
|
|
|
72
75
|
labels = _unicode_dots_re.split(data)
|
|
73
|
-
trailing_dot =
|
|
76
|
+
trailing_dot = ""
|
|
74
77
|
if labels:
|
|
75
78
|
if not labels[-1]:
|
|
76
|
-
trailing_dot =
|
|
79
|
+
trailing_dot = "."
|
|
77
80
|
del labels[-1]
|
|
78
81
|
elif not final:
|
|
79
82
|
# Keep potentially unfinished label until the next call
|
|
80
83
|
del labels[-1]
|
|
81
84
|
if labels:
|
|
82
|
-
trailing_dot =
|
|
85
|
+
trailing_dot = "."
|
|
83
86
|
|
|
84
87
|
result = []
|
|
85
88
|
size = 0
|
|
@@ -89,7 +92,7 @@ class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
|
|
|
89
92
|
size += 1
|
|
90
93
|
size += len(label)
|
|
91
94
|
|
|
92
|
-
result_str =
|
|
95
|
+
result_str = ".".join(result) + trailing_dot
|
|
93
96
|
size += len(trailing_dot)
|
|
94
97
|
return (result_str, size)
|
|
95
98
|
|
|
@@ -103,7 +106,7 @@ class StreamReader(Codec, codecs.StreamReader):
|
|
|
103
106
|
|
|
104
107
|
|
|
105
108
|
def search_function(name: str) -> Optional[codecs.CodecInfo]:
|
|
106
|
-
if name !=
|
|
109
|
+
if name != "idna2008":
|
|
107
110
|
return None
|
|
108
111
|
return codecs.CodecInfo(
|
|
109
112
|
name=name,
|
|
@@ -115,4 +118,5 @@ def search_function(name: str) -> Optional[codecs.CodecInfo]:
|
|
|
115
118
|
streamreader=StreamReader,
|
|
116
119
|
)
|
|
117
120
|
|
|
121
|
+
|
|
118
122
|
codecs.register(search_function)
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
from .core import *
|
|
2
|
-
from .codec import *
|
|
3
1
|
from typing import Any, Union
|
|
4
2
|
|
|
3
|
+
from .core import decode, encode
|
|
4
|
+
|
|
5
|
+
|
|
5
6
|
def ToASCII(label: str) -> bytes:
|
|
6
7
|
return encode(label)
|
|
7
8
|
|
|
9
|
+
|
|
8
10
|
def ToUnicode(label: Union[bytes, bytearray]) -> str:
|
|
9
11
|
return decode(label)
|
|
10
12
|
|
|
11
|
-
def nameprep(s: Any) -> None:
|
|
12
|
-
raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol')
|
|
13
13
|
|
|
14
|
+
def nameprep(s: Any) -> None:
|
|
15
|
+
raise NotImplementedError("IDNA 2008 does not utilise nameprep protocol")
|