use is rather then == when comparing against None.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 18 Sep 2010 10:43:32 +0000 (10:43 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 18 Sep 2010 10:43:32 +0000 (10:43 +0000)
22 files changed:
release/getversion.py
release/scripts/io/netrender/master.py
release/scripts/io/netrender/slave.py
release/scripts/io/netrender/utils.py
release/scripts/modules/rigify/eye_balls.py
release/scripts/modules/rigify/mouth.py
release/scripts/modules/rigify/shape_key_control.py
release/scripts/modules/rigify/shape_key_distance.py
release/scripts/modules/rigify/shape_key_rotdiff.py
release/scripts/modules/rigify/tail_control.py
release/scripts/modules/rna_info.py
release/scripts/modules/rna_prop_ui.py
release/scripts/op/fcurve_euler_filter.py
release/scripts/op/io_anim_bvh/import_bvh.py
release/scripts/op/io_mesh_ply/export_ply.py
release/scripts/op/io_scene_3ds/export_3ds.py
release/scripts/op/io_scene_fbx/export_fbx.py
release/scripts/op/io_scene_obj/export_obj.py
release/scripts/op/io_scene_obj/import_obj.py
release/scripts/op/io_scene_x3d/export_x3d.py
release/scripts/op/sequencer.py
release/scripts/ui/properties_texture.py

index 29622b2154dbfc57c72aa150badfd39af73f35c1..4c477229ef91719c5b7d032345d77e0e199596c4 100755 (executable)
@@ -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"
index 749046fc9e1310950a9263c5cabbbf33dacfc2d0..11409bf372e4a7cea2623572a0f452b05546a120 100644 (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
index 1b6caa17b13880cdee10c6494be3f483ffdc429d..f017fefa4e3070123021051b649ac63b7ca659d1 100644 (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:
index 81617ac0d3020e3acf3b3ea515ebcc4ae9ad9af5..e2a5051cf642cc4440950c2c940dc9d145d4cf67 100644 (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
index f65d56b9f2b232acc77ae6926eadbbeea4177b9d..127ee87123f5700966c632b00762aca689910910 100644 (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
index ce232b91e7b04dde050f6aeb00f95a71608a9179..ef3875222d3a38d0113ddabfe2df82c921545f7a 100644 (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
index 1bfca60255d8db7015fd73ea61a120d8c8ec47c7..a5f57313ab50eff5c5d47ab3d47b7cbbdc04a5cc 100644 (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
index 7d69517216f6a30410e4207a864fdca86568358f..3045fcdab0dc89504330811c88bb35df6b50c726 100644 (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'
 
index dfc3b914a6ad2ad6c537ab4898d31a3248c0f217..a6ba5adfe6bdf6a733d942206abd3ebada61571f 100644 (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'
 
index 50a9bb236dac70c93c0a9094a45f0e0ab077b100..32d414344cf6322ee6b6f15498c0c5657af23da4 100644 (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]
index b2b8558b988d12f9fc6bb38aafcf934ee60bd15b..f78be1cf95817ac3533df9e59d5e74159a1c677b 100644 (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
index 0afe79e48292bea216a000552ffa8b5566df0da5..cbe0b668e7731b6b2daf15b80a4146e8c64a1749 100644 (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:
index a2730e1684360da7992356ad1517f9077dd9a34a..b396fa0562faf1103e898974678de280e34e1275 100644 (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
index 5f9de6cbd90343a4d1ec2c2f2b1deec036ced2d0..0d17b60ba0d67042528890017ed3050421a8a864 100644 (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
index aef4df43841f0763ebe10ec68e995d2dbb822b8f..08369a46c84583a46555a9f9ff6a4f0ed60b4de4 100644 (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
index 3d1cc02a8d812c3bf4306576cee6a87ee040749a..0cbb4347ddafca57fb017d07e514266c8db47341 100644 (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):
index 51a5f86a5e4e1a4df29cce5b728b88eddf59de21..09b4ab7996e11400ef6082e4cd7f8b63dd6a1e05 100644 (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
index 01f5b221546c2bd1d3e84ee1ce1fdad992902333..c6def77dee16f99398dba68a7d23ee07db17c8b9 100644 (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
index 61b6b4cb3c6fcac1698966254373b3a3d92be385..f6c5e625fb0900b4ddd6f375ca2ecc484db411fe 100644 (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':
index d4188b7935177a9958a489b116d34ecaf18d8780..3159d0c9acdc56eca3ec0e4f6d1c2222ca3a1061 100644 (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):
index 7d453745276427d348c5dc740e701b2c5a38e0d8..e34489b335d66171ac90b7a5e01f4c32d508268a 100644 (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:
index dfb9e7b87f4bcf927f9ba1d82a5f61ff17185fd0..bf0c5d56e4cf225f48157db5f3c292aa59ab786c 100644 (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()