[Python-checkins] CVS: python/dist/src/Lib base64.py,1.12,1.13 binhex.py,1.21,1.22 bisect.py,1.7,1.8 dumbdbm.py,1.12,1.13 inspect.py,1.19,1.20 quopri.py,1.14,1.15 repr.py,1.11,1.12 rfc822.py,1.62,1.63 wave.py,1.15,1.16

Guido van Rossum gvanrossum@users.sourceforge.net
Tue, 04 Sep 2001 12:14:16 -0700


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

Modified Files:
	base64.py binhex.py bisect.py dumbdbm.py inspect.py quopri.py 
	repr.py rfc822.py wave.py 
Log Message:
The first batch of changes recommended by the fixdiv tool.  These are
mostly changes of / operators into //.  Once or twice I did more or
less than recommended.


Index: base64.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/base64.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** base64.py	2001/06/07 18:56:13	1.12
--- base64.py	2001/09/04 19:14:13	1.13
***************
*** 10,14 ****
  
  MAXLINESIZE = 76 # Excluding the CRLF
! MAXBINSIZE = (MAXLINESIZE/4)*3
  
  def encode(input, output):
--- 10,14 ----
  
  MAXLINESIZE = 76 # Excluding the CRLF
! MAXBINSIZE = (MAXLINESIZE//4)*3
  
  def encode(input, output):

Index: binhex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/binhex.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** binhex.py	2001/08/01 18:17:23	1.21
--- binhex.py	2001/09/04 19:14:13	1.22
***************
*** 129,133 ****
          self.data = self.data + data
          datalen = len(self.data)
!         todo = (datalen/3)*3
          data = self.data[:todo]
          self.data = self.data[todo:]
--- 129,133 ----
          self.data = self.data + data
          datalen = len(self.data)
!         todo = (datalen//3)*3
          data = self.data[:todo]
          self.data = self.data[todo:]
***************
*** 293,297 ****
          while wtd > 0:
              if self.eof: return decdata
!             wtd = ((wtd+2)/3)*4
              data = self.ifp.read(wtd)
              #
--- 293,297 ----
          while wtd > 0:
              if self.eof: return decdata
!             wtd = ((wtd+2)//3)*4
              data = self.ifp.read(wtd)
              #

Index: bisect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/bisect.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** bisect.py	2001/02/18 03:30:53	1.7
--- bisect.py	2001/09/04 19:14:13	1.8
***************
*** 13,17 ****
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)/2
          if x < a[mid]: hi = mid
          else: lo = mid+1
--- 13,17 ----
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)//2
          if x < a[mid]: hi = mid
          else: lo = mid+1
***************
*** 34,38 ****
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)/2
          if x < a[mid]: hi = mid
          else: lo = mid+1
--- 34,38 ----
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)//2
          if x < a[mid]: hi = mid
          else: lo = mid+1
***************
*** 53,57 ****
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)/2
          if a[mid] < x: lo = mid+1
          else: hi = mid
--- 53,57 ----
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)//2
          if a[mid] < x: lo = mid+1
          else: hi = mid
***************
*** 73,77 ****
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)/2
          if a[mid] < x: lo = mid+1
          else: hi = mid
--- 73,77 ----
          hi = len(a)
      while lo < hi:
!         mid = (lo+hi)//2
          if a[mid] < x: lo = mid+1
          else: hi = mid

Index: dumbdbm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** dumbdbm.py	2001/07/19 10:06:39	1.12
--- dumbdbm.py	2001/09/04 19:14:13	1.13
***************
*** 88,92 ****
  ##              pos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
  ##              f.seek(pos)
!         npos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
          f.write('\0'*(npos-pos))
          pos = npos
--- 88,92 ----
  ##              pos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
  ##              f.seek(pos)
