ucdinfo 0.2__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.
- ucdinfo-0.2/LICENSE +21 -0
- ucdinfo-0.2/PKG-INFO +82 -0
- ucdinfo-0.2/README.md +63 -0
- ucdinfo-0.2/pyproject.toml +50 -0
- ucdinfo-0.2/setup.cfg +4 -0
- ucdinfo-0.2/setup.py +24 -0
- ucdinfo-0.2/src/ucdinfo/__init__.py +4 -0
- ucdinfo-0.2/src/ucdinfo/_initold.py +568 -0
- ucdinfo-0.2/src/ucdinfo/cache.py +223 -0
- ucdinfo-0.2/src/ucdinfo/ucd.py +580 -0
- ucdinfo-0.2/src/ucdinfo.egg-info/PKG-INFO +82 -0
- ucdinfo-0.2/src/ucdinfo.egg-info/SOURCES.txt +15 -0
- ucdinfo-0.2/src/ucdinfo.egg-info/dependency_links.txt +1 -0
- ucdinfo-0.2/src/ucdinfo.egg-info/entry_points.txt +2 -0
- ucdinfo-0.2/src/ucdinfo.egg-info/requires.txt +1 -0
- ucdinfo-0.2/src/ucdinfo.egg-info/top_level.txt +1 -0
- ucdinfo-0.2/test/test_ucd.py +13 -0
ucdinfo-0.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, SIL Global (https://www.sil.org)
|
|
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.
|
ucdinfo-0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ucdinfo
|
|
3
|
+
Version: 0.2
|
|
4
|
+
Summary: Unicode UCD wrapper module
|
|
5
|
+
Author-email: SIL WSTech <fonts@sil.org>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Home-Page, https://github.com/silnrsi/python-ucd
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: platformdirs
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# ucd Module
|
|
21
|
+
|
|
22
|
+
## Summary
|
|
23
|
+
|
|
24
|
+
A wrapper module around the Unicode Character Database which dynamically caches the latest data, compresses and gives access to nearly all the UCD data
|
|
25
|
+
|
|
26
|
+
This module contains most of the ucd information for every character in Unicode.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from ucdinfo import get_ucd, get_info, find_ucd, get_enums
|
|
32
|
+
print(get_ucd(0x0041, 'scx'))
|
|
33
|
+
print(get_info(0x0041))
|
|
34
|
+
print(get_enums("indic position"))
|
|
35
|
+
print(find_ucd("indic position", "Bottom")
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Note cjk properties are not supported for space reasons.
|
|
39
|
+
|
|
40
|
+
If you want to use your own data file (perhaps the module data is stale) the use
|
|
41
|
+
the object interface:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from ucdinfo import UCD
|
|
45
|
+
myucd = UCD(localfile="ucd.nounihan.flat.zip") # localfile falls back to bundled data
|
|
46
|
+
print(myucd.get(0x0041, 'scx'))
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The second parameter specifies the property to be queried and can either be a property from
|
|
50
|
+
https://www.unicode.org/reports/tr42, especially section 4.4 Properties, or the start of a
|
|
51
|
+
full property name from that list.
|
|
52
|
+
|
|
53
|
+
For characters not yet in Unicode, data for additional characters can
|
|
54
|
+
be temporarily appended to the bundled data:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from ucdinfo import get_ucd, loadxml
|
|
58
|
+
loadxml("extra-ucd.xml")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
or, with the object interface:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from ucdinfo import UCD
|
|
65
|
+
myucd = UCD().loadxml("extra-ucd.xml")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The named file must be coded in the same form as the "flat" UCD XML data, though the only
|
|
69
|
+
required character attributes are "cp" and anything needed by the calling process. For example:
|
|
70
|
+
|
|
71
|
+
```xml
|
|
72
|
+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
|
73
|
+
<ucd xmlns="http://www.unicode.org/ns/2003/ucd/1.0">
|
|
74
|
+
<description>Some additional characters</description>
|
|
75
|
+
<repertoire>
|
|
76
|
+
<char cp="10EC2" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER DAL WITH TWO DOTS VERTICALLY BELOW"></char>
|
|
77
|
+
<char cp="10EC3" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER TAH WITH TWO DOTS VERTICALLY BELOW"></char>
|
|
78
|
+
<char cp="10EC4" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER KAF WITH TWO DOTS VERTICALLY BELOW"></char>
|
|
79
|
+
</repertoire>
|
|
80
|
+
</ucd>
|
|
81
|
+
```
|
|
82
|
+
|
ucdinfo-0.2/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# ucd Module
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
A wrapper module around the Unicode Character Database which dynamically caches the latest data, compresses and gives access to nearly all the UCD data
|
|
6
|
+
|
|
7
|
+
This module contains most of the ucd information for every character in Unicode.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from ucdinfo import get_ucd, get_info, find_ucd, get_enums
|
|
13
|
+
print(get_ucd(0x0041, 'scx'))
|
|
14
|
+
print(get_info(0x0041))
|
|
15
|
+
print(get_enums("indic position"))
|
|
16
|
+
print(find_ucd("indic position", "Bottom")
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Note cjk properties are not supported for space reasons.
|
|
20
|
+
|
|
21
|
+
If you want to use your own data file (perhaps the module data is stale) the use
|
|
22
|
+
the object interface:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from ucdinfo import UCD
|
|
26
|
+
myucd = UCD(localfile="ucd.nounihan.flat.zip") # localfile falls back to bundled data
|
|
27
|
+
print(myucd.get(0x0041, 'scx'))
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The second parameter specifies the property to be queried and can either be a property from
|
|
31
|
+
https://www.unicode.org/reports/tr42, especially section 4.4 Properties, or the start of a
|
|
32
|
+
full property name from that list.
|
|
33
|
+
|
|
34
|
+
For characters not yet in Unicode, data for additional characters can
|
|
35
|
+
be temporarily appended to the bundled data:
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from ucdinfo import get_ucd, loadxml
|
|
39
|
+
loadxml("extra-ucd.xml")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
or, with the object interface:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from ucdinfo import UCD
|
|
46
|
+
myucd = UCD().loadxml("extra-ucd.xml")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The named file must be coded in the same form as the "flat" UCD XML data, though the only
|
|
50
|
+
required character attributes are "cp" and anything needed by the calling process. For example:
|
|
51
|
+
|
|
52
|
+
```xml
|
|
53
|
+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
|
54
|
+
<ucd xmlns="http://www.unicode.org/ns/2003/ucd/1.0">
|
|
55
|
+
<description>Some additional characters</description>
|
|
56
|
+
<repertoire>
|
|
57
|
+
<char cp="10EC2" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER DAL WITH TWO DOTS VERTICALLY BELOW"></char>
|
|
58
|
+
<char cp="10EC3" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER TAH WITH TWO DOTS VERTICALLY BELOW"></char>
|
|
59
|
+
<char cp="10EC4" age="16.0" gc="Lo" bc="AL" na="ARABIC LETTER KAF WITH TWO DOTS VERTICALLY BELOW"></char>
|
|
60
|
+
</repertoire>
|
|
61
|
+
</ucd>
|
|
62
|
+
```
|
|
63
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3", "wheel", "platformdirs"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ucdinfo"
|
|
7
|
+
version = "0.2"
|
|
8
|
+
authors = [{name = "SIL WSTech", email = "fonts@sil.org"}]
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
description = "Unicode UCD wrapper module"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Text Processing :: Linguistic",
|
|
18
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
19
|
+
]
|
|
20
|
+
requires-python = ">=3.9"
|
|
21
|
+
#dynamic = ["version"]
|
|
22
|
+
dependencies = ["platformdirs"]
|
|
23
|
+
|
|
24
|
+
# [project.optional-dependencies]
|
|
25
|
+
# dev = [ ]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Home-Page = "https://github.com/silnrsi/python-ucd"
|
|
29
|
+
|
|
30
|
+
# [tool.setuptools_scm]
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
where = ["src"]
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.package-data]
|
|
35
|
+
ucd = ["data/ucdata_v*.pickle.bz2"]
|
|
36
|
+
|
|
37
|
+
#[tool.setuptools.data-files]
|
|
38
|
+
#"" = ["tests/*.usfm"]
|
|
39
|
+
|
|
40
|
+
#[tool.setuptools.dynamic]
|
|
41
|
+
#version = {attr = "usfmtc.version"}
|
|
42
|
+
|
|
43
|
+
#[tool.setuptools]
|
|
44
|
+
#packages = ["usfmtc"]
|
|
45
|
+
|
|
46
|
+
[tool.bdist_wheel]
|
|
47
|
+
universal = true
|
|
48
|
+
|
|
49
|
+
[project.scripts]
|
|
50
|
+
ucdinfo = "ucdinfo.ucd:main"
|
ucdinfo-0.2/setup.cfg
ADDED
ucdinfo-0.2/setup.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os, sys
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
from setuptools.command.build_py import build_py
|
|
4
|
+
|
|
5
|
+
class build_py_with_data(build_py):
|
|
6
|
+
def run(self):
|
|
7
|
+
super().run()
|
|
8
|
+
pkg_dir = os.path.join(self.build_lib, "ucd", "data")
|
|
9
|
+
os.makedirs(pkg_dir, exist_ok=True)
|
|
10
|
+
|
|
11
|
+
if os.environ.get("UCD_SKIP_FETCH") == "1":
|
|
12
|
+
self.announce("UCD_SKIP_FETCH=1: shipping wheel without bundled data",
|
|
13
|
+
level=2)
|
|
14
|
+
return
|
|
15
|
+
|
|
16
|
+
sys.path.insert(0, self.build_lib)
|
|
17
|
+
from ucdinfo import UCD
|
|
18
|
+
out = os.path.join(pkg_dir, UCD._cache_filename())
|
|
19
|
+
self.announce("Fetching UCD data for wheel...", level=2)
|
|
20
|
+
UCD.build_from_remote().save(out)
|
|
21
|
+
self.announce(f"Wrote {out}", level=2)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
setup(cmdclass={"build_py": build_py_with_data})
|