|
1 | | -#!/usr/bin/env python |
| 1 | +#!/usr/bin/env python3 |
2 | 2 | # |
3 | 3 | # Copyright 2011-2015 The Rust Project Developers. See the COPYRIGHT |
4 | 4 | # file at the top-level directory of this distribution and at |
@@ -68,28 +68,28 @@ def load_unicode_data(f): |
68 | 68 | fetch(f) |
69 | 69 | gencats = {} |
70 | 70 |
|
71 | | - udict = {}; |
72 | | - range_start = -1; |
| 71 | + udict = {} |
| 72 | + range_start = -1 |
73 | 73 | for line in fileinput.input(f): |
74 | | - data = line.split(';'); |
| 74 | + data = line.split(';') |
75 | 75 | if len(data) != 15: |
76 | 76 | continue |
77 | | - cp = int(data[0], 16); |
| 77 | + cp = int(data[0], 16) |
78 | 78 | if is_surrogate(cp): |
79 | 79 | continue |
80 | 80 | if range_start >= 0: |
81 | | - for i in xrange(range_start, cp): |
82 | | - udict[i] = data; |
83 | | - range_start = -1; |
| 81 | + for i in range(range_start, cp): |
| 82 | + udict[i] = data |
| 83 | + range_start = -1 |
84 | 84 | if data[1].endswith(", First>"): |
85 | | - range_start = cp; |
86 | | - continue; |
87 | | - udict[cp] = data; |
| 85 | + range_start = cp |
| 86 | + continue |
| 87 | + udict[cp] = data |
88 | 88 |
|
89 | 89 | for code in udict: |
90 | 90 | [code_org, name, gencat, combine, bidi, |
91 | 91 | decomp, deci, digit, num, mirror, |
92 | | - old, iso, upcase, lowcase, titlecase ] = udict[code]; |
| 92 | + old, iso, upcase, lowcase, titlecase ] = udict[code] |
93 | 93 |
|
94 | 94 | # place letter in categories as appropriate |
95 | 95 | for cat in [gencat, "Assigned"] + expanded_categories.get(gencat, []): |
@@ -300,15 +300,15 @@ def optimize_width_table(wtable): |
300 | 300 | ### character width module |
301 | 301 | width_table = [] |
302 | 302 | for zwcat in ["Me", "Mn", "Cf"]: |
303 | | - width_table.extend(map(lambda (lo, hi): (lo, hi, 0, 0), gencats[zwcat])) |
| 303 | + width_table.extend([(lo_hi[0], lo_hi[1], 0, 0) for lo_hi in gencats[zwcat]]) |
304 | 304 | width_table.append((4448, 4607, 0, 0)) |
305 | 305 |
|
306 | 306 | # get widths, except those that are explicitly marked zero-width above |
307 | 307 | ea_widths = load_east_asian_width(["W", "F", "A"], ["Me", "Mn", "Cf"]) |
308 | 308 | # these are doublewidth |
309 | 309 | for dwcat in ["W", "F"]: |
310 | | - width_table.extend(map(lambda (lo, hi): (lo, hi, 2, 2), ea_widths[dwcat])) |
311 | | - width_table.extend(map(lambda (lo, hi): (lo, hi, 1, 2), ea_widths["A"])) |
| 310 | + width_table.extend([(lo_hi1[0], lo_hi1[1], 2, 2) for lo_hi1 in ea_widths[dwcat]]) |
| 311 | + width_table.extend([(lo_hi2[0], lo_hi2[1], 1, 2) for lo_hi2 in ea_widths["A"]]) |
312 | 312 |
|
313 | 313 | width_table.sort(key=lambda w: w[0]) |
314 | 314 |
|
|
0 commit comments