!         npos = ((pos + _BLOCKSIZE - 1) // _BLOCKSIZE) * _BLOCKSIZE
          f.write('\0'*(npos-pos))
          pos = npos

Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** inspect.py	2001/07/15 21:08:29	1.19
--- inspect.py	2001/09/04 19:14:13	1.20
***************
*** 591,595 ****
      lineno = getlineno(frame)
      if context > 0:
!         start = lineno - 1 - context/2
          try:
              lines, lnum = findsource(frame)
--- 591,595 ----
      lineno = getlineno(frame)
      if context > 0:
!         start = lineno - 1 - context//2
          try:
              lines, lnum = findsource(frame)

Index: quopri.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/quopri.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** quopri.py	2001/07/02 04:57:30	1.14
--- quopri.py	2001/09/04 19:14:14	1.15
***************
*** 28,32 ****
      """Quote a single character."""
      i = ord(c)
!     return ESCAPE + HEX[i/16] + HEX[i%16]
  
  
--- 28,32 ----
      """Quote a single character."""
      i = ord(c)
!     return ESCAPE + HEX[i//16] + HEX[i%16]
  
  

Index: repr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/repr.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** repr.py	2001/08/09 18:56:27	1.11
--- repr.py	2001/09/04 19:14:14	1.12
***************
*** 66,70 ****
          s = `x[:self.maxstring]`
          if len(s) > self.maxstring:
!             i = max(0, (self.maxstring-3)/2)
              j = max(0, self.maxstring-3-i)
              s = `x[:i] + x[len(x)-j:]`
--- 66,70 ----
          s = `x[:self.maxstring]`
          if len(s) > self.maxstring:
!             i = max(0, (self.maxstring-3)//2)
              j = max(0, self.maxstring-3-i)
              s = `x[:i] + x[len(x)-j:]`
***************
*** 74,78 ****
          s = `x` # XXX Hope this isn't too slow...
          if len(s) > self.maxlong:
!             i = max(0, (self.maxlong-3)/2)
              j = max(0, self.maxlong-3-i)
              s = s[:i] + '...' + s[len(s)-j:]
--- 74,78 ----
          s = `x` # XXX Hope this isn't too slow...
          if len(s) > self.maxlong:
!             i = max(0, (self.maxlong-3)//2)
              j = max(0, self.maxlong-3-i)
              s = s[:i] + '...' + s[len(s)-j:]
***************
*** 87,91 ****
                        hex(id(x))[2:] + '>'
          if len(s) > self.maxstring:
!             i = max(0, (self.maxstring-3)/2)
              j = max(0, self.maxstring-3-i)
              s = s[:i] + '...' + s[len(s)-j:]
--- 87,91 ----
                        hex(id(x))[2:] + '>'
          if len(s) > self.maxstring:
!             i = max(0, (self.maxstring-3)//2)
              j = max(0, self.maxstring-3-i)
              s = s[:i] + '...' + s[len(s)-j:]

Index: rfc822.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** rfc822.py	2001/09/04 06:37:28	1.62
--- rfc822.py	2001/09/04 19:14:14	1.63
***************
*** 928,932 ****
          else:
              tzsign = 1
!         tzoffset = tzsign * ( (tzoffset/100)*3600 + (tzoffset % 100)*60)
      tuple = (yy, mm, dd, thh, tmm, tss, 0, 0, 0, tzoffset)
      return tuple
--- 928,932 ----
          else:
              tzsign = 1
!         tzoffset = tzsign * ( (tzoffset//100)*3600 + (tzoffset % 100)*60)
      tuple = (yy, mm, dd, thh, tmm, tss, 0, 0, 0, tzoffset)
      return tuple

Index: wave.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/wave.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** wave.py	2001/03/01 04:27:19	1.15
--- wave.py	2001/09/04 19:14:14	1.16
***************
*** 147,151 ****
                      raise Error, 'data chunk before fmt chunk'
                  self._data_chunk = chunk
!                 self._nframes = chunk.chunksize / self._framesize
                  self._data_seek_needed = 0
                  break
--- 147,151 ----
                      raise Error, 'data chunk before fmt chunk'
                  self._data_chunk = chunk
!                 self._nframes = chunk.chunksize // self._framesize
                  self._data_seek_needed = 0
                  break
***************
*** 249,253 ****
          if self._convert and data:
              data = self._convert(data)
!         self._soundpos = self._soundpos + len(data) / (self._nchannels * self._sampwidth)
          return data
  
--- 249,253 ----
          if self._convert and data:
              data = self._convert(data)
!         self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
          return data
  
***************
*** 260,264 ****
          if wFormatTag == WAVE_FORMAT_PCM:
              sampwidth = struct.unpack('<h', chunk.read(2))[0]
!             self._sampwidth = (sampwidth + 7) / 8
          else:
              raise Error, 'unknown format: ' + `wFormatTag`
--- 260,264 ----
          if wFormatTag == WAVE_FORMAT_PCM:
              sampwidth = struct.unpack('<h', chunk.read(2))[0]
!             self._sampwidth = (sampwidth + 7) // 8
          else:
              raise Error, 'unknown format: ' + `wFormatTag`
***************
*** 404,408 ****
      def writeframesraw(self, data):
          self._ensure_header_written(len(data))
!         nframes = len(data) / (self._sampwidth * self._nchannels)
          if self._convert:
              data = self._convert(data)
--- 404,408 ----
      def writeframesraw(self, data):
          self._ensure_header_written(len(data))
!         nframes = len(data) // (self._sampwidth * self._nchannels)
          if self._convert:
              data = self._convert(data)