[Python-checkins] CVS: python/dist/src/Lib mhlib.py,1.23,1.24

Eric S. Raymond esr@users.sourceforge.net
Fri, 09 Feb 2001 01:17:41 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv28571

Modified Files:
	mhlib.py 
Log Message:
String method conversion.


Index: mhlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mhlib.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** mhlib.py	2001/01/24 06:27:27	1.23
--- mhlib.py	2001/02/09 09:17:38	1.24
***************
*** 217,221 ****
          protect = pickline(self.profile, 'Folder-Protect')
          if protect and isnumeric(protect):
!             mode = string.atoi(protect, 8)
          else:
              mode = FOLDER_PROTECT
--- 217,221 ----
          protect = pickline(self.profile, 'Folder-Protect')
          if protect and isnumeric(protect):
!             mode = int(protect, 8)
          else:
              mode = FOLDER_PROTECT
***************
*** 287,291 ****
              if match(name):
                  append(name)
!         messages = map(string.atoi, messages)
          messages.sort()
          if messages:
--- 287,291 ----
              if match(name):
                  append(name)
!         messages = map(int, messages)
          messages.sort()
          if messages:
***************
*** 306,315 ****
              line = f.readline()
              if not line: break
!             fields = string.splitfields(line, ':')
              if len(fields) != 2:
                  self.error('bad sequence in %s: %s' %
!                           (fullname, string.strip(line)))
!             key = string.strip(fields[0])
!             value = IntSet(string.strip(fields[1]), ' ').tolist()
              sequences[key] = value
          return sequences
--- 306,315 ----
              line = f.readline()
              if not line: break
!             fields = line.split(':')
              if len(fields) != 2:
                  self.error('bad sequence in %s: %s' %
!                           (fullname, line.strip()))
!             key = fields[0].strip()
!             value = IntSet(fields[1].strip(), ' ').tolist()
              sequences[key] = value
          return sequences
***************
*** 361,365 ****
              return all
          # Test for X:Y before X-Y because 'seq:-n' matches both
!         i = string.find(seq, ':')
          if i >= 0:
              head, dir, tail = seq[:i], '', seq[i+1:]
--- 361,365 ----
              return all
          # Test for X:Y before X-Y because 'seq:-n' matches both
!         i = seq.find(':')
          if i >= 0:
              head, dir, tail = seq[:i], '', seq[i+1:]
***************
*** 369,373 ****
                  raise Error, "bad message list %s" % seq
              try:
!                 count = string.atoi(tail)
              except (ValueError, OverflowError):
                  # Can't use sys.maxint because of i+count below
--- 369,373 ----
                  raise Error, "bad message list %s" % seq
              try:
!                 count = int(tail)
              except (ValueError, OverflowError):
                  # Can't use sys.maxint because of i+count below
***************
*** 399,403 ****
                      return all[i:i+count]
          # Test for X-Y next
!         i = string.find(seq, '-')
          if i >= 0:
              begin = self._parseindex(seq[:i], all)
--- 399,403 ----
                      return all[i:i+count]
          # Test for X-Y next
!         i = seq.find('-')
          if i >= 0:
              begin = self._parseindex(seq[:i], all)
***************
*** 432,436 ****
          if isnumeric(seq):
              try:
!                 return string.atoi(seq)
              except (OverflowError, ValueError):
                  return sys.maxint
--- 432,436 ----
          if isnumeric(seq):
              try:
!                 return int(seq)
              except (OverflowError, ValueError):
                  return sys.maxint
***************
*** 682,695 ****
          name converted to lower case)."""
          if not pred:
!             return string.joinfields(self.headers, '')
          headers = []
          hit = 0
          for line in self.headers:
              if line[0] not in string.whitespace:
!                 i = string.find(line, ':')
                  if i > 0:
!                     hit = pred(string.lower(line[:i]))
              if hit: headers.append(line)
!         return string.joinfields(headers, '')
  
      def getbodytext(self, decode = 1):
--- 682,695 ----
          name converted to lower case)."""
          if not pred:
!             return ''.join(self.headers)
          headers = []
          hit = 0
          for line in self.headers:
              if line[0] not in string.whitespace:
!                 i = line.find(':')
                  if i > 0:
!                     hit = pred(line[:i].lower())
              if hit: headers.append(line)
!         return ''.joinfields(headers)
  
      def getbodytext(self, decode = 1):
***************
*** 888,896 ****
          import string
          new = []
!         for part in string.splitfields(data, self.sep):
              list = []
!             for subp in string.splitfields(part, self.rng):
!                 s = string.strip(subp)
!                 list.append(string.atoi(s))
              if len(list) == 1:
                  new.append((list[0], list[0]))
--- 888,896 ----
          import string
          new = []
!         for part in data.split(self.sep):
              list = []
!             for subp in part.split(self.rng):
!                 s = subp.strip()
!                 list.append(int(s))
              if len(list) == 1:
                  new.append((list[0], list[0]))
***************
*** 922,926 ****
                      break
                  text = text + line
!             return string.strip(text)
      return None
  
--- 922,926 ----
                      break
                  text = text + line
!             return text.strip()
      return None
  
***************
*** 997,1001 ****
              print "Error:", msg
          stuff = os.popen("pick %s 2>/dev/null" % `seq`).read()
!         list = map(string.atoi, string.split(stuff))
          print list, "<-- pick"
      do('f.listmessages()')
--- 997,1001 ----
              print "Error:", msg
          stuff = os.popen("pick %s 2>/dev/null" % `seq`).read()
!         list = map(int, stuff.split())
          print list, "<-- pick"
      do('f.listmessages()')