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 2727import os
2828import re
2929import sys
30+ import urllib .request
3031from collections import defaultdict
3132from itertools import batched
3233
34+ UNICODE_VERSION = "15.1.0"
35+ """The version of the Unicode data files to download."""
36+
3337NUM_CODEPOINTS = 0x110000
3438"""An upper bound for which `range(0, NUM_CODEPOINTS)` contains Unicode's codespace."""
3539
@@ -70,11 +74,13 @@ class OffsetType(enum.IntEnum):
7074
7175def fetch_open (filename : str ):
7276 """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.
7478 """
7579 basename = os .path .basename (filename )
7680 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+ )
7884 try :
7985 return open (basename , encoding = "utf-8" )
8086 except OSError :
You can’t perform that action at this time.
0 commit comments