File: 0001_read_unihan_from_debian_package.patch

package info (click to toggle)
python-unicodedata2 14.0.0%2Bds2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 460 kB
  • sloc: ansic: 1,506; python: 1,179; makefile: 12
file content (28 lines) | stat: -rw-r--r-- 1,131 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: =?utf-8?b?IllhbyBXZWkgKOmtj+mKmOW7tyki?= <mwei@debian.org>
Date: Tue, 15 Feb 2022 09:56:04 +0800
Subject: Read Unihan_NumericValues.txt from local Debian package

---
 makeunicodedata.py | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/makeunicodedata.py b/makeunicodedata.py
index 6dd8444..75c899e 100644
--- a/makeunicodedata.py
+++ b/makeunicodedata.py
@@ -1117,13 +1117,8 @@ class UnicodeData:
             if table[i] is not None:
                 table[i] = table[i]._replace(quick_check=quickchecks[i])
 
-        with open_data(UNIHAN, version) as file:
-            zip = zipfile.ZipFile(file)
-            if version == '3.2.0':
-                data = zip.open('Unihan-3.2.0.txt').read()
-            else:
-                data = zip.open('Unihan_NumericValues.txt').read()
-        for line in data.decode("utf-8").splitlines():
+        data = open(os.path.join(DATA_DIR, 'Unihan_NumericValues.txt'), encoding='utf-8')
+        for line in data.readlines():
             if not line.startswith('U+'):
                 continue
             code, tag, value = line.split(None, 3)[:3]