comparison hgext/remotefilelog/historypack.py @ 48913:f254fc73d956

global: bulk replace simple pycompat.iteritems(x) with x.items() pycompat.iteritems() just calls .items(). This commit applies a regular expression search and replace to convert simple instances of pycompat.iteritems() with .items(). There are still a handful of calls to pycompat.iteritems() remaining. But these all have more complicated expressions that I wasn't comfortable performing an automated replace on. In addition, some simple replacements were withheld because they broke pytype. These will be handled by their own changesets. Differential Revision: https://phab.mercurial-scm.org/D12318
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 03 Mar 2022 18:28:30 -0800
parents 6000f5b25c9b
children d44e3c45f0e4
comparison
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
517 nodeindexformat = self.NODEINDEXFORMAT 517 nodeindexformat = self.NODEINDEXFORMAT
518 nodeindexlength = self.NODEINDEXENTRYLENGTH 518 nodeindexlength = self.NODEINDEXENTRYLENGTH
519 519
520 files = ( 520 files = (
521 (hashutil.sha1(filename).digest(), filename, offset, size) 521 (hashutil.sha1(filename).digest(), filename, offset, size)
522 for filename, (offset, size) in pycompat.iteritems(self.files) 522 for filename, (offset, size) in self.files.items()
523 ) 523 )
524 files = sorted(files) 524 files = sorted(files)
525 525
526 # node index is after file index size, file index, and node index size 526 # node index is after file index size, file index, and node index size
527 indexlensize = struct.calcsize(b'!Q') 527 indexlensize = struct.calcsize(b'!Q')
553 nodeindexentries.append( 553 nodeindexentries.append(
554 struct.pack(constants.FILENAMESTRUCT, len(filename)) + filename 554 struct.pack(constants.FILENAMESTRUCT, len(filename)) + filename
555 ) 555 )
556 nodeindexoffset += constants.FILENAMESIZE + len(filename) 556 nodeindexoffset += constants.FILENAMESIZE + len(filename)
557 557
558 for node, location in sorted(pycompat.iteritems(nodelocations)): 558 for node, location in sorted(nodelocations.items()):
559 nodeindexentries.append( 559 nodeindexentries.append(
560 struct.pack(nodeindexformat, node, location) 560 struct.pack(nodeindexformat, node, location)
561 ) 561 )
562 nodecount += 1 562 nodecount += 1
563 563