Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 20679:0916f829eb8d
util: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Wed, 12 Mar 2014 13:19:20 -0400 |
parents | be27652675ce |
children | 0e8417131a29 |
comparison
equal
deleted
inserted
replaced
20678:da6bea33007b | 20679:0916f829eb8d |
---|---|
1196 >>> f(p5[0]) | 1196 >>> f(p5[0]) |
1197 False | 1197 False |
1198 """ | 1198 """ |
1199 | 1199 |
1200 def lower(date): | 1200 def lower(date): |
1201 d = dict(mb="1", d="1") | 1201 d = {'mb': "1", 'd': "1"} |
1202 return parsedate(date, extendeddateformats, d)[0] | 1202 return parsedate(date, extendeddateformats, d)[0] |
1203 | 1203 |
1204 def upper(date): | 1204 def upper(date): |
1205 d = dict(mb="12", HI="23", M="59", S="59") | 1205 d = {'mb': "12", 'HI': "23", 'M': "59", 'S': "59"} |
1206 for days in ("31", "30", "29"): | 1206 for days in ("31", "30", "29"): |
1207 try: | 1207 try: |
1208 d["d"] = days | 1208 d["d"] = days |
1209 return parsedate(date, extendeddateformats, d)[0] | 1209 return parsedate(date, extendeddateformats, d)[0] |
1210 except Abort: | 1210 except Abort: |