Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 52643:5cc8deb96b48
pyupgrade: modernize calls to superclass methods
This is the `legacy` fixer in `pyupgrade`, with the loop yielding the offset of
`yield` statements commented out.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 05 Jan 2025 22:23:31 -0500 |
parents | 24ee91ba9aa8 |
children | e627cc25b6f3 |
comparison
equal
deleted
inserted
replaced
52642:73ab542565e0 | 52643:5cc8deb96b48 |
---|---|
851 def __init__(self, ui, fp): | 851 def __init__(self, ui, fp): |
852 """If header is specified, we do not read it out of the stream.""" | 852 """If header is specified, we do not read it out of the stream.""" |
853 self.ui = ui | 853 self.ui = ui |
854 self._compengine = util.compengines.forbundletype(b'UN') | 854 self._compengine = util.compengines.forbundletype(b'UN') |
855 self._compressed = None | 855 self._compressed = None |
856 super(unbundle20, self).__init__(fp) | 856 super().__init__(fp) |
857 | 857 |
858 @util.propertycache | 858 @util.propertycache |
859 def params(self): | 859 def params(self): |
860 """dictionary of stream level parameters""" | 860 """dictionary of stream level parameters""" |
861 indebug(self.ui, b'reading bundle2 stream parameters') | 861 indebug(self.ui, b'reading bundle2 stream parameters') |
1267 iteration while the consumer is reading a part. | 1267 iteration while the consumer is reading a part. |
1268 | 1268 |
1269 Part processed in this manner only have access to a ui object,""" | 1269 Part processed in this manner only have access to a ui object,""" |
1270 | 1270 |
1271 def __init__(self, ui, fp): | 1271 def __init__(self, ui, fp): |
1272 super(interrupthandler, self).__init__(fp) | 1272 super().__init__(fp) |
1273 self.ui = ui | 1273 self.ui = ui |
1274 | 1274 |
1275 def _readpartheader(self): | 1275 def _readpartheader(self): |
1276 """reads a part header size and return the bytes blob | 1276 """reads a part header size and return the bytes blob |
1277 | 1277 |
1388 | 1388 |
1389 class unbundlepart(unpackermixin): | 1389 class unbundlepart(unpackermixin): |
1390 """a bundle part read from a bundle""" | 1390 """a bundle part read from a bundle""" |
1391 | 1391 |
1392 def __init__(self, ui, header, fp): | 1392 def __init__(self, ui, header, fp): |
1393 super(unbundlepart, self).__init__(fp) | 1393 super().__init__(fp) |
1394 self._seekable = hasattr(fp, 'seek') and hasattr(fp, 'tell') | 1394 self._seekable = hasattr(fp, 'seek') and hasattr(fp, 'tell') |
1395 self.ui = ui | 1395 self.ui = ui |
1396 # unbundle state attr | 1396 # unbundle state attr |
1397 self._headerdata = header | 1397 self._headerdata = header |
1398 self._headeroffset = 0 | 1398 self._headeroffset = 0 |
1524 | 1524 |
1525 def __init__(self, ui, header, fp): | 1525 def __init__(self, ui, header, fp): |
1526 # (payload, file) offsets for chunk starts. | 1526 # (payload, file) offsets for chunk starts. |
1527 self._chunkindex = [] | 1527 self._chunkindex = [] |
1528 | 1528 |
1529 super(seekableunbundlepart, self).__init__(ui, header, fp) | 1529 super().__init__(ui, header, fp) |
1530 | 1530 |
1531 def _payloadchunks(self, chunknum=0): | 1531 def _payloadchunks(self, chunknum=0): |
1532 '''seek to specified chunk and start yielding data''' | 1532 '''seek to specified chunk and start yielding data''' |
1533 if len(self._chunkindex) == 0: | 1533 if len(self._chunkindex) == 0: |
1534 assert chunknum == 0, b'Must start with chunk 0' | 1534 assert chunknum == 0, b'Must start with chunk 0' |