From ccbc13ee8209c5c5bf3de7b501daa82f6e8f1a46 Mon Sep 17 00:00:00 2001 From: luz paz Date: Wed, 3 Feb 2021 11:25:48 -0500 Subject: [PATCH] Draft: fix LGTM 'Testing for None should use the 'is' operator' alerrts https://lgtm.com/projects/g/FreeCAD/FreeCAD/alerts/?mode=tree&ruleFocus=7900090 --- src/Mod/Draft/draftfunctions/draftify.py | 2 +- src/Mod/Draft/draftgeoutils/geometry.py | 2 +- src/Mod/Draft/draftgeoutils/offsets.py | 2 +- src/Mod/Draft/draftgeoutils/wires.py | 2 +- src/Mod/Draft/draftmake/make_line.py | 2 +- src/Mod/Draft/draftobjects/patharray.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Draft/draftfunctions/draftify.py b/src/Mod/Draft/draftfunctions/draftify.py index cb8355b55d..4d1bda8f6d 100644 --- a/src/Mod/Draft/draftfunctions/draftify.py +++ b/src/Mod/Draft/draftfunctions/draftify.py @@ -70,7 +70,7 @@ def draftify(objectslist, makeblock=False, delete=True): for cluster in Part.sortEdges(obj.Shape.Edges): w = Part.Wire(cluster) nobj = draftify_shape(w) - if nobj == None: + if nobj is None: nobj = App.ActiveDocument.addObject("Part::Feature", obj.Name) nobj.Shape = w newobjlist.append(nobj) diff --git a/src/Mod/Draft/draftgeoutils/geometry.py b/src/Mod/Draft/draftgeoutils/geometry.py index 1695e2bec4..00b5eccd44 100644 --- a/src/Mod/Draft/draftgeoutils/geometry.py +++ b/src/Mod/Draft/draftgeoutils/geometry.py @@ -465,7 +465,7 @@ def calculatePlacement(shape): pos = shape.BoundBox.Center norm = get_normal(shape) # for backward compatibility with previous getNormal implementation - if norm == None: + if norm is None: norm = App.Vector(0, 0, 1) pla = App.Placement() pla.Base = pos diff --git a/src/Mod/Draft/draftgeoutils/offsets.py b/src/Mod/Draft/draftgeoutils/offsets.py index a7ba52ff1c..23fe36c998 100644 --- a/src/Mod/Draft/draftgeoutils/offsets.py +++ b/src/Mod/Draft/draftgeoutils/offsets.py @@ -233,7 +233,7 @@ def offsetWire(wire, dvec, bind=False, occ=False, else: norm = get_normal(wire) # norm = Vector(0, 0, 1) # for backward compatibility with previous getNormal implementation - if norm == None: + if norm is None: norm = App.Vector(0, 0, 1) closed = isReallyClosed(wire) diff --git a/src/Mod/Draft/draftgeoutils/wires.py b/src/Mod/Draft/draftgeoutils/wires.py index 8c6f9dfed9..9ee4a5a1ee 100644 --- a/src/Mod/Draft/draftgeoutils/wires.py +++ b/src/Mod/Draft/draftgeoutils/wires.py @@ -160,7 +160,7 @@ def flattenWire(wire): """Force a wire to get completely flat along its normal.""" n = get_normal(wire) # for backward compatibility with previous getNormal implementation - if n == None: + if n is None: n = App.Vector(0, 0, 1) o = wire.Vertexes[0].Point diff --git a/src/Mod/Draft/draftmake/make_line.py b/src/Mod/Draft/draftmake/make_line.py index e8c1068642..eec782f38b 100644 --- a/src/Mod/Draft/draftmake/make_line.py +++ b/src/Mod/Draft/draftmake/make_line.py @@ -39,7 +39,7 @@ def make_line(first_param, last_param=None): Parameters ---------- first_param : - Base.Vector -> First point of the line (if p2 == None) + Base.Vector -> First point of the line (if p2 is None) Part.LineSegment -> Line is created from the given Linesegment Shape -> Line is created from the give Shape diff --git a/src/Mod/Draft/draftobjects/patharray.py b/src/Mod/Draft/draftobjects/patharray.py index 59b1e0a438..fe7c0355a5 100644 --- a/src/Mod/Draft/draftobjects/patharray.py +++ b/src/Mod/Draft/draftobjects/patharray.py @@ -446,7 +446,7 @@ def placements_on_path(shapeRotation, pathwire, count, xlate, align, closedpath = DraftGeomUtils.isReallyClosed(pathwire) normal = DraftGeomUtils.get_normal(pathwire) # for backward compatibility with previous getNormal implementation - if normal == None: + if normal is None: normal = App.Vector(0, 0, 1) if forceNormal and normalOverride: