From bf030f76aa5ec526f9bf0b2037f92d9a5a5e64e9 Mon Sep 17 00:00:00 2001 From: luz paz Date: Sun, 31 Jul 2022 06:53:36 -0400 Subject: [PATCH] Fix various 'testing inequality to None' syntax issues Substitute `is not None` for `!= None` --- src/Mod/Mesh/App/MeshTestsApp.py | 2 +- src/Mod/Path/PathScripts/post/heidenhain_post.py | 14 +++++++------- src/Mod/Spreadsheet/App/Spreadsheet_legacy.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Mod/Mesh/App/MeshTestsApp.py b/src/Mod/Mesh/App/MeshTestsApp.py index 77ba1c8f0c..c3ca04a107 100644 --- a/src/Mod/Mesh/App/MeshTestsApp.py +++ b/src/Mod/Mesh/App/MeshTestsApp.py @@ -457,7 +457,7 @@ class PivyTestCases(unittest.TestCase): rp.setRay(coin.SbVec3f(-16.05,16.0,16.0),coin.SbVec3f(0,-1,0)) rp.apply(view.getSoRenderManager().getSceneGraph()) pp=rp.getPickedPoint() - self.assertTrue(pp != None) + self.assertTrue(pp is not None) det=pp.getDetail() self.assertTrue(det.getTypeId() == coin.SoFaceDetail.getClassTypeId()) det=coin.cast(det, det.getTypeId().getName().getString()) diff --git a/src/Mod/Path/PathScripts/post/heidenhain_post.py b/src/Mod/Path/PathScripts/post/heidenhain_post.py index 935c829b16..a1880a0605 100644 --- a/src/Mod/Path/PathScripts/post/heidenhain_post.py +++ b/src/Mod/Path/PathScripts/post/heidenhain_post.py @@ -465,7 +465,7 @@ def export(objectslist, filename, argstring): parsedElem = HEIDEN_Line( c.Parameters, Compensation, Feed, True, Spindle_Status, Cmd_Count ) - if parsedElem != None: + if parsedElem is not None: POSTGCODE.append(parsedElem) # Linear movement @@ -473,7 +473,7 @@ def export(objectslist, filename, argstring): parsedElem = HEIDEN_Line( c.Parameters, Compensation, Feed, False, "", Cmd_Count ) - if parsedElem != None: + if parsedElem is not None: POSTGCODE.append(parsedElem) # Arc movement @@ -481,7 +481,7 @@ def export(objectslist, filename, argstring): parsedElem = HEIDEN_Arc( c.Parameters, command, Compensation, Feed, False, "", Cmd_Count ) - if parsedElem != None: + if parsedElem is not None: POSTGCODE.extend(parsedElem) if command == "G80": # Reset Canned Cycles @@ -492,13 +492,13 @@ def export(objectslist, filename, argstring): # Drilling, Dwell Drilling, Peck Drilling if command == "G81" or command == "G82" or command == "G83": parsedElem = HEIDEN_Drill(obj, c.Parameters, command, Feed) - if parsedElem != None: + if parsedElem is not None: POSTGCODE.extend(parsedElem) # Tool change if command == "M6": parsedElem = HEIDEN_ToolCall(obj) - if parsedElem != None: + if parsedElem is not None: POSTGCODE.append(parsedElem) if COMPENSATION_DIFF_STATUS[0]: # Restore the compensation if removed @@ -961,7 +961,7 @@ def HEIDEN_Drill( else: drill_SafePoint = drill_Params["R"] # Surface equals to theoric start point of drilling - if drill_Surface != None and drill_SafePoint > drill_Surface: + if drill_Surface is not None and drill_SafePoint > drill_Surface: drill_Defs["DIST"] = drill_Surface - drill_SafePoint drill_StartPoint = drill_Surface else: @@ -1108,7 +1108,7 @@ def HEIDEN_LBL_Get(GetPoint=None, GetLevel=None, GetAddit=0): global STORED_LBL global LBLIZE_PATH_LEVEL - if GetPoint != None: + if GetPoint is not None: if LBLIZE_PATH_LEVEL != GetLevel: LBLIZE_PATH_LEVEL = GetLevel if len(STORED_LBL) != 0 and len(STORED_LBL[-1][-1]) == 0: diff --git a/src/Mod/Spreadsheet/App/Spreadsheet_legacy.py b/src/Mod/Spreadsheet/App/Spreadsheet_legacy.py index b04aa569c0..c73e08eddc 100644 --- a/src/Mod/Spreadsheet/App/Spreadsheet_legacy.py +++ b/src/Mod/Spreadsheet/App/Spreadsheet_legacy.py @@ -41,7 +41,7 @@ class MathParser: 'e' : math.e } for var in vars.keys(): - if self.vars.get(var) != None: + if self.vars.get(var) is not None: raise RuntimeError("Cannot redefine the value of " + var) self.vars[var] = vars[var]