File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 27
27
import os
28
28
import re
29
29
import sys
30
+ import urllib .request
30
31
from collections import defaultdict
31
32
from itertools import batched
32
33
34
+ UNICODE_VERSION = "15.1.0"
35
+ """The version of the Unicode data files to download."""
36
+
33
37
NUM_CODEPOINTS = 0x110000
34
38
"""An upper bound for which `range(0, NUM_CODEPOINTS)` contains Unicode's codespace."""
35
39
@@ -70,11 +74,13 @@ class OffsetType(enum.IntEnum):
70
74
71
75
def fetch_open (filename : str ):
72
76
"""Opens `filename` and return its corresponding file object. If `filename` isn't on disk,
73
- fetches it from `https://www.unicode.org/Public/UNIDATA/ `. Exits with code 1 on failure.
77
+ fetches it from `https://www.unicode.org/Public/`. Exits with code 1 on failure.
74
78
"""
75
79
basename = os .path .basename (filename )
76
80
if not os .path .exists (basename ):
77
- os .system (f"curl -O https://www.unicode.org/Public/UNIDATA/{ filename } " )
81
+ urllib .request .urlretrieve (
82
+ f"https://www.unicode.org/Public/{ UNICODE_VERSION } /ucd/{ filename } " , basename
83
+ )
78
84
try :
79
85
return open (basename , encoding = "utf-8" )
80
86
except OSError :
You can’t perform that action at this time.
0 commit comments