|
1 | | -#!/usr/bin/envpython |
| 1 | +#!/usr/bin/envpython3 |
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 | forlineinfileinput.input(f): |
74 | | -data=line.split(';'); |
| 74 | +data=line.split(';') |
75 | 75 | iflen(data)!=15: |
76 | 76 | continue |
77 | | -cp=int(data[0],16); |
| 77 | +cp=int(data[0],16) |
78 | 78 | ifis_surrogate(cp): |
79 | 79 | continue |
80 | 80 | ifrange_start>=0: |
81 | | -foriinxrange(range_start,cp): |
82 | | -udict[i]=data; |
83 | | -range_start=-1; |
| 81 | +foriinrange(range_start,cp): |
| 82 | +udict[i]=data |
| 83 | +range_start=-1 |
84 | 84 | ifdata[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 | forcodeinudict: |
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 | forcatin [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 | forzwcatin ["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)forlo_hiingencats[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 | fordwcatin ["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)forlo_hi1inea_widths[dwcat]]) |
| 311 | +width_table.extend([(lo_hi2[0],lo_hi2[1],1,2)forlo_hi2inea_widths["A"]]) |
312 | 312 |
|
313 | 313 | width_table.sort(key=lambdaw:w[0]) |
314 | 314 |
|
|