From 6b5e3d1faa71ce68836f6351996bd3b37854496b Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Wed, 24 Feb 2016 13:46:39 -0600 Subject: [PATCH] Use instanceof instead of type Adjusted conditional statements to use instanceof when comparing variables. Instanceof supports inheritance type checking better than type. Change-Id: I449f3df92b3646c384de717b7d53f7f85258c449 --- cinderclient/tests/unit/fakes.py | 2 +- cinderclient/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cinderclient/tests/unit/fakes.py b/cinderclient/tests/unit/fakes.py index 24ef8b3..b4bcafc 100644 --- a/cinderclient/tests/unit/fakes.py +++ b/cinderclient/tests/unit/fakes.py @@ -42,7 +42,7 @@ class FakeClient(object): result = True try: for key, value in partial.items(): - if type(value) is dict: + if isinstance(value, dict): result = self._dict_match(value, real[key]) else: assert real[key] == value diff --git a/cinderclient/utils.py b/cinderclient/utils.py index c501e7c..ff339d0 100644 --- a/cinderclient/utils.py +++ b/cinderclient/utils.py @@ -140,7 +140,7 @@ def print_list(objs, fields, exclude_unavailable=False, formatters=None, field_name = field.replace(' ', '_') else: field_name = field.lower().replace(' ', '_') - if type(o) == dict and field in o: + if isinstance(o, dict) and field in o: data = o[field] else: if not hasattr(o, field_name) and exclude_unavailable: