Mercurial > hg-stable
changeset 36307:a748a5d1d7c3
webcommands: unpack contents of length-1 dict portably
((k,v),) = dict.items() was suggested by some friends, but I feel like
that's maybe too clever?
Differential Revision: https://phab.mercurial-scm.org/D2304
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 17 Feb 2018 22:38:25 -0500 |
parents | 1ec6fd26f841 |
children | 0cacd4df6eb0 |
files | mercurial/hgweb/webcommands.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Sat Feb 17 22:37:35 2018 -0500 +++ b/mercurial/hgweb/webcommands.py Sat Feb 17 22:38:25 2018 -0500 @@ -542,7 +542,7 @@ emptydirs = [] h = dirs[d] while isinstance(h, dict) and len(h) == 1: - k, v = h.items()[0] + k, v = next(iter(h.items())) if v: emptydirs.append(k) h = v