Mercurial > hg
changeset 48935:2cce2fa5bcf7
py3: replace pycompat.itervalues(x) with x.values()
pycompat.itervalues(x) just calls x.values(). So this is equivalent.
The rewrite was perfomed via an automated search and replace.
Differential Revision: https://phab.mercurial-scm.org/D12341
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 01 Mar 2022 20:52:32 -0800 |
parents | 06de08b36c82 |
children | 680322e04f56 |
files | contrib/synthrepo.py hgext/journal.py hgext/rebase.py hgext/remotefilelog/connectionpool.py hgext/remotefilelog/debugcommands.py hgext/remotefilelog/repack.py hgext/transplant.py mercurial/branchmap.py mercurial/exchange.py mercurial/localrepo.py mercurial/mergestate.py mercurial/patch.py mercurial/statprof.py mercurial/ui.py tests/test-pathencode.py |
diffstat | 15 files changed, 19 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/synthrepo.py Mon Feb 21 11:24:57 2022 -0700 +++ b/contrib/synthrepo.py Tue Mar 01 20:52:32 2022 -0800 @@ -212,7 +212,7 @@ for filename, mar, lineadd, lineremove, isbin in parsegitdiff(diff): if isbin: continue - added = sum(pycompat.itervalues(lineadd), 0) + added = sum(lineadd.values(), 0) if mar == 'm': if added and lineremove: lineschanged[
--- a/hgext/journal.py Mon Feb 21 11:24:57 2022 -0700 +++ b/hgext/journal.py Tue Mar 01 20:52:32 2022 -0800 @@ -166,7 +166,7 @@ pass while iterable_map: - value, key, it = order(pycompat.itervalues(iterable_map)) + value, key, it = order(iterable_map.values()) yield value try: iterable_map[key][0] = next(it)
--- a/hgext/rebase.py Mon Feb 21 11:24:57 2022 -0700 +++ b/hgext/rebase.py Tue Mar 01 20:52:32 2022 -0800 @@ -2257,7 +2257,7 @@ msg = _(b'rebase: (use "hg rebase --abort" to clear broken state)\n') ui.write(msg) return - numrebased = len([i for i in pycompat.itervalues(state) if i >= 0]) + numrebased = len([i for i in state.values() if i >= 0]) # i18n: column positioning for "hg summary" ui.write( _(b'rebase: %s, %s (rebase --continue)\n')
--- a/hgext/remotefilelog/connectionpool.py Mon Feb 21 11:24:57 2022 -0700 +++ b/hgext/remotefilelog/connectionpool.py Tue Mar 01 20:52:32 2022 -0800 @@ -8,7 +8,6 @@ from mercurial import ( hg, - pycompat, sshpeer, util, ) @@ -60,7 +59,7 @@ return conn def close(self): - for pathpool in pycompat.itervalues(self._pool): + for pathpool in self._pool.values(): for conn in pathpool: conn.close() del pathpool[:]
--- a/hgext/remotefilelog/debugcommands.py Mon Feb 21 11:24:57 2022 -0700 +++ b/hgext/remotefilelog/debugcommands.py Tue Mar 01 20:52:32 2022 -0800 @@ -210,7 +210,7 @@ continue filepath = os.path.join(root, file) size, firstnode, mapping = parsefileblob(filepath, decompress) - for p1, p2, linknode, copyfrom in pycompat.itervalues(mapping): + for p1, p2, linknode, copyfrom in mapping.values(): if linknode == sha1nodeconstants.nullid: actualpath = os.path.relpath(root, path) key = fileserverclient.getcachekey(
--- a/hgext/remotefilelog/repack.py Mon Feb 21 11:24:57 2022 -0700 +++ b/hgext/remotefilelog/repack.py Tue Mar 01 20:52:32 2022 -0800 @@ -594,7 +594,7 @@ maxchainlen = ui.configint(b'packs', b'maxchainlen', 1000) byfile = {} - for entry in pycompat.itervalues(ledger.entries): + for entry in ledger.entries.values(): if entry.datasource: byfile.setdefault(entry.filename, {})[entry.node] = entry @@ -749,7 +749,7 @@ ui = self.repo.ui byfile = {} - for entry in pycompat.itervalues(ledger.entries): + for entry in ledger.entries.values(): if entry.historysource: byfile.setdefault(entry.filename, {})[entry.node] = entry
--- a/hgext/transplant.py Mon Feb 21 11:24:57 2022 -0700 +++ b/hgext/transplant.py Tue Mar 01 20:52:32 2022 -0800 @@ -106,7 +106,7 @@ if not os.path.isdir(self.path): os.mkdir(self.path) fp = self.opener(self.transplantfile, b'w') - for list in pycompat.itervalues(self.transplants): + for list in self.transplants.values(): for t in list: l, r = map(hex, (t.lnode, t.rnode)) fp.write(l + b':' + r + b'\n')
--- a/mercurial/branchmap.py Mon Feb 21 11:24:57 2022 -0700 +++ b/mercurial/branchmap.py Tue Mar 01 20:52:32 2022 -0800 @@ -119,7 +119,7 @@ clbranchinfo = cl.branchinfo rbheads = [] closed = set() - for bheads in pycompat.itervalues(remotebranchmap): + for bheads in remotebranchmap.values(): rbheads += bheads for h in bheads: r = clrev(h) @@ -406,7 +406,7 @@ def iterheads(self): """returns all the heads""" self._verifyall() - return pycompat.itervalues(self._entries) + return self._entries.values() def copy(self): """return an deep copy of the branchcache object"""
--- a/mercurial/exchange.py Mon Feb 21 11:24:57 2022 -0700 +++ b/mercurial/exchange.py Tue Mar 01 20:52:32 2022 -0800 @@ -854,7 +854,7 @@ checks = {p: [] for p in phases.allphases} checks[phases.public].extend(pushop.remotephases.publicheads) checks[phases.draft].extend(pushop.remotephases.draftroots) - if any(pycompat.itervalues(checks)): + if any(checks.values()): for phase in checks: checks[phase].sort() checkdata = phases.binaryencode(checks)
--- a/mercurial/localrepo.py Mon Feb 21 11:24:57 2022 -0700 +++ b/mercurial/localrepo.py Tue Mar 01 20:52:32 2022 -0800 @@ -2139,7 +2139,7 @@ nodetagscache = {} for t, n in self._tagscache.tags.items(): nodetagscache.setdefault(n, []).append(t) - for tags in pycompat.itervalues(nodetagscache): + for tags in nodetagscache.values(): tags.sort() self._tagscache.nodetagscache = nodetagscache return self._tagscache.nodetagscache.get(node, [])
--- a/mercurial/mergestate.py Mon Feb 21 11:24:57 2022 -0700 +++ b/mercurial/mergestate.py Tue Mar 01 20:52:32 2022 -0800 @@ -13,7 +13,6 @@ from . import ( error, filemerge, - pycompat, util, ) from .utils import hashutil @@ -467,7 +466,7 @@ """return counts for updated, merged and removed files in this session""" updated, merged, removed = 0, 0, 0 - for r, action in pycompat.itervalues(self._results): + for r, action in self._results.values(): if r is None: updated += 1 elif r == 0:
--- a/mercurial/patch.py Mon Feb 21 11:24:57 2022 -0700 +++ b/mercurial/patch.py Tue Mar 01 20:52:32 2022 -0800 @@ -1342,11 +1342,7 @@ fixoffset += chunk.removed - chunk.added return ( sum( - [ - h - for h in pycompat.itervalues(applied) - if h[0].special() or len(h) > 1 - ], + [h for h in applied.values() if h[0].special() or len(h) > 1], [], ), {},
--- a/mercurial/statprof.py Mon Feb 21 11:24:57 2022 -0700 +++ b/mercurial/statprof.py Tue Mar 01 20:52:32 2022 -0800 @@ -474,7 +474,7 @@ if i == 0: sitestat.addself() - return [s for s in pycompat.itervalues(stats)] + return [s for s in stats.values()] class DisplayFormats: @@ -745,9 +745,7 @@ def _write(node, depth, multiple_siblings): site = node.site visiblechildren = [ - c - for c in pycompat.itervalues(node.children) - if c.count >= (limit * root.count) + c for c in node.children.values() if c.count >= (limit * root.count) ] if site: indent = depth * 2 - 1 @@ -783,9 +781,7 @@ ) finalstring = liststring + codestring - childrensamples = sum( - [c.count for c in pycompat.itervalues(node.children)] - ) + childrensamples = sum([c.count for c in node.children.values()]) # Make frames that performed more than 10% of the operation red if node.count - childrensamples > (0.1 * root.count): finalstring = b'\033[91m' + finalstring + b'\033[0m'
--- a/mercurial/ui.py Mon Feb 21 11:24:57 2022 -0700 +++ b/mercurial/ui.py Tue Mar 01 20:52:32 2022 -0800 @@ -2117,9 +2117,7 @@ """ if not self._loggers: return - activeloggers = [ - l for l in pycompat.itervalues(self._loggers) if l.tracked(event) - ] + activeloggers = [l for l in self._loggers.values() if l.tracked(event)] if not activeloggers: return msg = msgfmt % msgargs
--- a/tests/test-pathencode.py Mon Feb 21 11:24:57 2022 -0700 +++ b/tests/test-pathencode.py Tue Mar 01 20:52:32 2022 -0800 @@ -66,7 +66,7 @@ counts[c] += 1 for c in '\r/\n': counts.pop(c, None) - t = sum(pycompat.itervalues(counts)) / 100.0 + t = sum(counts.values()) / 100.0 fp.write('probtable = (') for i, (k, v) in enumerate( sorted(counts.items(), key=lambda x: x[1], reverse=True)