From e228035f442cf161af39202e931514528d6cab1a Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Thu, 31 Jan 2013 10:08:11 +0800 Subject: Fixes "is not" usage Fixes bug #1110973 Change-Id: I68451ce32f3036e43a2bf1f59a02b392a9e40d6d --- nova/api/ec2/cloud.py | 2 +- nova/common/memorycache.py | 2 +- nova/tests/api/openstack/fakes.py | 6 +++--- nova/utils.py | 2 +- nova/virt/libvirt/imagecache.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 48b0f632f..632ea668c 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -407,7 +407,7 @@ class CloudController(object): def describe_key_pairs(self, context, key_name=None, **kwargs): key_pairs = self.keypair_api.get_key_pairs(context, context.user_id) - if not key_name is None: + if key_name is not None: key_pairs = [x for x in key_pairs if x['name'] in key_name] #If looking for non existent key pair diff --git a/nova/common/memorycache.py b/nova/common/memorycache.py index f77b3f51a..86057b6ae 100644 --- a/nova/common/memorycache.py +++ b/nova/common/memorycache.py @@ -70,7 +70,7 @@ class Client(object): def add(self, key, value, time=0, min_compress_len=0): """Sets the value for a key if it doesn't exist.""" - if not self.get(key) is None: + if self.get(key) is not None: return False return self.set(key, value, time, min_compress_len) diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py index 03fc87ac5..526665871 100644 --- a/nova/tests/api/openstack/fakes.py +++ b/nova/tests/api/openstack/fakes.py @@ -399,12 +399,12 @@ def fake_instance_get_all_by_filters(num_servers=5, **kwargs): server = stub_instance(id=i + 1, uuid=uuid, **kwargs) servers_list.append(server) - if not marker is None and uuid == marker: + if marker is not None and uuid == marker: found_marker = True servers_list = [] - if not marker is None and not found_marker: + if marker is not None and not found_marker: raise exc.MarkerNotFound(marker=marker) - if not limit is None: + if limit is not None: servers_list = servers_list[:limit] return servers_list return _return_servers diff --git a/nova/utils.py b/nova/utils.py index 52d4868c9..de9879393 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -628,7 +628,7 @@ class DynamicLoopingCall(LoopingCallBase): if not self._running: break - if not periodic_interval_max is None: + if periodic_interval_max is not None: idle = min(idle, periodic_interval_max) LOG.debug(_('Periodic task processor sleeping for %.02f ' 'seconds'), idle) diff --git a/nova/virt/libvirt/imagecache.py b/nova/virt/libvirt/imagecache.py index 8f677b482..ff7adf10c 100644 --- a/nova/virt/libvirt/imagecache.py +++ b/nova/virt/libvirt/imagecache.py @@ -464,7 +464,7 @@ class ImageCacheManager(object): # _verify_checksum returns True if the checksum is ok, and None if # there is no checksum file checksum_result = self._verify_checksum(img_id, base_file) - if not checksum_result is None: + if checksum_result is not None: image_bad = not checksum_result # Give other threads a chance to run -- cgit