Remove py3k deprecation warnings from these Unicode tools.
diff --git a/Tools/unicode/mkstringprep.py b/Tools/unicode/mkstringprep.py
index 2525f9e..99fcae7 100644
--- a/Tools/unicode/mkstringprep.py
+++ b/Tools/unicode/mkstringprep.py
@@ -1,7 +1,7 @@
import re, unicodedata, sys
if sys.maxunicode == 65535:
- raise RuntimeError, "need UCS-4 Python"
+ raise RuntimeError("need UCS-4 Python")
def gen_category(cats):
for i in range(0, 0x110000):
@@ -63,14 +63,14 @@
if m:
if m.group(1) == "Start":
if curname:
- raise "Double Start",(curname, l)
+ raise RuntimeError("Double Start", (curname, l))
curname = m.group(2)
table = {}
tables.append((curname, table))
continue
else:
if not curname:
- raise "End without start", l
+ raise RuntimeError("End without start", l)
curname = None
continue
if not curname:
@@ -87,7 +87,7 @@
try:
start, end = fields
except ValueError:
- raise "Unpacking problem", l
+ raise RuntimeError("Unpacking problem", l)
else:
start = end = fields[0]
start = int(start, 16)
@@ -146,8 +146,7 @@
name, table = tables[0]
del tables[0]
assert name == "B.1"
-table = table.keys()
-table.sort()
+table = sorted(table.keys())
print """
b1_set = """ + compact_set(table) + """
def in_table_b1(code):
@@ -177,8 +176,7 @@
if map(ord, unichr(k).lower()) != v:
b3_exceptions[k] = u"".join(map(unichr,v))
-b3 = b3_exceptions.items()
-b3.sort()
+b3 = sorted(b3_exceptions.items())
print """
b3_exceptions = {"""
@@ -353,8 +351,7 @@
del tables[0]
assert name == "C.6"
-table = table.keys()
-table.sort()
+table = sorted(table.keys())
print """
c6_set = """ + compact_set(table) + """
@@ -367,8 +364,7 @@
del tables[0]
assert name == "C.7"
-table = table.keys()
-table.sort()
+table = sorted(table.keys())
print """
c7_set = """ + compact_set(table) + """
@@ -381,8 +377,7 @@
del tables[0]
assert name == "C.8"
-table = table.keys()
-table.sort()
+table = sorted(table.keys())
print """
c8_set = """ + compact_set(table) + """
@@ -395,8 +390,7 @@
del tables[0]
assert name == "C.9"
-table = table.keys()
-table.sort()
+table = sorted(table.keys())
print """
c9_set = """ + compact_set(table) + """