diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-02-26 18:57:46 -0800 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2017-02-26 19:34:48 -0800 |
commit | 46125c3ef9fcbbfba72c09ca1f4a5eb7bca655ef (patch) | |
tree | 28b35ab59d2205adaa7dfb4bde4a885ce022e8de /tests/unit/apiserver | |
parent | 177feabf43564afd28c7b4112ad4e384a3654bd8 (diff) |
heat: replace dict key checking with .get()
We init all the fields to None, so the default value
is None, which is what .get() returns when the key
is not present it the dictionary.
Replace
if key in dict:
self.val = dict[key]
with
self.val = dict.get(key)
This also has the added beneifit of re-initializing
default values to None.
In idiomatic Python we do not check a dictionary twice
if we can avoid it. Either use dict.get() with a default
value or catch the KeyError and do the correct thing.
Change-Id: If8d1caeb7288f888f02622d62e8db9f59f50717a
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/apiserver')
0 files changed, 0 insertions, 0 deletions