use is rather then == when comparing against None.

This commit is contained in:
Campbell Barton
2010-09-18 10:43:32 +00:00
parent 6963574a55
commit 868fdd80a2
22 changed files with 41 additions and 42 deletions

View File

@@ -33,7 +33,7 @@ import re
nanblenderhome = os.getenv("NANBLENDERHOME")
if nanblenderhome == None:
if nanblenderhome is None:
nanblenderhome = os.path.dirname(os.path.abspath(sys.argv[0])) + "/.."
config = nanblenderhome + "/source/blender/blenkernel/BKE_blender.h"

View File

@@ -124,7 +124,7 @@ class MRenderJob(netrender.model.RenderJob):
if self.status not in {JOB_PAUSED, JOB_QUEUED}:
return
if status == None:
if status is None:
self.status = JOB_PAUSED if self.status == JOB_QUEUED else JOB_QUEUED
elif status:
self.status = JOB_QUEUED

View File

@@ -188,7 +188,7 @@ def render_slave(engine, netsettings, threads):
cancelled = False
stdout = bytes()
run_t = time.time()
while not cancelled and process.poll() == None:
while not cancelled and process.poll() is None:
stdout += process.stdout.read(1024)
current_t = time.time()
cancelled = engine.test_break()
@@ -219,7 +219,7 @@ def render_slave(engine, netsettings, threads):
if cancelled:
# kill process if needed
if process.poll() == None:
if process.poll() is None:
try:
process.terminate()
except OSError:

View File

