use 'is not None' instead of '!= None'

This commit is contained in:
Jason Koelker 2011-04-18 23:40:03 +00:00 committed by Tarmac
commit d526ce5b0b
8 changed files with 13 additions and 13 deletions

View File

@ -196,7 +196,7 @@ class APIRequest(object):
elif isinstance(data, datetime.datetime):
data_el.appendChild(
xml.createTextNode(_database_to_isoformat(data)))
elif data != None:
elif data is not None:
data_el.appendChild(xml.createTextNode(str(data)))
return data_el

View File

@ -115,7 +115,7 @@ class DbDriver(object):
# on to create the project. This way we won't have to destroy
# the project again because a user turns out to be invalid.
members = set([manager])
if member_uids != None:
if member_uids is not None:
for member_uid in member_uids:
member = db.user_get(context.get_admin_context(), member_uid)
if not member:

View File

@ -260,7 +260,7 @@ class Instance(object):
try:
data = self.fetch_cpu_stats()
if data != None:
if data is not None:
LOG.debug('CPU: %s', data)
update_rrd(self, 'cpu', data)

View File

@ -1835,7 +1835,7 @@ def security_group_get_by_instance(context, instance_id):
def security_group_exists(context, project_id, group_name):
try:
group = security_group_get_by_name(context, project_id, group_name)
return group != None
return group is not None
except exception.NotFound:
return False

View File

@ -82,7 +82,7 @@ def stub_instance(id, user_id=1, private_address=None, public_addresses=None,
if public_addresses is None:
public_addresses = list()
if host != None:
if host is not None:
host = str(host)
instance = {

View File

@ -157,7 +157,7 @@ def execute(*cmd, **kwargs):
stderr=subprocess.PIPE,
env=env)
result = None
if process_input != None:
if process_input is not None:
result = obj.communicate(process_input)
else:
result = obj.communicate()

View File

@ -438,9 +438,9 @@ class LibvirtConnection(driver.ComputeDriver):
if child.prop('dev') == device:
return str(node)
finally:
if ctx != None:
if ctx is not None:
ctx.xpathFreeContext()
if doc != None:
if doc is not None:
doc.freeDoc()
@exception.wrap_exception
@ -1125,9 +1125,9 @@ class LibvirtConnection(driver.ComputeDriver):
disks.append(devdst)
finally:
if ctx != None:
if ctx is not None:
ctx.xpathFreeContext()
if doc != None:
if doc is not None:
doc.freeDoc()
return disks
@ -1167,9 +1167,9 @@ class LibvirtConnection(driver.ComputeDriver):
interfaces.append(devdst)
finally:
if ctx != None:
if ctx is not None:
ctx.xpathFreeContext()
if doc != None:
if doc is not None:
doc.freeDoc()
return interfaces

View File

@ -209,7 +209,7 @@ def _execute(cmd_list, process_input=None, check_exit_code=True):
obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
result = None
if process_input != None:
if process_input is not None:
result = obj.communicate(process_input)
else:
result = obj.communicate()