comparison mercurial/httpconnection.py @ 15791:a814f8fcc65a

Use explicit integer division Found by running the test suite with the -3 flag to show places where we have int / int division that can be replaced with int // int.
author Martin Geisler <mg@aragost.com>
date Sun, 08 Jan 2012 18:15:54 +0100
parents b3083042bdda
children 72803c8edaa4
comparison
equal deleted inserted replaced
15790:52f816b40674 15791:a814f8fcc65a
36 self.seek = self._data.seek 36 self.seek = self._data.seek
37 self.close = self._data.close 37 self.close = self._data.close
38 self.write = self._data.write 38 self.write = self._data.write
39 self.length = os.fstat(self._data.fileno()).st_size 39 self.length = os.fstat(self._data.fileno()).st_size
40 self._pos = 0 40 self._pos = 0
41 self._total = self.length / 1024 * 2 41 self._total = self.length // 1024 * 2
42 42
43 def read(self, *args, **kwargs): 43 def read(self, *args, **kwargs):
44 try: 44 try:
45 ret = self._data.read(*args, **kwargs) 45 ret = self._data.read(*args, **kwargs)
46 except EOFError: 46 except EOFError:
49 # We pass double the max for total because we currently have 49 # We pass double the max for total because we currently have
50 # to send the bundle twice in the case of a server that 50 # to send the bundle twice in the case of a server that
51 # requires authentication. Since we can't know until we try 51 # requires authentication. Since we can't know until we try
52 # once whether authentication will be required, just lie to 52 # once whether authentication will be required, just lie to
53 # the user and maybe the push succeeds suddenly at 50%. 53 # the user and maybe the push succeeds suddenly at 50%.
54 self.ui.progress(_('sending'), self._pos / 1024, 54 self.ui.progress(_('sending'), self._pos // 1024,
55 unit=_('kb'), total=self._total) 55 unit=_('kb'), total=self._total)
56 return ret 56 return ret
57 57
58 # moved here from url.py to avoid a cycle 58 # moved here from url.py to avoid a cycle
59 def readauthforuri(ui, uri, user): 59 def readauthforuri(ui, uri, user):