Patchwork [2,of,7] python3: replace sorted(<dict>.iterkeys()) with sorted(<dict>)

login
register
mail settings
Submitter Augie Fackler
Date Aug. 29, 2017, 3:21 p.m.
Message ID <6a943a24d442ada9411c.1504020119@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/23470/
State Accepted
Headers show

Comments

Augie Fackler - Aug. 29, 2017, 3:21 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1503446818 14400
#      Tue Aug 22 20:06:58 2017 -0400
# Node ID 6a943a24d442ada9411c1d27dfe7d0250c3974f1
# Parent  fd4664b32ec7cae6dbfdd6292c04e7f1a4888da2
python3: replace sorted(<dict>.iterkeys()) with sorted(<dict>)

Patch

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -479,7 +479,7 @@  def synthesize(ui, repo, descpath, **opt
         date = min(0x7fffffff, max(0, date))
         user = random.choice(words) + '@' + random.choice(words)
         mc = context.memctx(repo, pl, makeline(minimum=2),
-                            sorted(changes.iterkeys()),
+                            sorted(changes),
                             filectxfn, user, '%d %d' % (date, pick(tzoffset)))
         newnode = mc.commit()
         heads.add(repo.changelog.rev(newnode))
diff --git a/mercurial/filelog.py b/mercurial/filelog.py
--- a/mercurial/filelog.py
+++ b/mercurial/filelog.py
@@ -31,7 +31,7 @@  def parsemeta(text):
     return meta, (s + 2)
 
 def packmeta(meta, text):
-    keys = sorted(meta.iterkeys())
+    keys = sorted(meta)
     metatext = "".join("%s: %s\n" % (k, meta[k]) for k in keys)
     return "\1\n%s\1\n%s" % (metatext, text)
 
diff --git a/tests/test-hgweb-auth.py b/tests/test-hgweb-auth.py
--- a/tests/test-hgweb-auth.py
+++ b/tests/test-hgweb-auth.py
@@ -25,7 +25,7 @@  def writeauth(items):
 
 def dumpdict(dict):
     return '{' + ', '.join(['%s: %s' % (k, dict[k])
-                            for k in sorted(dict.iterkeys())]) + '}'
+                            for k in sorted(dict)]) + '}'
 
 def test(auth, urls=None):
     print('CFG:', dumpdict(auth))