diff options
author | Georg Brandl <georg@python.org> | 2008-05-16 17:02:34 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-05-16 17:02:34 (GMT) |
commit | bf82e374ee737992235cbe944c9ddbd58236a892 (patch) | |
tree | f8c8dccaa76d58f9cb7d8cc0abb1355be75ee369 /Tools/unicode/makeunicodedata.py | |
parent | acbca71ea775fc488bead0876d0cdbd48670dcbc (diff) | |
download | cpython-bf82e374ee737992235cbe944c9ddbd58236a892.zip cpython-bf82e374ee737992235cbe944c9ddbd58236a892.tar.gz cpython-bf82e374ee737992235cbe944c9ddbd58236a892.tar.bz2 |
More 2to3 fixes in the Tools directory. Fixes #2893.
Diffstat (limited to 'Tools/unicode/makeunicodedata.py')
-rw-r--r-- | Tools/unicode/makeunicodedata.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py index f080ca2..885e559 100644 --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -71,7 +71,7 @@ def maketables(trace=0): EASTASIAN_WIDTH % version, DERIVED_CORE_PROPERTIES % version) - print(len(list(filter(None, unicode.table))), "characters") + print(len(filter(None, unicode.table)), "characters") for version in old_versions: print("--- Reading", UNICODE_DATA % ("-"+version), "...") @@ -79,7 +79,7 @@ def maketables(trace=0): COMPOSITION_EXCLUSIONS % ("-"+version), EASTASIAN_WIDTH % ("-"+version), DERIVED_CORE_PROPERTIES % ("-"+version)) - print(len(list(filter(None, old_unicode.table))), "characters") + print(len(filter(None, old_unicode.table)), "characters") merge_old_version(version, unicode, old_unicode) makeunicodename(unicode, trace) @@ -152,8 +152,7 @@ def makeunicodedata(unicode, trace): prefix = i assert prefix < 256 # content - decomp = [prefix + (len(decomp)<<8)] +\ - list(map(lambda s: int(s, 16), decomp)) + decomp = [prefix + (len(decomp)<<8)] + [int(s, 16) for s in decomp] # Collect NFC pairs if not prefix and len(decomp) == 3 and \ char not in unicode.exclusions and \ @@ -466,7 +465,7 @@ def makeunicodename(unicode, trace): if name and name[0] != "<": names[char] = name + chr(0) - print(len(list(filter(lambda n: n is not None, names))), "distinct names") + print(len(n for n in names if n is not None), "distinct names") # collect unique words from names (note that we differ between # words inside a sentence, and words ending a sentence. the @@ -740,7 +739,7 @@ class UnicodeData: # public attributes self.filename = filename self.table = table - self.chars = range(0x110000) # unicode 3.2 + self.chars = list(range(0x110000)) # unicode 3.2 file = open(exclusions) self.exclusions = {} @@ -763,7 +762,7 @@ class UnicodeData: s = s.split()[0].split(';') if '..' in s[0]: first, last = [int(c, 16) for c in s[0].split('..')] - chars = range(first, last+1) + chars = list(range(first, last+1)) else: chars = [int(s[0], 16)] for char in chars: @@ -785,7 +784,7 @@ class UnicodeData: p = p.strip() if ".." in r: first, last = [int(c, 16) for c in r.split('..')] - chars = range(first, last+1) + chars = list(range(first, last+1)) else: chars = [int(r, 16)] for char in chars: @@ -796,7 +795,7 @@ class UnicodeData: def uselatin1(self): # restrict character range to ISO Latin 1 - self.chars = range(256) + self.chars = list(range(256)) # hash table tools |