From 5c1cae14b947f2b68bf3ee457cc430eda87dad12 Mon Sep 17 00:00:00 2001 From: "luz.paz" Date: Tue, 22 Oct 2019 10:29:54 -0400 Subject: [PATCH] Arch: use string operator instead of numeric LGTM fix --- src/Mod/Arch/ArchAxis.py | 2 +- src/Mod/Arch/ArchCommands.py | 2 +- src/Mod/Arch/ArchPanel.py | 2 +- src/Mod/Arch/ArchStairs.py | 2 +- src/Mod/Arch/ArchStructure.py | 4 ++-- src/Mod/Arch/ArchVRM.py | 4 ++-- src/Mod/Arch/ArchWall.py | 2 +- src/Mod/Arch/ArchWindow.py | 2 +- src/Mod/Arch/OfflineRenderingUtils.py | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Mod/Arch/ArchAxis.py b/src/Mod/Arch/ArchAxis.py index 83d9eb210d98..d48b5f1b9ede 100644 --- a/src/Mod/Arch/ArchAxis.py +++ b/src/Mod/Arch/ArchAxis.py @@ -756,7 +756,7 @@ def resetObject(self,remove=None): l = [] for i in range(self.tree.topLevelItemCount()): it = self.tree.findItems(str(i+1),QtCore.Qt.MatchExactly,0)[0] - if (remove == None) or (remove != i): + if (remove is None) or (remove != i): if it.text(1): d.append(float(it.text(1))) else: diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index e3ff6900e28e..6921bf034d6d 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -1665,7 +1665,7 @@ def Activated(self): if hasattr(obj, "Subtractions"): for sub in obj.Subtractions: if not (Draft.getType(sub) in ["Window","Roof"]): - if mode == None: + if mode is None: # take the first sub as base mode = sub.ViewObject.isVisible() if mode == True: diff --git a/src/Mod/Arch/ArchPanel.py b/src/Mod/Arch/ArchPanel.py index 69ad150f24a4..f40ed09203f1 100644 --- a/src/Mod/Arch/ArchPanel.py +++ b/src/Mod/Arch/ArchPanel.py @@ -196,7 +196,7 @@ def getPoint(self,point=None,obj=None): "this function is called by the snapper when it has a 3D point" self.tracker.finalize() - if point == None: + if point is None: return FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Panel")) FreeCADGui.addModule("Arch") diff --git a/src/Mod/Arch/ArchStairs.py b/src/Mod/Arch/ArchStairs.py index 46bbcefe2749..2c042dd0a45f 100644 --- a/src/Mod/Arch/ArchStairs.py +++ b/src/Mod/Arch/ArchStairs.py @@ -186,7 +186,7 @@ def makeRailingLorR(stairs,side="L"): railList.append(lrRail) stair.Additions = railList - if stairs == None: + if stairs is None: sel = FreeCADGui.Selection.getSelection() sel0 = sel[0] stairs = [] diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index d7100dddadbe..db0166b71640 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -271,10 +271,10 @@ def getPoint(self,point=None,obj=None): "this function is called by the snapper when it has a 3D point" self.bmode = self.modeb.isChecked() - if point == None: + if point is None: self.tracker.finalize() return - if self.bmode and (self.bpoint == None): + if self.bmode and (self.bpoint is None): self.bpoint = point FreeCADGui.Snapper.getPoint(last=point,callback=self.getPoint,movecallback=self.update,extradlg=[self.taskbox(),self.precast.form,self.dents.form],title=translate("Arch","Next point")+":",mode="line") return diff --git a/src/Mod/Arch/ArchVRM.py b/src/Mod/Arch/ArchVRM.py index 01c2b210fe8e..2edb12cc41f0 100644 --- a/src/Mod/Arch/ArchVRM.py +++ b/src/Mod/Arch/ArchVRM.py @@ -461,7 +461,7 @@ def findPosition(self,f1,faces): if r == 1: l = faces.index(f2) elif r == 2: - if h == None: + if h is None: h = faces.index(f2) else: if faces.index(f2) < h: @@ -497,7 +497,7 @@ def sort(self): if sfaces and (notfoundstack < len(faces)): if DEBUG: print("using ordered stack, notfound = ",notfoundstack) p = self.findPosition(f1,sfaces) - if p == None: + if p is None: # no position found, we move the face to the end of the pile faces.remove(f1) faces.append(f1) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index d21071078d42..04513aefac35 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -249,7 +249,7 @@ def getPoint(self,point=None,obj=None): if Draft.getType(obj) == "Wall": if not obj in self.existing: self.existing.append(obj) - if point == None: + if point is None: self.tracker.finalize() return self.points.append(point) diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index 81c2f8cfd8c6..eefa8b530dd3 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -670,7 +670,7 @@ def getPoint(self,point=None,obj=None): "this function is called by the snapper when it has a 3D point" self.tracker.finalize() - if point == None: + if point is None: return # if something was selected, override the underlying object if self.sel: diff --git a/src/Mod/Arch/OfflineRenderingUtils.py b/src/Mod/Arch/OfflineRenderingUtils.py index 106c27eb4338..834b12773c4a 100755 --- a/src/Mod/Arch/OfflineRenderingUtils.py +++ b/src/Mod/Arch/OfflineRenderingUtils.py @@ -433,7 +433,7 @@ def viewer(scene=None,background=(1.0,1.0,1.0),lightdir=None): # Initialize Coin. This returns a main window to use from pivy import sogui win = sogui.SoGui.init() - if win == None: + if win is None: print("Unable to create a SoGui window") return