From 3400146d849d3d9c4e54094e1667d2d8ff989e6a Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sat, 29 Jun 2019 23:12:16 -0700 Subject: [PATCH] pylint warnings for PathSelection --- src/Mod/Path/PathScripts/PathSelection.py | 49 ++++++++++++----------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py index 08c2eca16b..748abfd346 100644 --- a/src/Mod/Path/PathScripts/PathSelection.py +++ b/src/Mod/Path/PathScripts/PathSelection.py @@ -35,22 +35,25 @@ if LOGLEVEL: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) PathLog.trackModule(PathLog.thisModule()) +class PathBaseGate(object): + # pylint: disable=no-init + pass -class EGate: - def allow(self, doc, obj, sub): +class EGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument return sub and sub[0:4] == 'Edge' -class MESHGate: - def allow(self, doc, obj, sub): +class MESHGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument return obj.TypeId[0:4] == 'Mesh' -class ENGRAVEGate: - def allow(self, doc, obj, sub): +class ENGRAVEGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument try: shape = obj.Shape - except Exception: + except Exception: # pylint: disable=broad-except return False if math.fabs(shape.Volume) < 1e-9 and len(shape.Wires) > 0: @@ -66,11 +69,11 @@ class ENGRAVEGate: return False -class CHAMFERGate: - def allow(self, doc, obj, sub): +class CHAMFERGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument try: shape = obj.Shape - except Exception: + except Exception: # pylint: disable=broad-except return False if math.fabs(shape.Volume) < 1e-9 and len(shape.Wires) > 0: @@ -88,8 +91,8 @@ class CHAMFERGate: return False -class DRILLGate: - def allow(self, doc, obj, sub): +class DRILLGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument PathLog.debug('obj: {} sub: {}'.format(obj, sub)) if hasattr(obj, "Shape") and sub: shape = obj.Shape @@ -99,13 +102,13 @@ class DRILLGate: return False -class PROFILEGate: - def allow(self, doc, obj, sub): +class PROFILEGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument profileable = False try: obj = obj.Shape - except Exception: + except Exception: # pylint: disable=broad-except return False if obj.ShapeType == 'Edge': @@ -134,13 +137,13 @@ class PROFILEGate: return profileable -class POCKETGate: - def allow(self, doc, obj, sub): +class POCKETGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument pocketable = False try: obj = obj.Shape - except Exception: + except Exception: # pylint: disable=broad-except return False if obj.ShapeType == 'Edge': @@ -159,19 +162,19 @@ class POCKETGate: return pocketable -class ADAPTIVEGate: - def allow(self, doc, obj, sub): +class ADAPTIVEGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument adaptive = True try: obj = obj.Shape - except Exception: + except Exception: # pylint: disable=broad-except return False return adaptive -class CONTOURGate: - def allow(self, doc, obj, sub): +class CONTOURGate(PathBaseGate): + def allow(self, doc, obj, sub): # pylint: disable=unused-argument pass def contourselect():