[Python-checkins] python/dist/src/Tools/unicode makeunicodedata.py,1.11,1.12

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Wed, 11 Sep 2002 13:36:03 -0700


Update of /cvsroot/python/python/dist/src/Tools/unicode
In directory usw-pr-cvs1:/tmp/cvs-serv827/unicode

Modified Files:
	makeunicodedata.py 
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)

This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.


Index: makeunicodedata.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/unicode/makeunicodedata.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** makeunicodedata.py	21 Jan 2001 23:31:52 -0000	1.11
--- makeunicodedata.py	11 Sep 2002 20:36:01 -0000	1.12
***************
*** 101,105 ****
          if record:
              if record[5]:
!                 decomp = string.split(record[5])
                  # prefix
                  if decomp[0][0] == "<":
--- 101,105 ----
          if record:
              if record[5]:
!                 decomp = record[5].split()
                  # prefix
                  if decomp[0][0] == "<":
***************
*** 363,367 ****
          ww = w[:-1] + chr(ord(w[-1])+128)
          # reuse string tails, when possible
!         o = string.find(lexicon, ww)
          if o < 0:
              o = offset
--- 363,367 ----
          ww = w[:-1] + chr(ord(w[-1])+128)
          # reuse string tails, when possible
!         o = lexicon.find(ww)
          if o < 0:
              o = offset
***************
*** 443,447 ****
  # load a unicode-data file from disk
  
! import string, sys
  
  class UnicodeData:
--- 443,447 ----
  # load a unicode-data file from disk
  
! import sys
  
  class UnicodeData:
***************
*** 454,459 ****
              if not s:
                  break
!             s = string.split(string.strip(s), ";")
!             char = string.atoi(s[0], 16)
              table[char] = s
  
--- 454,459 ----
              if not s:
                  break
!             s = s.strip().split(";")
!             char = int(s[0], 16)
              table[char] = s
  
***************
*** 491,495 ****
  def myhash(s, magic):
      h = 0
!     for c in map(ord, string.upper(s)):
          h = (h * magic) + c
          ix = h & 0xff000000
--- 491,495 ----
  def myhash(s, magic):
      h = 0
!     for c in map(ord, s.upper()):
          h = (h * magic) + c
          ix = h & 0xff000000
***************
*** 599,603 ****
                  else:
                      s = s + i
!             if string.strip(s):
                  file.write(s + "\n")
          file.write("};\n\n")
--- 599,603 ----
                  else:
                      s = s + i
!             if s.strip():
                  file.write(s + "\n")
          file.write("};\n\n")