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

This commit is contained in:
Jason Koelker 2011-04-18 15:53:09 -05:00
parent b33c81f05d
commit f59f792c83
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 == 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

@ -437,9 +437,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
@ -1119,9 +1119,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
@ -1161,9 +1161,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()