[Python-checkins] python/dist/src/Doc/tools buildindex.py,1.12,1.13 indfix.py,1.5,1.6 keywords.py,1.2,1.3 refcounts.py,1.3,1.4 rewrite.py,1.1,1.2 toc2bkm.py,1.10,1.11

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Wed, 16 Oct 2002 08:27:07 -0700


Update of /cvsroot/python/python/dist/src/Doc/tools
In directory usw-pr-cvs1:/tmp/cvs-serv26400

Modified Files:
	buildindex.py indfix.py keywords.py refcounts.py rewrite.py 
	toc2bkm.py 
Log Message:
Use string methods.

Index: buildindex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/buildindex.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** buildindex.py	26 Dec 2001 19:55:14 -0000	1.12
--- buildindex.py	16 Oct 2002 15:27:01 -0000	1.13
***************
*** 3,7 ****
  __version__ = '$Revision$'
  
! import os
  import re
  import string
--- 3,7 ----
  __version__ = '$Revision$'
  
! import os.path
  import re
  import string
***************
*** 50,54 ****
      def dump(self):
          return "%s\1%s###%s\n" \
!                % (string.join(self.links, "\1"),
                    bang_join(self.text),
                    self.seqno)
--- 50,54 ----
      def dump(self):
          return "%s\1%s###%s\n" \
!                % ("\1".join(self.links),
                    bang_join(self.text),
                    self.seqno)
***************
*** 295,299 ****
          s = "<b><a href=\"#letter-%s\">%s</a></b>" % (letter, letter)
          items.append(s)
!     s = ["<hr><center>\n%s</center>\n" % string.join(items, " |\n")]
      for letter, nodes in letter_groups:
          s.append(format_letter(letter))
--- 295,299 ----
          s = "<b><a href=\"#letter-%s\">%s</a></b>" % (letter, letter)
          items.append(s)
!     s = ["<hr><center>\n%s</center>\n" % " |\n".join(items)]
      for letter, nodes in letter_groups:
          s.append(format_letter(letter))

Index: indfix.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/indfix.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** indfix.py	7 Oct 2000 12:50:04 -0000	1.5
--- indfix.py	16 Oct 2002 15:27:01 -0000	1.6
***************
*** 20,30 ****
  
  import re
- import string
  import StringIO
  import sys
  
  
! def cmp_entries(e1, e2, lower=string.lower):
!     return cmp(lower(e1[1]), lower(e2[1])) or cmp(e1, e2)
  
  
--- 20,29 ----
  
  import re
  import StringIO
  import sys
  
  
! def cmp_entries(e1, e2):
!     return cmp(e1[1].lower(), e2[1].lower()) or cmp(e1, e2)
  
  

Index: keywords.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/keywords.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** keywords.py	9 Apr 1999 14:53:35 -0000	1.2
--- keywords.py	16 Oct 2002 15:27:02 -0000	1.3
***************
*** 3,11 ****
  # This Python program sorts and reformats the table of keywords in ref2.tex
  
- import string
  l = []
  try:
  	while 1:
! 		l = l + string.split(raw_input())
  except EOFError:
  	pass
--- 3,10 ----
  # This Python program sorts and reformats the table of keywords in ref2.tex
  
  l = []
  try:
  	while 1:
! 		l = l + raw_input().split()
  except EOFError:
  	pass
***************
*** 17,20 ****
  for i in range(nrows):
  	for j in range(i, len(l), nrows):
! 		print string.ljust(l[j], 10),
  	print
--- 16,19 ----
  for i in range(nrows):
  	for j in range(i, len(l), nrows):
! 		print l[j].ljust(10),
  	print

Index: refcounts.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/refcounts.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** refcounts.py	29 May 2001 15:25:51 -0000	1.3
--- refcounts.py	16 Oct 2002 15:27:02 -0000	1.4
***************
*** 3,7 ****
  
  import os
- import string
  import sys
  
--- 3,6 ----
***************
*** 11,15 ****
      p = os.path.dirname(__file__)
  except NameError:
!     p = sys.path[0]
  p = os.path.normpath(os.path.join(os.getcwd(), p, os.pardir,
                                    "api", "refcounts.dat"))
--- 10,14 ----
      p = os.path.dirname(__file__)
  except NameError:
!     p = os.path.dirname(sys.argv[0])
  p = os.path.normpath(os.path.join(os.getcwd(), p, os.pardir,
                                    "api", "refcounts.dat"))
***************
*** 28,36 ****
          if not line:
              break
!         line = string.strip(line)
          if line[:1] in ("", "#"):
              # blank lines and comments
              continue
!         parts = string.split(line, ":", 4)
          if len(parts) != 5:
              raise ValueError("Not enough fields in " + `line`)
--- 27,35 ----
          if not line:
              break
!         line = line.strip()
          if line[:1] in ("", "#"):
              # blank lines and comments
              continue
!         parts = line.split(":", 4)
          if len(parts) != 5:
              raise ValueError("Not enough fields in " + `line`)

Index: rewrite.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/rewrite.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rewrite.py	17 Jul 2001 16:46:14 -0000	1.1
--- rewrite.py	16 Oct 2002 15:27:02 -0000	1.2
***************
*** 4,8 ****
  """
  
- import string
  import sys
  import time
--- 4,7 ----
***************
*** 13,19 ****
  
      d = {}
!     start = string.find(s, r"\date{")
      if start >= 0:
!         end = string.find(s, "}", start)
          date = s[start+6:end]
          if date == r"\today":
--- 12,18 ----
  
      d = {}
!     start = s.find(r"\date{")
      if start >= 0:
!         end = s.find("}", start)
          date = s[start+6:end]
          if date == r"\today":
***************
*** 29,40 ****
          d = get_info(open(sys.argv[1]))
          for arg in sys.argv[2:]:
!             name, value = string.split(arg, "=", 1)
              d[name] = value
          start = 0
          while 1:
!             start = string.find(s, "@", start)
              if start < 0:
                  break
!             end = string.find(s, "@", start+1)
              name = s[start+1:end]
              if name:
--- 28,39 ----
          d = get_info(open(sys.argv[1]))
          for arg in sys.argv[2:]:
!             name, value = arg.split("=", 1)
              d[name] = value
          start = 0
          while 1:
!             start = s.find("@", start)
              if start < 0:
                  break
!             end = s.find("@", start+1)
              name = s[start+1:end]
              if name:

Index: toc2bkm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/toc2bkm.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** toc2bkm.py	7 Oct 2000 12:50:05 -0000	1.10
--- toc2bkm.py	16 Oct 2002 15:27:02 -0000	1.11
***************
*** 59,63 ****
              stype, snum, title, pageno = m.group(1, 2, 3, 4)
              title = clean_title(title)
!             entry = (stype, snum, title, string.atoi(pageno), [])
              if stype == level:
                  toc.append(entry)
--- 59,63 ----
              stype, snum, title, pageno = m.group(1, 2, 3, 4)
              title = clean_title(title)
!             entry = (stype, snum, title, int(pageno), [])
              if stype == level:
                  toc.append(entry)
***************
*** 100,104 ****
          else:
              break
!     title = string.translate(title, title_trans, "{}")
      return title
  
--- 100,104 ----
          else:
              break
!     title = title.translate(title_trans, "{}")
      return title