mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
util: explicitly tests for None
Changeset 3b9cdb72931f removed the mutable default value, but did not explicitly tested for None. Such implicit checking can introduce semantic and performance issue. We move to an explicit check for None as recommended by PEP8: https://www.python.org/dev/peps/pep-0008/#programming-recommendations
This commit is contained in:
parent
8561a8e8ff
commit
fc2b521909
@ -1831,7 +1831,8 @@ def parsetimezone(s):
|
||||
def strdate(string, format, defaults=None):
|
||||
"""parse a localized time string and return a (unixtime, offset) tuple.
|
||||
if the string cannot be parsed, ValueError is raised."""
|
||||
defaults = defaults or {}
|
||||
if defaults is None:
|
||||
defaults = {}
|
||||
|
||||
# NOTE: unixtime = localunixtime + offset
|
||||
offset, date = parsetimezone(string)
|
||||
|
Loading…
Reference in New Issue
Block a user