use 'is not None' instead of '!= None'
This commit is contained in:
parent
b33c81f05d
commit
f59f792c83
@ -196,7 +196,7 @@ class APIRequest(object):
|
|||||||
elif isinstance(data, datetime.datetime):
|
elif isinstance(data, datetime.datetime):
|
||||||
data_el.appendChild(
|
data_el.appendChild(
|
||||||
xml.createTextNode(_database_to_isoformat(data)))
|
xml.createTextNode(_database_to_isoformat(data)))
|
||||||
elif data != None:
|
elif data is not None:
|
||||||
data_el.appendChild(xml.createTextNode(str(data)))
|
data_el.appendChild(xml.createTextNode(str(data)))
|
||||||
|
|
||||||
return data_el
|
return data_el
|
||||||
|
@ -115,7 +115,7 @@ class DbDriver(object):
|
|||||||
# on to create the project. This way we won't have to destroy
|
# on to create the project. This way we won't have to destroy
|
||||||
# the project again because a user turns out to be invalid.
|
# the project again because a user turns out to be invalid.
|
||||||
members = set([manager])
|
members = set([manager])
|
||||||
if member_uids != None:
|
if member_uids is not None:
|
||||||
for member_uid in member_uids:
|
for member_uid in member_uids:
|
||||||
member = db.user_get(context.get_admin_context(), member_uid)
|
member = db.user_get(context.get_admin_context(), member_uid)
|
||||||
if not member:
|
if not member:
|
||||||
|
@ -260,7 +260,7 @@ class Instance(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
data = self.fetch_cpu_stats()
|
data = self.fetch_cpu_stats()
|
||||||
if data != None:
|
if data is not None:
|
||||||
LOG.debug('CPU: %s', data)
|
LOG.debug('CPU: %s', data)
|
||||||
update_rrd(self, 'cpu', data)
|
update_rrd(self, 'cpu', data)
|
||||||
|
|
||||||
|
@ -1835,7 +1835,7 @@ def security_group_get_by_instance(context, instance_id):
|
|||||||
def security_group_exists(context, project_id, group_name):
|
def security_group_exists(context, project_id, group_name):
|
||||||
try:
|
try:
|
||||||
group = security_group_get_by_name(context, project_id, group_name)
|
group = security_group_get_by_name(context, project_id, group_name)
|
||||||
return group != None
|
return group is not None
|
||||||
except exception.NotFound:
|
except exception.NotFound:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ def stub_instance(id, user_id=1, private_address=None, public_addresses=None,
|
|||||||
if public_addresses == None:
|
if public_addresses == None:
|
||||||
public_addresses = list()
|
public_addresses = list()
|
||||||
|
|
||||||
if host != None:
|
if host is not None:
|
||||||
host = str(host)
|
host = str(host)
|
||||||
|
|
||||||
instance = {
|
instance = {
|
||||||
|
@ -157,7 +157,7 @@ def execute(*cmd, **kwargs):
|
|||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env=env)
|
env=env)
|
||||||
result = None
|
result = None
|
||||||
if process_input != None:
|
if process_input is not None:
|
||||||
result = obj.communicate(process_input)
|
result = obj.communicate(process_input)
|
||||||
else:
|
else:
|
||||||
result = obj.communicate()
|
result = obj.communicate()
|
||||||
|
@ -437,9 +437,9 @@ class LibvirtConnection(driver.ComputeDriver):
|
|||||||
if child.prop('dev') == device:
|
if child.prop('dev') == device:
|
||||||
return str(node)
|
return str(node)
|
||||||
finally:
|
finally:
|
||||||
if ctx != None:
|
if ctx is not None:
|
||||||
ctx.xpathFreeContext()
|
ctx.xpathFreeContext()
|
||||||
if doc != None:
|
if doc is not None:
|
||||||
doc.freeDoc()
|
doc.freeDoc()
|
||||||
|
|
||||||
@exception.wrap_exception
|
@exception.wrap_exception
|
||||||
@ -1119,9 +1119,9 @@ class LibvirtConnection(driver.ComputeDriver):
|
|||||||
|
|
||||||
disks.append(devdst)
|
disks.append(devdst)
|
||||||
finally:
|
finally:
|
||||||
if ctx != None:
|
if ctx is not None:
|
||||||
ctx.xpathFreeContext()
|
ctx.xpathFreeContext()
|
||||||
if doc != None:
|
if doc is not None:
|
||||||
doc.freeDoc()
|
doc.freeDoc()
|
||||||
|
|
||||||
return disks
|
return disks
|
||||||
@ -1161,9 +1161,9 @@ class LibvirtConnection(driver.ComputeDriver):
|
|||||||
|
|
||||||
interfaces.append(devdst)
|
interfaces.append(devdst)
|
||||||
finally:
|
finally:
|
||||||
if ctx != None:
|
if ctx is not None:
|
||||||
ctx.xpathFreeContext()
|
ctx.xpathFreeContext()
|
||||||
if doc != None:
|
if doc is not None:
|
||||||
doc.freeDoc()
|
doc.freeDoc()
|
||||||
|
|
||||||
return interfaces
|
return interfaces
|
||||||
|
@ -209,7 +209,7 @@ def _execute(cmd_list, process_input=None, check_exit_code=True):
|
|||||||
obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
|
obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
||||||
result = None
|
result = None
|
||||||
if process_input != None:
|
if process_input is not None:
|
||||||
result = obj.communicate(process_input)
|
result = obj.communicate(process_input)
|
||||||
else:
|
else:
|
||||||
result = obj.communicate()
|
result = obj.communicate()
|
||||||
|
Loading…
Reference in New Issue
Block a user