Skip to content

Commit 1441d3d

Browse files
authored
Update Python scripts (#155)
1 parent 63d0234 commit 1441d3d

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

scripts/unicode.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,28 @@ def load_gencats(f):
7878
fetch(f)
7979
gencats = {}
8080

81-
udict = {};
82-
range_start = -1;
81+
udict = {}
82+
range_start = -1
8383
for line in fileinput.input(f):
84-
data = line.split(';');
84+
data = line.split(';')
8585
if len(data) != 15:
8686
continue
87-
cp = int(data[0], 16);
87+
cp = int(data[0], 16)
8888
if is_surrogate(cp):
8989
continue
9090
if range_start >= 0:
9191
for i in range(range_start, cp):
92-
udict[i] = data;
93-
range_start = -1;
92+
udict[i] = data
93+
range_start = -1
9494
if data[1].endswith(", First>"):
95-
range_start = cp;
96-
continue;
97-
udict[cp] = data;
95+
range_start = cp
96+
continue
97+
udict[cp] = data
9898

9999
for code in udict:
100100
[code_org, name, gencat, combine, bidi,
101101
decomp, deci, digit, num, mirror,
102-
old, iso, upcase, lowcase, titlecase ] = udict[code];
102+
old, iso, upcase, lowcase, titlecase ] = udict[code]
103103

104104
# place letter in categories as appropriate
105105
for cat in [gencat, "Assigned"] + expanded_categories.get(gencat, []):
@@ -389,7 +389,7 @@ def emit_break_module(f, break_table, break_cats, name):
389389
r = "tables.rs"
390390
if os.path.exists(r):
391391
os.remove(r)
392-
with open(r, "w") as rf:
392+
with open(r, "w", encoding="utf-8", newline="\n") as rf:
393393
# write the file's preamble
394394
rf.write(preamble)
395395
rf.write("""

scripts/unicode_gen_breaktests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def create_sentence_data(f):
205205
unicode.emit_table(f, "TEST_SENTENCE", test, wtype, True, showfun, True)
206206

207207
if __name__ == "__main__":
208-
with open("testdata.rs", "w") as rf:
208+
with open("testdata.rs", "w", encoding="utf-8", newline="\n") as rf:
209209
rf.write(unicode.preamble)
210210
create_grapheme_data(rf)
211211
create_words_data(rf)

0 commit comments

Comments
 (0)