1- import re , unicodedata , sys , sets
2- from sets import Set
1+ import re , unicodedata , sys
32
43if sys .maxunicode == 65535 :
54 raise RuntimeError , "need UCS-4 Python"
@@ -40,10 +39,10 @@ def compact_set(l):
4039 single .append (prev )
4140 tuple = " + " .join (["range(%d,%d)" % t for t in tuple ])
4241 if not single :
43- return "sets.Set (%s)" % tuple
42+ return "set (%s)" % tuple
4443 if not tuple :
45- return "sets.Set (%s)" % repr (single )
46- return "sets.Set (%s + %s)" % (repr (single ),tuple )
44+ return "set (%s)" % repr (single )
45+ return "set (%s + %s)" % (repr (single ),tuple )
4746
4847############## Read the tables in the RFC #######################
4948
@@ -114,7 +113,7 @@ def compact_set(l):
114113and mappings, for which a mapping function is provided.
115114\" \" \"
116115
117- import unicodedata, sets
116+ import unicodedata
118117"""
119118
120119print "assert unicodedata.unidata_version == %s" % repr (unicodedata .unidata_version )
@@ -124,14 +123,14 @@ def compact_set(l):
124123name , table = tables [0 ]
125124del tables [0 ]
126125assert name == "A.1"
127- table = Set (table .keys ())
128- Cn = Set (gen_category (["Cn" ]))
126+ table = set (table .keys ())
127+ Cn = set (gen_category (["Cn" ]))
129128
130129# FDD0..FDEF are process internal codes
131- Cn -= Set (range (0xFDD0 , 0xFDF0 ))
130+ Cn -= set (range (0xFDD0 , 0xFDF0 ))
132131# not a character
133- Cn -= Set (range (0xFFFE , 0x110000 , 0x10000 ))
134- Cn -= Set (range (0xFFFF , 0x110000 , 0x10000 ))
132+ Cn -= set (range (0xFFFE , 0x110000 , 0x10000 ))
133+ Cn -= set (range (0xFFFF , 0x110000 , 0x10000 ))
135134
136135# assert table == Cn
137136
@@ -251,8 +250,8 @@ def in_table_c11(code):
251250del tables [0 ]
252251assert name == "C.1.2"
253252
254- # table = Set (table.keys())
255- # Zs = Set (gen_category(["Zs"])) - Set ([0x20])
253+ # table = set (table.keys())
254+ # Zs = set (gen_category(["Zs"])) - set ([0x20])
256255# assert Zs == table
257256
258257print """
@@ -268,9 +267,9 @@ def in_table_c11_c12(code):
268267del tables [0 ]
269268assert name == "C.2.1"
270269
271- Cc = Set (gen_category (["Cc" ]))
272- Cc_ascii = Cc & Set (range (128 ))
273- table_c21 = Set (table_c21 .keys ())
270+ Cc = set (gen_category (["Cc" ]))
271+ Cc_ascii = Cc & set (range (128 ))
272+ table_c21 = set (table_c21 .keys ())
274273assert Cc_ascii == table_c21
275274
276275print """
@@ -285,7 +284,7 @@ def in_table_c21(code):
285284assert name == "C.2.2"
286285
287286Cc_nonascii = Cc - Cc_ascii
288- table_c22 = Set (table_c22 .keys ())
287+ table_c22 = set (table_c22 .keys ())
289288assert len (Cc_nonascii - table_c22 ) == 0
290289
291290specials = list (table_c22 - Cc_nonascii )
@@ -308,8 +307,8 @@ def in_table_c21_c22(code):
308307del tables [0 ]
309308assert name == "C.3"
310309
311- Co = Set (gen_category (["Co" ]))
312- assert Set (table .keys ()) == Co
310+ Co = set (gen_category (["Co" ]))
311+ assert set (table .keys ()) == Co
313312
314313print """
315314def in_table_c3(code):
@@ -322,10 +321,10 @@ def in_table_c3(code):
322321del tables [0 ]
323322assert name == "C.4"
324323
325- nonchar = Set (range (0xFDD0 ,0xFDF0 ) +
324+ nonchar = set (range (0xFDD0 ,0xFDF0 ) +
326325 range (0xFFFE ,0x110000 ,0x10000 ) +
327326 range (0xFFFF ,0x110000 ,0x10000 ))
328- table = Set (table .keys ())
327+ table = set (table .keys ())
329328assert table == nonchar
330329
331330print """
@@ -341,8 +340,8 @@ def in_table_c4(code):
341340del tables [0 ]
342341assert name == "C.5"
343342
344- Cs = Set (gen_category (["Cs" ]))
345- assert Set (table .keys ()) == Cs
343+ Cs = set (gen_category (["Cs" ]))
344+ assert set (table .keys ()) == Cs
346345
347346print """
348347def in_table_c5(code):
@@ -410,8 +409,8 @@ def in_table_c9(code):
410409del tables [0 ]
411410assert name == "D.1"
412411
413- RandAL = Set (gen_bidirectional (["R" ,"AL" ]))
414- assert Set (table .keys ()) == RandAL
412+ RandAL = set (gen_bidirectional (["R" ,"AL" ]))
413+ assert set (table .keys ()) == RandAL
415414
416415print """
417416def in_table_d1(code):
@@ -423,8 +422,8 @@ def in_table_d1(code):
423422del tables [0 ]
424423assert name == "D.2"
425424
426- L = Set (gen_bidirectional (["L" ]))
427- assert Set (table .keys ()) == L
425+ L = set (gen_bidirectional (["L" ]))
426+ assert set (table .keys ()) == L
428427
429428print """
430429def in_table_d2(code):
0 commit comments