Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-12-19 03:35:45 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-12-19 03:35:45 +0300
commit9cc2ad1eaf941d8ed3b5542a3d5cdfccec7ba60b (patch)
tree43ea30ad9109c60886e523a3d7d38b6c9e2b2c23
parentfb75f259861bf3dcd82abfab8b10b83da947053e (diff)
Fix invalid string comparisons
Identity checks should never be used with strings, it may fail based on Python's interning logic.
-rw-r--r--ant_landscape/__init__.py4
-rw-r--r--ant_landscape/ant_functions.py4
-rw-r--r--archipack/archipack_fence.py2
-rw-r--r--archipack/archipack_stair.py2
-rw-r--r--development_iskeyfree.py10
-rw-r--r--io_import_images_as_planes.py2
-rw-r--r--io_scene_fbx/import_fbx.py2
-rw-r--r--measureit/measureit_geometry.py6
-rw-r--r--mesh_bsurfaces.py2
-rw-r--r--mesh_extra_tools/mesh_extrude_and_reshape.py2
-rw-r--r--node_wrangler.py7
-rw-r--r--space_view3d_pie_menus/pie_save_open_menu.py2
12 files changed, 24 insertions, 21 deletions
diff --git a/ant_landscape/__init__.py b/ant_landscape/__init__.py
index 68dd2342..8fbfb79d 100644
--- a/ant_landscape/__init__.py
+++ b/ant_landscape/__init__.py
@@ -391,7 +391,7 @@ class AntDisplaceSettingsPanel(bpy.types.Panel):
if not ant.sphere_mesh:
col = box.column()
col.prop(ant, "edge_falloff")
- if ant.edge_falloff is not "0":
+ if ant.edge_falloff != "0":
col = box.column(align=True)
col.prop(ant, "edge_level")
if ant.edge_falloff in ["2", "3"]:
@@ -401,7 +401,7 @@ class AntDisplaceSettingsPanel(bpy.types.Panel):
col = box.column()
col.prop(ant, "strata_type")
- if ant.strata_type is not "0":
+ if ant.strata_type != "0":
col = box.column()
col.prop(ant, "strata")
col = box.column()
diff --git a/ant_landscape/ant_functions.py b/ant_landscape/ant_functions.py
index 3c0f2c34..bee655c0 100644
--- a/ant_landscape/ant_functions.py
+++ b/ant_landscape/ant_functions.py
@@ -662,7 +662,7 @@ def draw_ant_displace(self, context, generate=True):
if not self.sphere_mesh:
col = box.column()
col.prop(self, "edge_falloff")
- if self.edge_falloff is not "0":
+ if self.edge_falloff != "0":
col = box.column(align=True)
col.prop(self, "edge_level")
if self.edge_falloff in ["2", "3"]:
@@ -672,7 +672,7 @@ def draw_ant_displace(self, context, generate=True):
col = box.column()
col.prop(self, "strata_type")
- if self.strata_type is not "0":
+ if self.strata_type != "0":
col = box.column()
col.prop(self, "strata")
diff --git a/archipack/archipack_fence.py b/archipack/archipack_fence.py
index a94023fd..c2989be2 100644
--- a/archipack/archipack_fence.py
+++ b/archipack/archipack_fence.py
@@ -1489,7 +1489,7 @@ class ARCHIPACK_PT_fence(Panel):
row = box.row(align=True)
row.operator("archipack.fence_curve_update", text="", icon='FILE_REFRESH')
row.prop_search(prop, "user_defined_path", scene, "objects", text="", icon='OUTLINER_OB_CURVE')
- if prop.user_defined_path is not "":
+ if prop.user_defined_path != "":
box.prop(prop, 'user_defined_spline')
box.prop(prop, 'user_defined_resolution')
box.prop(prop, 'angle_limit')
diff --git a/archipack/archipack_stair.py b/archipack/archipack_stair.py
index 94a8da7c..6e3d6212 100644
--- a/archipack/archipack_stair.py
+++ b/archipack/archipack_stair.py
@@ -2518,7 +2518,7 @@ class archipack_stair(ArchipackObject, Manipulable, PropertyGroup):
self.setup_manipulators()
- if self.presets is not 'STAIR_O':
+ if self.presets != 'STAIR_O':
for i, part in enumerate(self.parts):
if i >= self.n_parts:
break
diff --git a/development_iskeyfree.py b/development_iskeyfree.py
index 7851afee..332e11d4 100644
--- a/development_iskeyfree.py
+++ b/development_iskeyfree.py
@@ -105,18 +105,18 @@ class MyChecker():
cls.mylist.clear()
for e in sortkeys:
cmd = ""
- if e[2] is not "":
+ if e[2] != "":
cmd += e[2] + "+"
- if e[3] is not "":
+ if e[3] != "":
cmd += e[3] + "+"
- if e[4] is not "":
+ if e[4] != "":
cmd += e[4] + "+"
- if e[5] is not "":
+ if e[5] != "":
cmd += e[5] + "+"
cmd += e[1]
- if e[6] is not "":
+ if e[6] != "":
cmd += " " + e[6]
cls.mylist.append([e[0], cmd])
diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py
index 1f32bc5f..a4aa98f2 100644
--- a/io_import_images_as_planes.py
+++ b/io_import_images_as_planes.py
@@ -1094,7 +1094,7 @@ class IMPORT_IMAGE_OT_to_plane(Operator, AddObjectHelper):
bpy.ops.mesh.primitive_plane_add('INVOKE_REGION_WIN')
plane = context.scene.objects.active
# Why does mesh.primitive_plane_add leave the object in edit mode???
- if plane.mode is not 'OBJECT':
+ if plane.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
plane.dimensions = width, height, 0.0
plane.data.name = plane.name = name
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 90dc08df..addb8ae6 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1126,7 +1126,7 @@ def blen_read_geom_layer_normal(fbx_obj, mesh, xform=None):
bdata = [None] * len(blen_data) if is_fake else blen_data
if func(mesh, bdata, "normal",
fbx_layer_data, fbx_layer_index, fbx_layer_mapping, fbx_layer_ref, 3, 3, layer_id, xform, True):
- if blen_data_type is "Polygons":
+ if blen_data_type == "Polygons":
for pidx, p in enumerate(mesh.polygons):
for lidx in range(p.loop_start, p.loop_start + p.loop_total):
mesh.loops[lidx].normal[:] = bdata[pidx]
diff --git a/measureit/measureit_geometry.py b/measureit/measureit_geometry.py
index 3b2e0186..e0b036d6 100644
--- a/measureit/measureit_geometry.py
+++ b/measureit/measureit_geometry.py
@@ -831,9 +831,9 @@ def draw_text(myobj, pos2d, display_text, rgb, fsize, align='L', text_rot=0.0):
# -------------------
for line in mylines:
text_width, text_height = blf.dimensions(font_id, line)
- if align is 'C':
+ if align == 'C':
newx = x_pos - text_width / 2
- elif align is 'R':
+ elif align == 'R':
newx = x_pos - text_width - gap
else:
newx = x_pos
@@ -851,7 +851,7 @@ def draw_text(myobj, pos2d, display_text, rgb, fsize, align='L', text_rot=0.0):
if maxwidth < text_width:
maxwidth = text_width
- if align is 'L':
+ if align == 'L':
blf.disable(font_id, ROTATION)
return maxwidth, maxheight
diff --git a/mesh_bsurfaces.py b/mesh_bsurfaces.py
index ffe16e04..53b88d49 100644
--- a/mesh_bsurfaces.py
+++ b/mesh_bsurfaces.py
@@ -2928,7 +2928,7 @@ class GPENCIL_OT_SURFSK_add_surface(Operator):
for i in range(0, len(surface_splines_parsed[0])):
surface_splines_parsed[0][i] = self.main_object.matrix_world * verts_ordered_V2[i].co
- # When "Automatic join" option is active (and the selection type is not "TWO_CONNECTED"),
+ # When "Automatic join" option is active (and the selection type != "TWO_CONNECTED"),
# merge the verts of the tips of the loops when they are "near enough"
if self.automatic_join and selection_type != "TWO_CONNECTED":
# Join the tips of "Follow" loops that are near enough and must be "closed"
diff --git a/mesh_extra_tools/mesh_extrude_and_reshape.py b/mesh_extra_tools/mesh_extrude_and_reshape.py
index 8716bfb1..f4eef683 100644
--- a/mesh_extra_tools/mesh_extrude_and_reshape.py
+++ b/mesh_extra_tools/mesh_extrude_and_reshape.py
@@ -245,7 +245,7 @@ class Extrude_and_Reshape(Operator):
@classmethod
def poll(cls, context):
- return context.mode is not 'EDIT_MESH'
+ return context.mode != 'EDIT_MESH'
def modal(self, context, event):
if self.confirm:
diff --git a/node_wrangler.py b/node_wrangler.py
index 6ccf2ecd..b535a580 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -2358,7 +2358,10 @@ class NWCopySettings(Operator, NWBase):
def poll(cls, context):
valid = False
if nw_check(context):
- if context.active_node is not None and context.active_node.type is not 'FRAME':
+ if (
+ context.active_node is not None and
+ context.active_node.type != 'FRAME'
+ ):
valid = True
return valid
@@ -2941,7 +2944,7 @@ class NWAddReroutes(Operator, NWBase):
reroutes_count = 0 # will be used when aligning reroutes added to hidden nodes
for out_i, output in enumerate(node.outputs):
pass_used = False # initial value to be analyzed if 'R_LAYERS'
- # if node is not 'R_LAYERS' - "pass_used" not needed, so set it to True
+ # if node != 'R_LAYERS' - "pass_used" not needed, so set it to True
if node.type != 'R_LAYERS':
pass_used = True
else: # if 'R_LAYERS' check if output represent used render pass
diff --git a/space_view3d_pie_menus/pie_save_open_menu.py b/space_view3d_pie_menus/pie_save_open_menu.py
index bdd9b63c..3d48e591 100644
--- a/space_view3d_pie_menus/pie_save_open_menu.py
+++ b/space_view3d_pie_menus/pie_save_open_menu.py
@@ -130,7 +130,7 @@ class FileIncrementalSave(Operator):
@classmethod
def poll(cls, context):
- return (bpy.data.filepath is not "")
+ return (bpy.data.filepath != "")
def execute(self, context):
f_path = bpy.data.filepath