@@ -192,7 +192,7 @@ def prefixPath(prefix_directory, file_path, prefix_path, force = False):
def getFileInfo(filepath, infos):
process = subprocess.Popen([sys.argv[0], "-b", "-noaudio", filepath, "-P", __file__, "--"] + infos, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout = bytes()
while process.poll() == None:
while process.poll() is None:
stdout += process.stdout.read(1024)
# read leftovers if needed

View File

@@ -56,7 +56,7 @@ def addget_shape_key_driver(obj, name="Key"):
for driver_s in obj.data.shape_keys.animation_data.drivers:
if driver_s.data_path == driver_path:
fcurve = driver_s
if fcurve == None:
if fcurve is None:
fcurve = obj.data.shape_keys.keys[name].driver_add("value")
fcurve.driver.type = 'AVERAGE'
new = True

View File

@@ -76,7 +76,7 @@ def addget_shape_key_driver(obj, name="Key"):
for driver_s in obj.data.shape_keys.animation_data.drivers:
if driver_s.data_path == driver_path:
fcurve = driver_s
if fcurve == None:
if fcurve is None:
fcurve = obj.data.shape_keys.keys[name].driver_add("value")
fcurve.driver.type = 'AVERAGE'
new = True

View File

@@ -56,7 +56,7 @@ def addget_shape_key_driver(obj, name="Key"):
for driver_s in obj.data.shape_keys.animation_data.drivers:
if driver_s.data_path == driver_path:
fcurve = driver_s
if fcurve == None:
if fcurve is None:
fcurve = obj.data.shape_keys.keys[name].driver_add("value")
fcurve.driver.type = 'AVERAGE'
new = True

View File

@@ -53,7 +53,7 @@ def addget_shape_key_driver(obj, name="Key"):
for driver_s in obj.data.shape_keys.animation_data.drivers:
if driver_s.data_path == driver_path:
fcurve = driver_s
if fcurve == None:
if fcurve is None:
fcurve = obj.data.shape_keys.keys[name].driver_add("value")
fcurve.driver.type = 'AVERAGE'

View File

@@ -53,7 +53,7 @@ def addget_shape_key_driver(obj, name="Key"):
for driver_s in obj.data.shape_keys.animation_data.drivers:
if driver_s.data_path == driver_path:
fcurve = driver_s
if fcurve == None:
if fcurve is None:
fcurve = obj.data.shape_keys.keys[name].driver_add("value")
fcurve.driver.type = 'AVERAGE'

View File

@@ -58,7 +58,7 @@ def metarig_definition(obj, orig_bone_name):
arm = obj.data
tail_base = arm.bones[orig_bone_name]
if tail_base.parent == None:
if tail_base.parent is None:
raise RigifyError("'tail_control' rig type on bone '%s' requires a parent." % orig_bone_name)
bone_definitions = [tail_base.name]

View File

@@ -381,7 +381,7 @@ class InfoOperatorRNA:
def _GetInfoRNA(bl_rna, cls, parent_id=''):
if bl_rna == None:
if bl_rna is None:
return None
key = parent_id, bl_rna.identifier

View File

@@ -36,7 +36,7 @@ def rna_idprop_ui_prop_get(item, prop, create=True):
rna_ui = rna_idprop_ui_get(item, create)
if rna_ui == None:
if rna_ui is None:
return None
try:
@@ -49,7 +49,7 @@ def rna_idprop_ui_prop_get(item, prop, create=True):
def rna_idprop_ui_prop_clear(item, prop):
rna_ui = rna_idprop_ui_get(item, False)
if rna_ui == None:
if rna_ui is None:
return
try:

View File

@@ -15,7 +15,7 @@ def main(context):
prev = keys[i-1] if i > 0 else None
next = keys[i+1] if i < len(keys)-1 else None
if prev == None:
if prev is None:
continue
th = pi

View File

@@ -177,7 +177,7 @@ def read_bvh(context, file_path, ROT_MODE='XYZ', GLOBAL_SCALE=1.0):
# Apply the parents offset accumletivly
if my_parent == None:
if my_parent is None:
rest_head_world = Vector(rest_head_local)
else:
rest_head_world = my_parent.rest_head_world + rest_head_local

View File

@@ -142,7 +142,7 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u
vdict_local = vdict[vidx]
pf_vidx = vdict_local.get(key) # Will be None initially
if pf_vidx == None: # same as vdict_local.has_key(key)
if pf_vidx is None: # same as vdict_local.has_key(key)
pf_vidx = vdict_local[key] = vert_count
ply_verts.append((vidx, normal, uvcoord, color))
vert_count += 1

View File

@@ -303,17 +303,17 @@ class _3ds_named_variable(object):
self.value=val
def get_size(self):
if (self.value==None):
if self.value is None:
return 0
else:
return self.value.get_size()
def write(self, file):
if (self.value!=None):
if self.value is not None:
self.value.write(file)
def dump(self,indent):
if (self.value!=None):
if self.value is not None:
spaces=""
for i in range(indent):
spaces += " "
@@ -827,7 +827,7 @@ def make_kf_obj_node(obj, name_to_id):
# Check parent-child relationships:
parent = obj.parent
if (parent == None) or (parent.name not in name_to_id):
if (parent is None) or (parent.name not in name_to_id):
# If no parent, or the parents name is not in the name_to_id dictionary,
# parent id becomes -1:
obj_node_header_chunk.add_variable("parent", _3ds_short(-1))
@@ -906,7 +906,8 @@ def save(operator, context, filepath=""):
# get derived objects
free, derived = create_derived_objects(scene, ob)
if derived == None: continue
if derived is None:
continue
for ob_derived, mat in derived:
# for ob_derived, mat in getDerivedObjects(ob, False):

View File

@@ -270,8 +270,6 @@ def save(operator, context, filepath="", \
# ----------------- Batch support!
if BATCH_ENABLE:
if os == None: BATCH_OWN_DIR = False
fbxpath = filepath
# get the path component of filepath
@@ -1262,7 +1260,7 @@ def save(operator, context, filepath="", \
def write_texture(texname, tex, num):
# if tex == None then this is a dummy tex
# if tex is None then this is a dummy tex
file.write('\n\tTexture: "Texture::%s", "TextureVideoClip" {' % texname)
file.write('\n\t\tType: "TextureVideoClip"')
file.write('\n\t\tVersion: 202')
@@ -2115,7 +2113,7 @@ def save(operator, context, filepath="", \
my_mesh.blenTextures = list(texture_mapping_local.keys())
# if only 1 null texture then empty the list
if len(my_mesh.blenTextures) == 1 and my_mesh.blenTextures[0] == None:
if len(my_mesh.blenTextures) == 1 and my_mesh.blenTextures[0] is None:
my_mesh.blenTextures = []
my_mesh.fbxArm = armob # replace with my_object_generic armature instance later
@@ -2229,7 +2227,7 @@ def save(operator, context, filepath="", \
for ob in blenGroup.objects:
if ob.name in tagged_objects:
# if ob.tag:
if fbxGroupName == None:
if fbxGroupName is None:
fbxGroupName = sane_groupname(blenGroup)
groups.append((fbxGroupName, blenGroup))
@@ -2707,7 +2705,7 @@ Takes: {''')
print('\taction: "%s" has no armature using it, skipping' % blenAction.name)
continue
if blenAction == None:
if blenAction is None:
# Warning, this only accounts for tmp_actions being [None]
file.write('\n\tTake: "Default Take" {')
act_start = start

View File

@@ -26,7 +26,7 @@ import bpy
import mathutils
def fixName(name):
if name == None:
if name is None:
return 'None'
else:
return name.replace(' ', '_')
@@ -458,7 +458,7 @@ def write_file(filepath, objects, scene,
materialItems = [m for m in materials]
if materials:
for mat in materials:
if mat: # !=None
if mat:
materialNames.append(mat.name)
else:
materialNames.append(None)
@@ -621,7 +621,7 @@ def write_file(filepath, objects, scene,
if key == contextMat:
pass # Context already switched, dont do anything
else:
if key[0] == None and key[1] == None:
if key[0] is None and key[1] is None:
# Write a null material, since we know the context has changed.
if EXPORT_GROUP_BY_MAT:
# can be mat_image or (null)
@@ -638,7 +638,7 @@ def write_file(filepath, objects, scene,
# converting any spaces to underscores with fixName.
# If none image dont bother adding it to the name
if key[1] == None:
if key[1] is None:
mat_data = mtl_dict[key] = ('%s'%fixName(key[0])), materialItems[f_mat], f_image
else:
mat_data = mtl_dict[key] = ('%s_%s' % (fixName(key[0]), fixName(key[1]))), materialItems[f_mat], f_image

View File

@@ -724,7 +724,7 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
# if CREATE_FGONS and fgon_edges:
# FGON= Mesh.EdgeFlags.FGON
# for ed in me.findEdges( fgon_edges.keys() ):
# if ed!=None:
# if ed is not None:
# me_edges[ed].flag |= FGON
# del FGON
@@ -738,7 +738,7 @@ def create_mesh(new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_loc, v
# if unique_smooth_groups and sharp_edges:
# SHARP= Mesh.EdgeFlags.SHARP
# for ed in me.findEdges( sharp_edges.keys() ):
# if ed!=None:
# if ed is not None:
# me_edges[ed].flag |= SHARP
# del SHARP
@@ -768,7 +768,7 @@ def create_nurbs(context_nurbs, vert_loc, new_objects):
name = context_nurbs.get('name', 'ObjNurb')
cstype = context_nurbs.get('cstype')
if cstype == None:
if cstype is None:
print('\tWarning, cstype not found')
return
if cstype != 'bspline':

View File

@@ -92,7 +92,7 @@ class x3d_class:
print("failed to import compression modules, exporting uncompressed")
self.filepath = filepath[:-1] # remove trailing z
if self.file == None:
if self.file is None:
self.file = open(self.filepath, "w")
self.bNav=0
@@ -739,7 +739,7 @@ class x3d_class:
for i in range(alltexture):
tex = alltextures[i]
if tex.type != 'IMAGE' or tex.image == None:
if tex.type != 'IMAGE' or tex.image is None:
continue
namemat = tex.name
@@ -811,7 +811,7 @@ class x3d_class:
free, derived = create_derived_objects(scene, ob_main)
if derived == None: continue
if derived is None: continue
for ob, ob_mat in derived:
# for ob, ob_mat in BPyObject.getDerivedObjects(ob_main):

View File

@@ -42,14 +42,14 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
seq2 = None
for s in context.scene.sequence_editor.sequences:
if s.select and s.type == 'SOUND':
if seq1 == None:
if seq1 is None:
seq1 = s
elif seq2 == None:
elif seq2 is None:
seq2 = s
else:
seq2 = None
break
if seq2 == None:
if seq2 is None:
self.report({'ERROR'}, "Select 2 sound strips.")
return {'CANCELLED'}
if seq1.frame_final_start > seq2.frame_final_start:

View File

@@ -94,7 +94,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
space = context.space_data
tex = context.texture
idblock = context_tex_datablock(context)
tex_collection = space.pin_id == None and type(idblock) != bpy.types.Brush and not node
tex_collection = space.pin_id is None and type(idblock) != bpy.types.Brush and not node
if tex_collection:
row = layout.row()