comparison mercurial/templater.py @ 49004: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 642e31cb55f0
comparison
equal deleted inserted replaced
49003:a0674e916fb6 49004:f254fc73d956
528 (['opts'], ['opts', 'k']) 528 (['opts'], ['opts', 'k'])
529 """ 529 """
530 530
531 def compiledict(xs): 531 def compiledict(xs):
532 return util.sortdict( 532 return util.sortdict(
533 (k, compileexp(x, context, curmethods)) 533 (k, compileexp(x, context, curmethods)) for k, x in xs.items()
534 for k, x in pycompat.iteritems(xs)
535 ) 534 )
536 535
537 def compilelist(xs): 536 def compilelist(xs):
538 return [compileexp(x, context, curmethods) for x in xs] 537 return [compileexp(x, context, curmethods) for x in xs]
539 538
706 # new resources, so the defaults will be re-evaluated (issue5612) 705 # new resources, so the defaults will be re-evaluated (issue5612)
707 knownres = self._resources.knownkeys() 706 knownres = self._resources.knownkeys()
708 newres = self._resources.availablekeys(newmapping) 707 newres = self._resources.availablekeys(newmapping)
709 mapping = { 708 mapping = {
710 k: v 709 k: v
711 for k, v in pycompat.iteritems(origmapping) 710 for k, v in origmapping.items()
712 if ( 711 if (
713 k in knownres # not a symbol per self.symbol() 712 k in knownres # not a symbol per self.symbol()
714 or newres.isdisjoint(self._defaultrequires(k)) 713 or newres.isdisjoint(self._defaultrequires(k))
715 ) 714 )
716 } 715 }