diff options
| author | Brandon Palm <bapalm@us.ibm.com> | 2016-02-22 16:20:30 -0600 |
|---|---|---|
| committer | Brandon Palm <bapalm@us.ibm.com> | 2016-02-22 16:23:23 -0600 |
| commit | 11a8f911affe10bacce41ad3474a28aff3417ec3 (patch) | |
| tree | 4db4dc8767633b6064a5e43ba2622513a1d164d1 /openstackclient/api/api.py | |
| parent | c57fc41c33df58237f6b3ec8a5b2a0ff9573da2e (diff) | |
| download | python-openstackclient-11a8f911affe10bacce41ad3474a28aff3417ec3.tar.gz | |
Use instanceof instead of type
Adjusted conditional statements to use instanceof when
comparing variables. Instanceof supports inheritance type
checking better than type.
Change-Id: I4ee0004934dc2322d43ef07e797a6811e39a812c
Closes-Bug: 1548530
Diffstat (limited to 'openstackclient/api/api.py')
| -rw-r--r-- | openstackclient/api/api.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/openstackclient/api/api.py b/openstackclient/api/api.py index 97eb7e4a..6a88e7f7 100644 --- a/openstackclient/api/api.py +++ b/openstackclient/api/api.py @@ -243,14 +243,14 @@ class BaseAPI(KeystoneSession): def getlist(kw): """Do list call, unwrap resource dict if present""" ret = self.list(path, **kw) - if type(ret) == dict and resource in ret: + if isinstance(ret, dict) and resource in ret: ret = ret[resource] return ret # Search by attribute kwargs = {attr: value} data = getlist(kwargs) - if type(data) == dict: + if isinstance(data, dict): return data if len(data) == 1: return data[0] @@ -283,7 +283,7 @@ class BaseAPI(KeystoneSession): """ items = self.list(path) - if type(items) == dict: + if isinstance(items, dict): # strip off the enclosing dict key = list(items.keys())[0] items = items[key] |
