mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
py3: convert some dict.iteritems() calls to items()
Summary: These call sites are hit during initialization. They all appear to be small-ish dictionaries so the performance hit of having this iteration be non-lazy in Python 2 should not matter much. Reviewed By: farnz Differential Revision: D19591565 fbshipit-source-id: 324844d64ba63f6e379aab270e453d44a02063e9
This commit is contained in:
parent
3a71160859
commit
c049799e91
@ -1033,7 +1033,7 @@ def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
|
||||
def loadinternalmerge(ui, extname, registrarobj):
|
||||
"""Load internal merge tool from specified registrarobj
|
||||
"""
|
||||
for name, func in registrarobj._table.iteritems():
|
||||
for name, func in registrarobj._table.items():
|
||||
fullname = ":" + name
|
||||
internals[fullname] = func
|
||||
internals["internal:" + name] = func
|
||||
|
@ -671,7 +671,7 @@ def prettyformat(tree):
|
||||
def loadpredicate(ui, extname, registrarobj):
|
||||
"""Load fileset predicates from specified registrarobj
|
||||
"""
|
||||
for name, func in registrarobj._table.iteritems():
|
||||
for name, func in registrarobj._table.items():
|
||||
symbols[name] = func
|
||||
if func._callstatus:
|
||||
_statuscallers.add(name)
|
||||
|
@ -247,7 +247,7 @@ if sys.version_info[0] >= 3:
|
||||
they can be passed as keyword arguments as dictonaries with bytes keys
|
||||
can't be passed as keyword arguments to functions on Python 3.
|
||||
"""
|
||||
dic = dict((k.decode("latin-1"), v) for k, v in dic.iteritems())
|
||||
dic = dict((k.decode("latin-1"), v) for k, v in dic.items())
|
||||
return dic
|
||||
|
||||
def byteskwargs(dic):
|
||||
@ -255,7 +255,7 @@ if sys.version_info[0] >= 3:
|
||||
Converts keys of python dictonaries to bytes as they were converted to
|
||||
str to pass that dictonary as a keyword argument on Python 3.
|
||||
"""
|
||||
dic = dict((k.encode("latin-1"), v) for k, v in dic.iteritems())
|
||||
dic = dict((k.encode("latin-1"), v) for k, v in dic.items())
|
||||
return dic
|
||||
|
||||
# TODO: handle shlex.shlex().
|
||||
|
@ -2535,7 +2535,7 @@ def makematcher(tree):
|
||||
def loadpredicate(ui, extname, registrarobj):
|
||||
"""Load revset predicates from specified registrarobj
|
||||
"""
|
||||
for name, func in registrarobj._table.iteritems():
|
||||
for name, func in registrarobj._table.items():
|
||||
symbols[name] = func
|
||||
if func._safe:
|
||||
safesymbols.add(name)
|
||||
|
@ -154,7 +154,7 @@ def _buildencodefun(forfncache):
|
||||
cmap[xchr(x)] = e + xchr(x).lower()
|
||||
|
||||
dmap = {}
|
||||
for k, v in cmap.iteritems():
|
||||
for k, v in cmap.items():
|
||||
dmap[v] = k
|
||||
|
||||
if not forfncache:
|
||||
|
Loading…
Reference in New Issue
Block a user