mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
Remove py3k deprecation warnings from these Unicode tools.
This commit is contained in:
parent
358e7ff36b
commit
dc36472472
3 changed files with 27 additions and 42 deletions
|
@ -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 @@ for l in data:
|
|||
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 @@ for l in data:
|
|||
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 @@ def in_table_a1(code):
|
|||
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 @@ for k,v in table_b2.items():
|
|||
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 @@ name, table = tables[0]
|
|||
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 @@ name, table = tables[0]
|
|||
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 @@ name, table = tables[0]
|
|||
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 @@ name, table = tables[0]
|
|||
del tables[0]
|
||||
assert name == "C.9"
|
||||
|
||||
table = table.keys()
|
||||
table.sort()
|
||||
table = sorted(table.keys())
|
||||
|
||||
print """
|
||||
c9_set = """ + compact_set(table) + """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue