pyunormalize 16.0.0__py3-none-any.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.
- pyunormalize/__init__.py +51 -0
- pyunormalize/_unicode.py +8370 -0
- pyunormalize/_version.py +1 -0
- pyunormalize/normalization.py +524 -0
- pyunormalize-16.0.0.dist-info/LICENSE +21 -0
- pyunormalize-16.0.0.dist-info/METADATA +87 -0
- pyunormalize-16.0.0.dist-info/RECORD +9 -0
- pyunormalize-16.0.0.dist-info/WHEEL +5 -0
- pyunormalize-16.0.0.dist-info/top_level.txt +1 -0
pyunormalize/__init__.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Utility for Unicode normalization.
|
|
2
|
+
|
|
3
|
+
This is a pure Python implementation of the Unicode normalization algorithm,
|
|
4
|
+
independent of the Python core Unicode database, and ensuring compliance
|
|
5
|
+
with version 16.0 of the Unicode standard (released in September 2024). It has
|
|
6
|
+
been rigorously tested using the official Unicode test file, available
|
|
7
|
+
at https://www.unicode.org/Public/16.0.0/ucd/NormalizationTest.txt.
|
|
8
|
+
|
|
9
|
+
For the formal specification of the Unicode normalization algorithm,
|
|
10
|
+
see Section 3.11, "Normalization Forms," in the Unicode core specification.
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2021-2024, Marc Lodewijck
|
|
13
|
+
All rights reserved.
|
|
14
|
+
|
|
15
|
+
This software is distributed under the MIT license.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import sys
|
|
19
|
+
|
|
20
|
+
if sys.version_info < (3, 6):
|
|
21
|
+
raise SystemExit(f"\n{__package__} requires Python 3.6 or later.")
|
|
22
|
+
del sys
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"NFC",
|
|
26
|
+
"NFD",
|
|
27
|
+
"NFKC",
|
|
28
|
+
"NFKD",
|
|
29
|
+
"normalize",
|
|
30
|
+
"UCD_VERSION",
|
|
31
|
+
"UNICODE_VERSION",
|
|
32
|
+
"__version__",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
# Unicode standard used to process the data
|
|
36
|
+
UNICODE_VERSION = UCD_VERSION = "16.0.0"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
from pyunormalize import _version
|
|
40
|
+
__version__ = _version.__version__
|
|
41
|
+
del _version
|
|
42
|
+
|
|
43
|
+
from pyunormalize._unicode import _UNICODE_VERSION
|
|
44
|
+
if _UNICODE_VERSION != UNICODE_VERSION:
|
|
45
|
+
raise SystemExit(
|
|
46
|
+
f"Unicode version mismatch in {_unicode.__name__} "
|
|
47
|
+
f"(expected {UNICODE_VERSION}, found {_UNICODE_VERSION})."
|
|
48
|
+
)
|
|
49
|
+
del _UNICODE_VERSION
|
|
50
|
+
|
|
51
|
+
from pyunormalize.normalization import *
|