##// END OF EJS Templates
py3: replace pycompat.itervalues(x) with x.values()...
Gregory Szorc -
r49790:2cce2fa5 default
parent child Browse files
Show More
@@ -212,7 +212,7 b' def analyze(ui, repo, *revs, **opts):'
212 for filename, mar, lineadd, lineremove, isbin in parsegitdiff(diff):
212 for filename, mar, lineadd, lineremove, isbin in parsegitdiff(diff):
213 if isbin:
213 if isbin:
214 continue
214 continue
215 added = sum(pycompat.itervalues(lineadd), 0)
215 added = sum(lineadd.values(), 0)
216 if mar == 'm':
216 if mar == 'm':
217 if added and lineremove:
217 if added and lineremove:
218 lineschanged[
218 lineschanged[
@@ -166,7 +166,7 b' def _mergeentriesiter(*iterables, **kwar'
166 pass
166 pass
167
167
168 while iterable_map:
168 while iterable_map:
169 value, key, it = order(pycompat.itervalues(iterable_map))
169 value, key, it = order(iterable_map.values())
170 yield value
170 yield value
171 try:
171 try:
172 iterable_map[key][0] = next(it)
172 iterable_map[key][0] = next(it)
@@ -2257,7 +2257,7 b' def summaryhook(ui, repo):'
2257 msg = _(b'rebase: (use "hg rebase --abort" to clear broken state)\n')
2257 msg = _(b'rebase: (use "hg rebase --abort" to clear broken state)\n')
2258 ui.write(msg)
2258 ui.write(msg)
2259 return
2259 return
2260 numrebased = len([i for i in pycompat.itervalues(state) if i >= 0])
2260 numrebased = len([i for i in state.values() if i >= 0])
2261 # i18n: column positioning for "hg summary"
2261 # i18n: column positioning for "hg summary"
2262 ui.write(
2262 ui.write(
2263 _(b'rebase: %s, %s (rebase --continue)\n')
2263 _(b'rebase: %s, %s (rebase --continue)\n')
@@ -8,7 +8,6 b''
8
8
9 from mercurial import (
9 from mercurial import (
10 hg,
10 hg,
11 pycompat,
12 sshpeer,
11 sshpeer,
13 util,
12 util,
14 )
13 )
@@ -60,7 +59,7 b' class connectionpool(object):'
60 return conn
59 return conn
61
60
62 def close(self):
61 def close(self):
63 for pathpool in pycompat.itervalues(self._pool):
62 for pathpool in self._pool.values():
64 for conn in pathpool:
63 for conn in pathpool:
65 conn.close()
64 conn.close()
66 del pathpool[:]
65 del pathpool[:]
@@ -210,7 +210,7 b' def verifyremotefilelog(ui, path, **opts'
210 continue
210 continue
211 filepath = os.path.join(root, file)
211 filepath = os.path.join(root, file)
212 size, firstnode, mapping = parsefileblob(filepath, decompress)
212 size, firstnode, mapping = parsefileblob(filepath, decompress)
213 for p1, p2, linknode, copyfrom in pycompat.itervalues(mapping):
213 for p1, p2, linknode, copyfrom in mapping.values():
214 if linknode == sha1nodeconstants.nullid:
214 if linknode == sha1nodeconstants.nullid:
215 actualpath = os.path.relpath(root, path)
215 actualpath = os.path.relpath(root, path)
216 key = fileserverclient.getcachekey(
216 key = fileserverclient.getcachekey(
@@ -594,7 +594,7 b' class repacker(object):'
594 maxchainlen = ui.configint(b'packs', b'maxchainlen', 1000)
594 maxchainlen = ui.configint(b'packs', b'maxchainlen', 1000)
595
595
596 byfile = {}
596 byfile = {}
597 for entry in pycompat.itervalues(ledger.entries):
597 for entry in ledger.entries.values():
598 if entry.datasource:
598 if entry.datasource:
599 byfile.setdefault(entry.filename, {})[entry.node] = entry
599 byfile.setdefault(entry.filename, {})[entry.node] = entry
600
600
@@ -749,7 +749,7 b' class repacker(object):'
749 ui = self.repo.ui
749 ui = self.repo.ui
750
750
751 byfile = {}
751 byfile = {}
752 for entry in pycompat.itervalues(ledger.entries):
752 for entry in ledger.entries.values():
753 if entry.historysource:
753 if entry.historysource:
754 byfile.setdefault(entry.filename, {})[entry.node] = entry
754 byfile.setdefault(entry.filename, {})[entry.node] = entry
755
755
@@ -106,7 +106,7 b' class transplants(object):'
106 if not os.path.isdir(self.path):
106 if not os.path.isdir(self.path):
107 os.mkdir(self.path)
107 os.mkdir(self.path)
108 fp = self.opener(self.transplantfile, b'w')
108 fp = self.opener(self.transplantfile, b'w')
109 for list in pycompat.itervalues(self.transplants):
109 for list in self.transplants.values():
110 for t in list:
110 for t in list:
111 l, r = map(hex, (t.lnode, t.rnode))
111 l, r = map(hex, (t.lnode, t.rnode))
112 fp.write(l + b':' + r + b'\n')
112 fp.write(l + b':' + r + b'\n')
@@ -119,7 +119,7 b' class BranchMapCache(object):'
119 clbranchinfo = cl.branchinfo
119 clbranchinfo = cl.branchinfo
120 rbheads = []
120 rbheads = []
121 closed = set()
121 closed = set()
122 for bheads in pycompat.itervalues(remotebranchmap):
122 for bheads in remotebranchmap.values():
123 rbheads += bheads
123 rbheads += bheads
124 for h in bheads:
124 for h in bheads:
125 r = clrev(h)
125 r = clrev(h)
@@ -406,7 +406,7 b' class branchcache(object):'
406 def iterheads(self):
406 def iterheads(self):
407 """returns all the heads"""
407 """returns all the heads"""
408 self._verifyall()
408 self._verifyall()
409 return pycompat.itervalues(self._entries)
409 return self._entries.values()
410
410
411 def copy(self):
411 def copy(self):
412 """return an deep copy of the branchcache object"""
412 """return an deep copy of the branchcache object"""
@@ -854,7 +854,7 b' def _pushb2checkphases(pushop, bundler):'
854 checks = {p: [] for p in phases.allphases}
854 checks = {p: [] for p in phases.allphases}
855 checks[phases.public].extend(pushop.remotephases.publicheads)
855 checks[phases.public].extend(pushop.remotephases.publicheads)
856 checks[phases.draft].extend(pushop.remotephases.draftroots)
856 checks[phases.draft].extend(pushop.remotephases.draftroots)
857 if any(pycompat.itervalues(checks)):
857 if any(checks.values()):
858 for phase in checks:
858 for phase in checks:
859 checks[phase].sort()
859 checks[phase].sort()
860 checkdata = phases.binaryencode(checks)
860 checkdata = phases.binaryencode(checks)
@@ -2139,7 +2139,7 b' class localrepository(object):'
2139 nodetagscache = {}
2139 nodetagscache = {}
2140 for t, n in self._tagscache.tags.items():
2140 for t, n in self._tagscache.tags.items():
2141 nodetagscache.setdefault(n, []).append(t)
2141 nodetagscache.setdefault(n, []).append(t)
2142 for tags in pycompat.itervalues(nodetagscache):
2142 for tags in nodetagscache.values():
2143 tags.sort()
2143 tags.sort()
2144 self._tagscache.nodetagscache = nodetagscache
2144 self._tagscache.nodetagscache = nodetagscache
2145 return self._tagscache.nodetagscache.get(node, [])
2145 return self._tagscache.nodetagscache.get(node, [])
@@ -13,7 +13,6 b' from .node import ('
13 from . import (
13 from . import (
14 error,
14 error,
15 filemerge,
15 filemerge,
16 pycompat,
17 util,
16 util,
18 )
17 )
19 from .utils import hashutil
18 from .utils import hashutil
@@ -467,7 +466,7 b' class _mergestate_base(object):'
467 """return counts for updated, merged and removed files in this
466 """return counts for updated, merged and removed files in this
468 session"""
467 session"""
469 updated, merged, removed = 0, 0, 0
468 updated, merged, removed = 0, 0, 0
470 for r, action in pycompat.itervalues(self._results):
469 for r, action in self._results.values():
471 if r is None:
470 if r is None:
472 updated += 1
471 updated += 1
473 elif r == 0:
472 elif r == 0:
@@ -1342,11 +1342,7 b' the hunk is left unchanged.'
1342 fixoffset += chunk.removed - chunk.added
1342 fixoffset += chunk.removed - chunk.added
1343 return (
1343 return (
1344 sum(
1344 sum(
1345 [
1345 [h for h in applied.values() if h[0].special() or len(h) > 1],
1346 h
1347 for h in pycompat.itervalues(applied)
1348 if h[0].special() or len(h) > 1
1349 ],
1350 [],
1346 [],
1351 ),
1347 ),
1352 {},
1348 {},
@@ -474,7 +474,7 b' class SiteStats(object):'
474 if i == 0:
474 if i == 0:
475 sitestat.addself()
475 sitestat.addself()
476
476
477 return [s for s in pycompat.itervalues(stats)]
477 return [s for s in stats.values()]
478
478
479
479
480 class DisplayFormats:
480 class DisplayFormats:
@@ -745,9 +745,7 b' def display_hotpath(data, fp, limit=0.05'
745 def _write(node, depth, multiple_siblings):
745 def _write(node, depth, multiple_siblings):
746 site = node.site
746 site = node.site
747 visiblechildren = [
747 visiblechildren = [
748 c
748 c for c in node.children.values() if c.count >= (limit * root.count)
749 for c in pycompat.itervalues(node.children)
750 if c.count >= (limit * root.count)
751 ]
749 ]
752 if site:
750 if site:
753 indent = depth * 2 - 1
751 indent = depth * 2 - 1
@@ -783,9 +781,7 b' def display_hotpath(data, fp, limit=0.05'
783 )
781 )
784
782
785 finalstring = liststring + codestring
783 finalstring = liststring + codestring
786 childrensamples = sum(
784 childrensamples = sum([c.count for c in node.children.values()])
787 [c.count for c in pycompat.itervalues(node.children)]
788 )
789 # Make frames that performed more than 10% of the operation red
785 # Make frames that performed more than 10% of the operation red
790 if node.count - childrensamples > (0.1 * root.count):
786 if node.count - childrensamples > (0.1 * root.count):
791 finalstring = b'\033[91m' + finalstring + b'\033[0m'
787 finalstring = b'\033[91m' + finalstring + b'\033[0m'
@@ -2117,9 +2117,7 b' class ui(object):'
2117 """
2117 """
2118 if not self._loggers:
2118 if not self._loggers:
2119 return
2119 return
2120 activeloggers = [
2120 activeloggers = [l for l in self._loggers.values() if l.tracked(event)]
2121 l for l in pycompat.itervalues(self._loggers) if l.tracked(event)
2122 ]
2123 if not activeloggers:
2121 if not activeloggers:
2124 return
2122 return
2125 msg = msgfmt % msgargs
2123 msg = msgfmt % msgargs
@@ -66,7 +66,7 b" def buildprobtable(fp, cmd='hg manifest "
66 counts[c] += 1
66 counts[c] += 1
67 for c in '\r/\n':
67 for c in '\r/\n':
68 counts.pop(c, None)
68 counts.pop(c, None)
69 t = sum(pycompat.itervalues(counts)) / 100.0
69 t = sum(counts.values()) / 100.0
70 fp.write('probtable = (')
70 fp.write('probtable = (')
71 for i, (k, v) in enumerate(
71 for i, (k, v) in enumerate(
72 sorted(counts.items(), key=lambda x: x[1], reverse=True)
72 sorted(counts.items(), key=lambda x: x[1], reverse=True)
General Comments 0
You need to be logged in to leave comments. Login now