File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import re
2+ import os
23import unicodedata as unicodedata_current
34from unicodedata import ucd_3_2_0 as unicodedata_320
45
6+ FILENAME = "Tools/unicode/data/rfc3454.txt"
7+ URL = "https://www.rfc-editor.org/rfc/rfc3454.txt"
8+
59def gen_category (cats ):
610 for i in range (0 , 0x110000 ):
711 if unicodedata_320 .category (chr (i )) in cats :
@@ -48,8 +52,16 @@ def compact_set(l):
4852
4953############## Read the tables in the RFC #######################
5054
51- with open ("rfc3454.txt" ) as f :
52- data = f .readlines ()
55+ try :
56+ data_file = open (FILENAME , encoding = 'utf-8' )
57+ except FileNotFoundError :
58+ import urllib .request
59+ os .makedirs (os .path .dirname (FILENAME ), exist_ok = True )
60+ urllib .request .urlretrieve (URL , filename = FILENAME )
61+ data_file = open (FILENAME , encoding = 'utf-8' )
62+
63+ with data_file :
64+ data = data_file .readlines ()
5365
5466tables = []
5567curname = None
You can’t perform that action at this time.
0 commit comments