From 85838942841755cf230634022ff19a19699ade6f Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Mon, 28 Feb 2022 21:02:45 -0800 Subject: [PATCH] Remove pylint annotations and script --- src/Mod/Path/InitGui.py | 2 +- src/Mod/Path/PathScripts/PathAdaptive.py | 5 +- src/Mod/Path/PathScripts/PathAdaptiveGui.py | 2 +- src/Mod/Path/PathScripts/PathAreaOp.py | 42 ++++----- .../PathScripts/PathCircularHoleBaseGui.py | 6 +- src/Mod/Path/PathScripts/PathCollision.py | 3 - src/Mod/Path/PathScripts/PathComment.py | 1 - src/Mod/Path/PathScripts/PathDeburr.py | 8 +- src/Mod/Path/PathScripts/PathDeburrGui.py | 4 +- .../Path/PathScripts/PathDressupAxisMap.py | 4 - .../Path/PathScripts/PathDressupDogbone.py | 11 +-- .../Path/PathScripts/PathDressupDragknife.py | 15 ++-- .../PathScripts/PathDressupHoldingTags.py | 12 ++- .../Path/PathScripts/PathDressupLeadInOut.py | 8 +- .../PathScripts/PathDressupPathBoundaryGui.py | 1 - .../Path/PathScripts/PathDressupRampEntry.py | 2 - src/Mod/Path/PathScripts/PathDressupTag.py | 4 +- src/Mod/Path/PathScripts/PathDressupTagGui.py | 6 -- src/Mod/Path/PathScripts/PathDrillingGui.py | 2 - .../Path/PathScripts/PathFeatureExtensions.py | 2 +- .../PathScripts/PathFeatureExtensionsGui.py | 21 ++--- src/Mod/Path/PathScripts/PathFixture.py | 1 - src/Mod/Path/PathScripts/PathGeom.py | 2 +- src/Mod/Path/PathScripts/PathGetPoint.py | 1 - src/Mod/Path/PathScripts/PathGuiInit.py | 3 +- .../Path/PathScripts/PathIconViewProvider.py | 7 +- src/Mod/Path/PathScripts/PathJob.py | 6 +- src/Mod/Path/PathScripts/PathJobDlg.py | 4 +- src/Mod/Path/PathScripts/PathLog.py | 25 +++--- src/Mod/Path/PathScripts/PathOp.py | 16 ++-- src/Mod/Path/PathScripts/PathOpGui.py | 40 +++------ src/Mod/Path/PathScripts/PathOpTools.py | 4 +- src/Mod/Path/PathScripts/PathPlane.py | 1 - src/Mod/Path/PathScripts/PathPocketBase.py | 3 +- src/Mod/Path/PathScripts/PathPocketBaseGui.py | 2 +- src/Mod/Path/PathScripts/PathPocketShape.py | 2 +- .../Path/PathScripts/PathPocketShapeGui.py | 2 +- src/Mod/Path/PathScripts/PathPost.py | 3 - src/Mod/Path/PathScripts/PathPostProcessor.py | 8 +- src/Mod/Path/PathScripts/PathPreferences.py | 2 +- .../PathScripts/PathPreferencesPathDressup.py | 1 - .../PathScripts/PathPreferencesPathJob.py | 1 - src/Mod/Path/PathScripts/PathProfile.py | 4 +- src/Mod/Path/PathScripts/PathProperty.py | 2 +- .../Path/PathScripts/PathPropertyBagGui.py | 7 -- .../Path/PathScripts/PathPropertyEditor.py | 6 +- src/Mod/Path/PathScripts/PathSelection.py | 43 +++++----- src/Mod/Path/PathScripts/PathSetupSheet.py | 1 - src/Mod/Path/PathScripts/PathSetupSheetGui.py | 8 -- .../PathScripts/PathSetupSheetOpPrototype.py | 2 +- .../PathSetupSheetOpPrototypeGui.py | 6 +- src/Mod/Path/PathScripts/PathSimpleCopy.py | 2 +- src/Mod/Path/PathScripts/PathSlotGui.py | 1 - src/Mod/Path/PathScripts/PathStock.py | 1 - src/Mod/Path/PathScripts/PathStop.py | 1 - .../Path/PathScripts/PathThreadMillingGui.py | 6 +- src/Mod/Path/PathScripts/PathToolBitGui.py | 4 - .../Path/PathScripts/PathToolBitLibraryGui.py | 1 - .../Path/PathScripts/PathToolController.py | 2 - .../Path/PathScripts/PathToolControllerGui.py | 8 -- .../PathScripts/PathToolLibraryManager.py | 4 +- src/Mod/Path/PathScripts/PathUtil.py | 6 +- src/Mod/Path/PathScripts/PathUtils.py | 4 +- src/Mod/Path/PathScripts/PathWaterline.py | 4 +- .../Path/PathScripts/post/centroid_post.py | 3 - .../Path/PathScripts/post/comparams_post.py | 1 - src/Mod/Path/PathScripts/post/dumper_post.py | 1 - .../Path/PathScripts/post/dynapath_post.py | 7 +- src/Mod/Path/PathScripts/post/example_post.py | 1 - src/Mod/Path/PathScripts/post/fablin_post.py | 3 - src/Mod/Path/PathScripts/post/fanuc_post.py | 6 +- src/Mod/Path/PathScripts/post/jtech_post.py | 5 +- .../Path/PathScripts/post/linuxcnc_post.py | 6 +- .../Path/PathScripts/post/mach3_mach4_post.py | 6 +- src/Mod/Path/PathScripts/post/opensbp_post.py | 1 - src/Mod/Path/PathScripts/post/philips_post.py | 6 +- src/Mod/Path/PathScripts/post/rml_post.py | 1 - .../Path/PathScripts/post/smoothie_post.py | 9 +- .../Path/PathTests/TestPathDressupDogbone.py | 1 - src/Mod/Path/PathTests/TestPathLog.py | 6 +- src/Mod/Path/PathTests/TestPathOpTools.py | 2 +- src/Mod/Path/utils/path-lint.sh | 85 ------------------- 82 files changed, 160 insertions(+), 408 deletions(-) delete mode 100755 src/Mod/Path/utils/path-lint.sh diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 70e9963c17..ef25422c9b 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -158,7 +158,7 @@ class PathWorkbench(Workbench): if PathPreferences.advancedOCLFeaturesEnabled(): try: - import ocl # pylint: disable=unused-variable + import ocl from PathScripts import PathSurfaceGui from PathScripts import PathWaterlineGui diff --git a/src/Mod/Path/PathScripts/PathAdaptive.py b/src/Mod/Path/PathScripts/PathAdaptive.py index f7241105d0..3caf12e2ab 100644 --- a/src/Mod/Path/PathScripts/PathAdaptive.py +++ b/src/Mod/Path/PathScripts/PathAdaptive.py @@ -121,7 +121,6 @@ def CalcHelixConePoint(height, cur_z, radius, angle): def GenerateGCode(op, obj, adaptiveResults, helixDiameter): - # pylint: disable=unused-argument if len(adaptiveResults) == 0 or len(adaptiveResults[0]["AdaptivePaths"]) == 0: return @@ -176,7 +175,6 @@ def GenerateGCode(op, obj, adaptiveResults, helixDiameter): # ml: this is dangerous because it'll hide all unused variables hence forward # however, I don't know what lx and ly signify so I'll leave them for now - # pylint: disable=unused-variable # lx = adaptiveResults[0]["HelixCenterPoint"][0] # ly = adaptiveResults[0]["HelixCenterPoint"][1] lz = passStartDepth @@ -649,7 +647,6 @@ def GenerateGCode(op, obj, adaptiveResults, helixDiameter): def Execute(op, obj): - # pylint: disable=global-statement global sceneGraph global topZ @@ -863,7 +860,7 @@ def _get_working_edges(op, obj): edge_list.append([discretize(e)]) # Apply regular Extensions - op.exts = [] # pylint: disable=attribute-defined-outside-init + op.exts = [] for ext in extensions: if not ext.avoid: wire = ext.getWire() diff --git a/src/Mod/Path/PathScripts/PathAdaptiveGui.py b/src/Mod/Path/PathScripts/PathAdaptiveGui.py index 6be8647dfc..4b42a2fd92 100644 --- a/src/Mod/Path/PathScripts/PathAdaptiveGui.py +++ b/src/Mod/Path/PathScripts/PathAdaptiveGui.py @@ -130,7 +130,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): if not hasattr(self, "extensionsPanel"): self.extensionsPanel = PathFeatureExtensionsGui.TaskPanelExtensionPage( obj, features - ) # pylint: disable=attribute-defined-outside-init + ) return self.extensionsPanel diff --git a/src/Mod/Path/PathScripts/PathAreaOp.py b/src/Mod/Path/PathScripts/PathAreaOp.py index ef4fc90538..799ae60a41 100644 --- a/src/Mod/Path/PathScripts/PathAreaOp.py +++ b/src/Mod/Path/PathScripts/PathAreaOp.py @@ -77,7 +77,6 @@ class ObjectOp(PathOp.ObjectOp): def areaOpFeatures(self, obj): """areaOpFeatures(obj) ... overwrite to add operation specific features. Can safely be overwritten by subclasses.""" - # pylint: disable=unused-argument return 0 def initOperation(self, obj): @@ -107,7 +106,7 @@ class ObjectOp(PathOp.ObjectOp): def initAreaOp(self, obj): """initAreaOp(obj) ... overwrite if the receiver class needs initialisation. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def areaOpShapeForDepths(self, obj, job): """areaOpShapeForDepths(obj) ... returns the shape used to make an initial calculation for the depths being used. @@ -131,7 +130,7 @@ class ObjectOp(PathOp.ObjectOp): def areaOpOnChanged(self, obj, prop): """areaOpOnChanged(obj, porp) ... overwrite to process operation specific changes to properties. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def opOnChanged(self, obj, prop): """opOnChanged(obj, prop) ... base implementation of the notification framework - do not overwrite. @@ -172,7 +171,7 @@ class ObjectOp(PathOp.ObjectOp): def areaOpOnDocumentRestored(self, obj): """areaOpOnDocumentRestored(obj) ... overwrite to fully restore receiver""" - pass # pylint: disable=unnecessary-pass + pass def opSetDefaultValues(self, obj, job): """opSetDefaultValues(obj) ... base implementation, do not overwrite. @@ -184,7 +183,7 @@ class ObjectOp(PathOp.ObjectOp): if PathOp.FeatureDepths & self.opFeatures(obj): try: shape = self.areaOpShapeForDepths(obj, job) - except Exception as ee: # pylint: disable=broad-except + except Exception as ee: PathLog.error(ee) shape = None @@ -219,11 +218,10 @@ class ObjectOp(PathOp.ObjectOp): def areaOpSetDefaultValues(self, obj, job): """areaOpSetDefaultValues(obj, job) ... overwrite to set initial values of operation specific properties. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def _buildPathArea(self, obj, baseobject, isHole, start, getsim): """_buildPathArea(obj, baseobject, isHole, start, getsim) ... internal function.""" - # pylint: disable=unused-argument PathLog.track() area = Path.Area() area.setPlane(PathUtils.makeWorkplane(baseobject)) @@ -231,7 +229,7 @@ class ObjectOp(PathOp.ObjectOp): areaParams = self.areaOpAreaParams( obj, isHole - ) # pylint: disable=assignment-from-no-return + ) heights = [i for i in self.depthparams] PathLog.debug("depths: {}".format(heights)) @@ -249,7 +247,7 @@ class ObjectOp(PathOp.ObjectOp): pathParams = self.areaOpPathParams( obj, isHole - ) # pylint: disable=assignment-from-no-return + ) pathParams["shapes"] = shapelist pathParams["feedrate"] = self.horizFeed pathParams["feedrate_v"] = self.vertFeed @@ -275,7 +273,7 @@ class ObjectOp(PathOp.ObjectOp): (pp, end_vector) = Path.fromShapes(**pathParams) PathLog.debug("pp: {}, end vector: {}".format(pp, end_vector)) - self.endVector = end_vector # pylint: disable=attribute-defined-outside-init + self.endVector = end_vector simobj = None if getsim: @@ -291,7 +289,6 @@ class ObjectOp(PathOp.ObjectOp): def _buildProfileOpenEdges(self, obj, edgeList, isHole, start, getsim): """_buildPathArea(obj, edgeList, isHole, start, getsim) ... internal function.""" - # pylint: disable=unused-argument PathLog.track() paths = [] @@ -302,7 +299,7 @@ class ObjectOp(PathOp.ObjectOp): hWire = Part.Wire(Part.__sortEdges__(baseShape.Edges)) hWire.translate(FreeCAD.Vector(0, 0, heights[i] - hWire.BoundBox.ZMin)) - pathParams = {} # pylint: disable=assignment-from-no-return + pathParams = {} pathParams["shapes"] = [hWire] pathParams["feedrate"] = self.horizFeed pathParams["feedrate_v"] = self.vertFeed @@ -343,7 +340,7 @@ class ObjectOp(PathOp.ObjectOp): return paths, simobj - def opExecute(self, obj, getsim=False): # pylint: disable=arguments-differ + def opExecute(self, obj, getsim=False): """opExecute(obj, getsim=False) ... implementation of Path.Area ops. determines the parameters for _buildPathArea(). Do not overwrite, implement @@ -355,8 +352,8 @@ class ObjectOp(PathOp.ObjectOp): PathLog.track() # Instantiate class variables for operation reference - self.endVector = None # pylint: disable=attribute-defined-outside-init - self.leadIn = 2.0 # pylint: disable=attribute-defined-outside-init + self.endVector = None + self.leadIn = 2.0 # Initiate depthparams and calculate operation heights for operation self.depthparams = self._customDepthParams( @@ -369,7 +366,7 @@ class ObjectOp(PathOp.ObjectOp): else: start = None - aOS = self.areaOpShapes(obj) # pylint: disable=assignment-from-no-return + aOS = self.areaOpShapes(obj) # Adjust tuples length received from other PathWB tools/operations shapes = [] @@ -421,7 +418,7 @@ class ObjectOp(PathOp.ObjectOp): ) else: (pp, sim) = self._buildPathArea(obj, shape, isHole, start, getsim) - except Exception as e: # pylint: disable=broad-except + except Exception as e: FreeCAD.Console.PrintError(e) FreeCAD.Console.PrintError( "Something unexpected happened. Check project and tool config." @@ -454,33 +451,28 @@ class ObjectOp(PathOp.ObjectOp): def areaOpRetractTool(self, obj): """areaOpRetractTool(obj) ... return False to keep the tool at current level between shapes. Default is True.""" - # pylint: disable=unused-argument return True def areaOpAreaParams(self, obj, isHole): """areaOpAreaParams(obj, isHole) ... return operation specific area parameters in a dictionary. Note that the resulting parameters are stored in the property AreaParams. Must be overwritten by subclasses.""" - # pylint: disable=unused-argument - pass # pylint: disable=unnecessary-pass + pass def areaOpPathParams(self, obj, isHole): """areaOpPathParams(obj, isHole) ... return operation specific path parameters in a dictionary. Note that the resulting parameters are stored in the property PathParams. Must be overwritten by subclasses.""" - # pylint: disable=unused-argument - pass # pylint: disable=unnecessary-pass + pass def areaOpShapes(self, obj): """areaOpShapes(obj) ... return all shapes to be processed by Path.Area for this op. Must be overwritten by subclasses.""" - # pylint: disable=unused-argument - pass # pylint: disable=unnecessary-pass + pass def areaOpUseProjection(self, obj): """areaOpUseProcjection(obj) ... return True if the operation can use procjection, defaults to False. Can safely be overwritten by subclasses.""" - # pylint: disable=unused-argument return False # Support methods diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py index c768fd53ab..166f24ee13 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py @@ -58,7 +58,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): return FreeCADGui.PySideUic.loadUi(":/panels/PageBaseHoleGeometryEdit.ui") def initPage(self, obj): - self.updating = False # pylint: disable=attribute-defined-outside-init + self.updating = False def setFields(self, obj): '''setFields(obj) ... fill form with values from obj''' @@ -142,9 +142,9 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): PathLog.debug("keeping (%s.%s)" % (obj.Label, sub)) newlist.append(base) PathLog.debug("obj.Base=%s newlist=%s" % (self.obj.Base, newlist)) - self.updating = True # pylint: disable=attribute-defined-outside-init + self.updating = True self.obj.Base = newlist - self.updating = False # pylint: disable=attribute-defined-outside-init + self.updating = False def checkedChanged(self): '''checkeChanged() ... callback when checked status of a base feature changed''' diff --git a/src/Mod/Path/PathScripts/PathCollision.py b/src/Mod/Path/PathScripts/PathCollision.py index 5927294bea..645c16b96a 100644 --- a/src/Mod/Path/PathScripts/PathCollision.py +++ b/src/Mod/Path/PathScripts/PathCollision.py @@ -64,7 +64,6 @@ class _ViewProviderCollisionSim: self.Object = vobj.Object def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument return True def getIcon(self): @@ -74,11 +73,9 @@ class _ViewProviderCollisionSim: return None def __setstate__(self, state): - # pylint: disable=unused-argument return None def onDelete(self, feature, subelements): - # pylint: disable=unused-argument feature.Original.ViewObject.Visibility = True return True diff --git a/src/Mod/Path/PathScripts/PathComment.py b/src/Mod/Path/PathScripts/PathComment.py index 58e5e605b6..1f5e7c06ce 100644 --- a/src/Mod/Path/PathScripts/PathComment.py +++ b/src/Mod/Path/PathScripts/PathComment.py @@ -84,7 +84,6 @@ class _ViewProviderComment: return ":/icons/Path_Comment.svg" def onChanged(self, vobj, prop): # optional - # pylint: disable=unused-argument mode = 2 vobj.setEditorMode("LineWidth", mode) vobj.setEditorMode("MarkerColor", mode) diff --git a/src/Mod/Path/PathScripts/PathDeburr.py b/src/Mod/Path/PathScripts/PathDeburr.py index 45c92b9676..98da2a488f 100644 --- a/src/Mod/Path/PathScripts/PathDeburr.py +++ b/src/Mod/Path/PathScripts/PathDeburr.py @@ -226,8 +226,8 @@ class ObjectDeburr(PathEngraveBase.ObjectOp): PathLog.track(obj.Label, depth, offset) - self.basewires = [] # pylint: disable=attribute-defined-outside-init - self.adjusted_basewires = [] # pylint: disable=attribute-defined-outside-init + self.basewires = [] + self.adjusted_basewires = [] wires = [] for base, subs in obj.Base: @@ -399,7 +399,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp): else: # Flat face basewires.append(Part.Wire(sub.Edges)) - self.edges = edges # pylint: disable=attribute-defined-outside-init + self.edges = edges for edgelist in Part.sortEdges(edges): basewires.append(Part.Wire(edgelist)) @@ -436,7 +436,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp): if obj.EntryPoint < 0: obj.EntryPoint = 0 - self.wires = wires # pylint: disable=attribute-defined-outside-init + self.wires = wires self.buildpathocc(obj, wires, zValues, True, forward, obj.EntryPoint) def opRejectAddBase(self, obj, base, sub): diff --git a/src/Mod/Path/PathScripts/PathDeburrGui.py b/src/Mod/Path/PathScripts/PathDeburrGui.py index ddcce623ee..ebe19ef33c 100644 --- a/src/Mod/Path/PathScripts/PathDeburrGui.py +++ b/src/Mod/Path/PathScripts/PathDeburrGui.py @@ -72,10 +72,10 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def initPage(self, obj): self.opImagePath = "{}Mod/Path/Images/Ops/{}".format( FreeCAD.getHomePath(), "chamfer.svg" - ) # pylint: disable=attribute-defined-outside-init + ) self.opImage = QtGui.QPixmap( self.opImagePath - ) # pylint: disable=attribute-defined-outside-init + ) self.form.opImage.setPixmap(self.opImage) iconMiter = QtGui.QIcon(":/icons/edge-join-miter-not.svg") iconMiter.addFile(":/icons/edge-join-miter.svg", state=QtGui.QIcon.On) diff --git a/src/Mod/Path/PathScripts/PathDressupAxisMap.py b/src/Mod/Path/PathScripts/PathDressupAxisMap.py index d839bbd538..b019cd7900 100644 --- a/src/Mod/Path/PathScripts/PathDressupAxisMap.py +++ b/src/Mod/Path/PathScripts/PathDressupAxisMap.py @@ -230,11 +230,9 @@ class ViewProviderDressup: return def unsetEdit(self, vobj, mode=0): - # pylint: disable=unused-argument return False def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument FreeCADGui.Control.closeDialog() panel = TaskPanel(vobj.Object) FreeCADGui.Control.showDialog(panel) @@ -252,7 +250,6 @@ class ViewProviderDressup: def onDelete(self, arg1=None, arg2=None): """this makes sure that the base operation is added back to the project and visible""" - # pylint: disable=unused-argument if arg1.Object and arg1.Object.Base: FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True job = PathUtils.findParentJob(arg1.Object) @@ -263,7 +260,6 @@ class ViewProviderDressup: class CommandPathDressup: - # pylint: disable=no-init def GetResources(self): return { diff --git a/src/Mod/Path/PathScripts/PathDressupDogbone.py b/src/Mod/Path/PathScripts/PathDressupDogbone.py index d0e0c5ff51..c25740d6ae 100644 --- a/src/Mod/Path/PathScripts/PathDressupDogbone.py +++ b/src/Mod/Path/PathScripts/PathDressupDogbone.py @@ -147,7 +147,6 @@ def edgesForCommands(cmds, startPt): class Style(object): - # pylint: disable=no-init Dogbone = "Dogbone" Tbone_H = "T-bone horizontal" @@ -158,7 +157,6 @@ class Style(object): class Side(object): - # pylint: disable=no-init Left = "Left" Right = "Right" @@ -174,7 +172,6 @@ class Side(object): class Incision(object): - # pylint: disable=no-init Fixed = "fixed" Adaptive = "adaptive" @@ -183,7 +180,6 @@ class Incision(object): class Smooth(object): - # pylint: disable=no-init Neither = 0 In = 1 @@ -397,7 +393,7 @@ class Bone(object): # beta = fabs(boneAngle - theta) beta = math.fabs( addAngle(boneAngle, -theta) - ) # pylint: disable=invalid-unary-operand-type + ) D = (distance / toolRadius) * math.sin(beta) if D > 1: # no intersection PathLog.debug("adaptive - no intersection - no bone") @@ -517,7 +513,6 @@ class ObjectDressup(object): return outChord.foldsBackOrTurns(inChord, self.theOtherSideOf(obj.Side)) def findPivotIntersection(self, pivot, pivotEdge, edge, refPt, d, color): - # pylint: disable=unused-argument PathLog.track( "(%.2f, %.2f)^%.2f - [(%.2f, %.2f), (%.2f, %.2f)]" % ( @@ -1298,7 +1293,6 @@ class SelObserver(object): PST.clear() def addSelection(self, doc, obj, sub, pnt): - # pylint: disable=unused-argument FreeCADGui.doCommand( "Gui.Selection.addSelection(FreeCAD.ActiveDocument." + obj + ")" ) @@ -1332,7 +1326,6 @@ class ViewProviderDressup(object): return [self.obj.Base] def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument FreeCADGui.Control.closeDialog() panel = TaskPanel(self, vobj.Object) FreeCADGui.Control.showDialog(panel) @@ -1347,7 +1340,6 @@ class ViewProviderDressup(object): def onDelete(self, arg1=None, arg2=None): """this makes sure that the base operation is added back to the project and visible""" - # pylint: disable=unused-argument if arg1.Object and arg1.Object.Base: FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True job = PathUtils.findParentJob(arg1.Object) @@ -1375,7 +1367,6 @@ def Create(base, name="DogboneDressup"): class CommandDressupDogbone(object): - # pylint: disable=no-init def GetResources(self): return { diff --git a/src/Mod/Path/PathScripts/PathDressupDragknife.py b/src/Mod/Path/PathScripts/PathDressupDragknife.py index 7542d4054b..b57e6aa1d5 100644 --- a/src/Mod/Path/PathScripts/PathDressupDragknife.py +++ b/src/Mod/Path/PathScripts/PathDressupDragknife.py @@ -171,7 +171,7 @@ class ObjectDressup: def arcExtension(self, obj, queue): """returns gcode for arc extension""" - global currLocation # pylint: disable=global-statement + global currLocation results = [] offset = obj.offset @@ -212,7 +212,7 @@ class ObjectDressup: """returns gcode to do an arc move toward an arc to perform a corner action twist. Includes lifting and plungeing the knife""" - global currLocation # pylint: disable=global-statement + global currLocation pivotheight = obj.pivotheight offset = obj.offset results = [] @@ -292,7 +292,7 @@ class ObjectDressup: def lineExtension(self, obj, queue): """returns gcode for line extension""" - global currLocation # pylint: disable=global-statement + global currLocation offset = float(obj.offset) results = [] @@ -320,7 +320,7 @@ class ObjectDressup: def lineTwist(self, obj, queue, lastXY, twistCW=False): """returns gcode to do an arc move toward a line to perform a corner action twist. Includes lifting and plungeing the knife""" - global currLocation # pylint: disable=global-statement + global currLocation pivotheight = obj.pivotheight offset = obj.offset @@ -374,7 +374,7 @@ class ObjectDressup: def execute(self, obj): newpath = [] - global currLocation # pylint: disable=global-statement + global currLocation if not obj.Base: return @@ -567,11 +567,9 @@ class ViewProviderDressup: # FreeCADGui.ActiveDocument.getObject(obj.Base.Name).Visibility = False def unsetEdit(self, vobj, mode=0): - # pylint: disable=unused-argument return False def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument FreeCADGui.Control.closeDialog() panel = TaskPanel(vobj.Object) FreeCADGui.Control.showDialog(panel) @@ -585,11 +583,9 @@ class ViewProviderDressup: return None def __setstate__(self, state): - # pylint: disable=unused-argument return None def onDelete(self, arg1=None, arg2=None): - # pylint: disable=unused-argument if arg1.Object and arg1.Object.Base: FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True job = PathUtils.findParentJob(arg1.Object.Base) @@ -600,7 +596,6 @@ class ViewProviderDressup: class CommandDressupDragknife: - # pylint: disable=no-init def GetResources(self): return { diff --git a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py index 788e21bf0b..098d6f75fc 100644 --- a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py +++ b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py @@ -570,7 +570,7 @@ class MapWireToTag: return shell def commandsForEdges(self): - global failures # pylint: disable=global-statement + global failures if self.edges: try: shape = self.shell().common(self.tag.solid) @@ -610,7 +610,7 @@ class MapWireToTag: ) # rapid = None # commented out per LGTM suggestion return commands - except Exception as e: # pylint: disable=broad-except + except Exception as e: PathLog.error( "Exception during processing tag @(%.2f, %.2f) (%s) - disabling the tag" % (self.tag.x, self.tag.y, e.args[0]) @@ -711,7 +711,7 @@ class PathData: wire = Part.Wire(bottom) if wire.isClosed(): return wire - except Exception: # pylint: disable=broad-except + except Exception: # if sys.version_info.major < 3: # traceback.print_exc(e) # else: @@ -742,7 +742,6 @@ class PathData: def generateTags( self, obj, count, width=None, height=None, angle=None, radius=None, spacing=None ): - # pylint: disable=unused-argument PathLog.track(count, width, height, angle, spacing) # for e in self.baseWire.Edges: # debugMarker(e.Vertexes[0].Point, 'base', (0.0, 1.0, 1.0), 0.2) @@ -1006,7 +1005,6 @@ class ObjectTagDressup: ), ) - # for pylint ... self.obj = obj self.solids = [] self.tags = [] @@ -1280,7 +1278,7 @@ class ObjectTagDressup: try: self.processTags(obj) - except Exception as e: # pylint: disable=broad-except + except Exception as e: PathLog.error( "processing tags failed clearing all tags ... '%s'" % (e.args[0]) ) @@ -1303,7 +1301,7 @@ class ObjectTagDressup: @waiting_effects def processTags(self, obj): - global failures # pylint: disable=global-statement + global failures failures = [] tagID = 0 if PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG: diff --git a/src/Mod/Path/PathScripts/PathDressupLeadInOut.py b/src/Mod/Path/PathScripts/PathDressupLeadInOut.py index ceb9dd6838..c8e8482e67 100644 --- a/src/Mod/Path/PathScripts/PathDressupLeadInOut.py +++ b/src/Mod/Path/PathScripts/PathDressupLeadInOut.py @@ -162,7 +162,6 @@ class ObjectDressup: return None def __setstate__(self, state): - # pylint: disable=unused-argument return None def setup(self, obj): @@ -405,7 +404,6 @@ class ObjectDressup: def getLeadEnd(self, obj, queue, action): """returns the Gcode of LeadOut.""" - # pylint: disable=unused-argument results = [] horizFeed = PathDressup.toolController(obj.Base).HorizFeed.Value R = obj.Length.Value # Radius of roll or length @@ -504,7 +502,7 @@ class ObjectDressup: return results def generateLeadInOutCurve(self, obj): - global currLocation # pylint: disable=global-statement + global currLocation firstmove = Path.Command("G0", {"X": 0, "Y": 0, "Z": 0}) op = PathDressup.baseOp(obj.Base) currLocation.update(firstmove.Parameters) @@ -634,7 +632,6 @@ class ViewProviderDressup: return [self.obj.Base] def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument FreeCADGui.Control.closeDialog() panel = TaskDressupLeadInOut(vobj.Object, self) FreeCADGui.Control.showDialog(panel) @@ -646,7 +643,6 @@ class ViewProviderDressup: def onDelete(self, arg1=None, arg2=None): """this makes sure that the base operation is added back to the project and visible""" - # pylint: disable=unused-argument PathLog.debug("Deleting Dressup") if arg1.Object and arg1.Object.Base: FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True @@ -660,7 +656,6 @@ class ViewProviderDressup: return None def __setstate__(self, state): - # pylint: disable=unused-argument return None def clearTaskPanel(self): @@ -668,7 +663,6 @@ class ViewProviderDressup: class CommandPathDressupLeadInOut: - # pylint: disable=no-init def GetResources(self): return { diff --git a/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py b/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py index 6d5540d805..12a9ae139e 100644 --- a/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py +++ b/src/Mod/Path/PathScripts/PathDressupPathBoundaryGui.py @@ -257,7 +257,6 @@ def Create(base, name="DressupPathBoundary"): class CommandPathDressupPathBoundary: - # pylint: disable=no-init def GetResources(self): return { diff --git a/src/Mod/Path/PathScripts/PathDressupRampEntry.py b/src/Mod/Path/PathScripts/PathDressupRampEntry.py index bd53bbfce5..15234064f5 100644 --- a/src/Mod/Path/PathScripts/PathDressupRampEntry.py +++ b/src/Mod/Path/PathScripts/PathDressupRampEntry.py @@ -877,7 +877,6 @@ class ViewProviderDressup: def onDelete(self, arg1=None, arg2=None): """this makes sure that the base operation is added back to the project and visible""" - # pylint: disable=unused-argument PathLog.debug("Deleting Dressup") if arg1.Object and arg1.Object.Base: FreeCADGui.ActiveDocument.getObject(arg1.Object.Base.Name).Visibility = True @@ -895,7 +894,6 @@ class ViewProviderDressup: class CommandPathDressupRampEntry: - # pylint: disable=no-init def GetResources(self): return { diff --git a/src/Mod/Path/PathScripts/PathDressupTag.py b/src/Mod/Path/PathScripts/PathDressupTag.py index e7fbb451a4..e555800699 100644 --- a/src/Mod/Path/PathScripts/PathDressupTag.py +++ b/src/Mod/Path/PathScripts/PathDressupTag.py @@ -253,7 +253,7 @@ class ObjectDressup: self.wire, rapid = PathGeom.wireForPath( obj.Base.Path - ) # pylint: disable=unused-variable + ) self.edges = self.wire.Edges maxTagZ = minZ + obj.Height.Value @@ -286,11 +286,9 @@ class ObjectDressup: obj.Shape = solid def supportsTagGeneration(self, obj): - # pylint: disable=unused-argument return False def pointIsOnPath(self, obj, p): - # pylint: disable=unused-argument for e in self.edges: if DraftGeomUtils.isPtOnEdge(p, e): return True diff --git a/src/Mod/Path/PathScripts/PathDressupTagGui.py b/src/Mod/Path/PathScripts/PathDressupTagGui.py index b42738ae0c..a100b827aa 100644 --- a/src/Mod/Path/PathScripts/PathDressupTagGui.py +++ b/src/Mod/Path/PathScripts/PathDressupTagGui.py @@ -445,7 +445,6 @@ class PathDressupTagViewProvider: def onDelete(self, arg1=None, arg2=None): """this makes sure that the base operation is added back to the job and visible""" - # pylint: disable=unused-argument PathLog.track() if self.obj.Base and self.obj.Base.ViewObject: self.obj.Base.ViewObject.Visibility = True @@ -491,13 +490,11 @@ class PathDressupTagViewProvider: # tag.purgeTouched() def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument panel = PathDressupTagTaskPanel(vobj.Object, self) self.setupTaskPanel(panel) return True def unsetEdit(self, vobj, mode): - # pylint: disable=unused-argument if hasattr(self, "panel") and self.panel: self.panel.abort() @@ -537,13 +534,11 @@ class PathDressupTagViewProvider: return -1 def allow(self, doc, obj, sub): - # pylint: disable=unused-argument if obj == self.obj: return True return False def addSelection(self, doc, obj, sub, point): - # pylint: disable=unused-argument PathLog.track(doc, obj, sub, point) if self.panel: i = self.tagAtPoint(point, sub is None) @@ -565,7 +560,6 @@ def Create(baseObject, name="DressupTag"): class CommandPathDressupTag: - # pylint: disable=no-init def GetResources(self): return { diff --git a/src/Mod/Path/PathScripts/PathDrillingGui.py b/src/Mod/Path/PathScripts/PathDrillingGui.py index 1ed09912ec..30a594231b 100644 --- a/src/Mod/Path/PathScripts/PathDrillingGui.py +++ b/src/Mod/Path/PathScripts/PathDrillingGui.py @@ -48,7 +48,6 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage): """Controller for the drilling operation's page""" def initPage(self, obj): - # pylint: disable=attribute-defined-outside-init self.peckDepthSpinBox = PathGui.QuantitySpinBox( self.form.peckDepth, obj, "PeckDepth" ) @@ -90,7 +89,6 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage): return form def updateQuantitySpinBoxes(self, index=None): - # pylint: disable=unused-argument self.peckDepthSpinBox.updateSpinBox() self.peckRetractSpinBox.updateSpinBox() self.dwellTimeSpinBox.updateSpinBox() diff --git a/src/Mod/Path/PathScripts/PathFeatureExtensions.py b/src/Mod/Path/PathScripts/PathFeatureExtensions.py index 0075bbf8b4..ff6c12816b 100644 --- a/src/Mod/Path/PathScripts/PathFeatureExtensions.py +++ b/src/Mod/Path/PathScripts/PathFeatureExtensions.py @@ -86,7 +86,7 @@ def selectOffsetWire(feature, wires): dist = feature.distToShape(w)[0] if ( closest is None or dist > closest[0] - ): # pylint: disable=unsubscriptable-object + ): closest = (dist, w) if closest is not None: diff --git a/src/Mod/Path/PathScripts/PathFeatureExtensionsGui.py b/src/Mod/Path/PathScripts/PathFeatureExtensionsGui.py index b1d2b5b72d..cb24685d80 100644 --- a/src/Mod/Path/PathScripts/PathFeatureExtensionsGui.py +++ b/src/Mod/Path/PathScripts/PathFeatureExtensionsGui.py @@ -199,18 +199,18 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): self.defaultLength = PathGui.QuantitySpinBox( self.form.defaultLength, obj, "ExtensionLengthDefault" - ) # pylint: disable=attribute-defined-outside-init + ) self.form.extensionTree.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.form.extensionTree.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) - self.switch = coin.SoSwitch() # pylint: disable=attribute-defined-outside-init + self.switch = coin.SoSwitch() self.obj.ViewObject.RootNode.addChild(self.switch) self.switch.whichChild = coin.SO_SWITCH_ALL self.model = QtGui.QStandardItemModel( self.form.extensionTree - ) # pylint: disable=attribute-defined-outside-init + ) self.model.setHorizontalHeaderLabels(["Base", "Extension"]) """ @@ -224,7 +224,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): """ self.form.showExtensions.setCheckState(QtCore.Qt.Unchecked) - self.blockUpdateData = False # pylint: disable=attribute-defined-outside-init + self.blockUpdateData = False def cleanupPage(self, obj): try: @@ -263,19 +263,19 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): PathLog.debug("updateProxyExtensions()") self.extensions = ( self.currentExtensions() - ) # pylint: disable=attribute-defined-outside-init + ) FeatureExtensions.setExtensions(obj, self.extensions) def getFields(self, obj): PathLog.track(obj.Label, self.model.rowCount(), self.model.columnCount()) - self.blockUpdateData = True # pylint: disable=attribute-defined-outside-init + self.blockUpdateData = True if obj.ExtensionCorners != self.form.extendCorners.isChecked(): obj.ExtensionCorners = self.form.extendCorners.isChecked() self.defaultLength.updateProperty() self.updateProxyExtensions(obj) - self.blockUpdateData = False # pylint: disable=attribute-defined-outside-init + self.blockUpdateData = False def setFields(self, obj): PathLog.track(obj.Label) @@ -397,7 +397,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): ], key=lambda s: int(s), ) - ) # pylint: disable=unnecessary-lambda + ) ext2 = self._cachedExtension(self.obj, base, sub, label) createSubItem(label, ext2) @@ -437,7 +437,6 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): # remove current extensions and all their visuals def removeItemSwitch(item, ext): - # pylint: disable=unused-argument ext.hide() if ext.root: self.switch.removeChild(ext.root) @@ -526,7 +525,6 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): FreeCADGui.Selection.clearSelection() def selectItem(item, ext): - # pylint: disable=unused-argument for sel in selection: if ext.base == sel.obj and ext.edge == sel.sub: return True @@ -597,7 +595,6 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): if self.form.showExtensions.isChecked(): def enableExtensionEdit(item, ext): - # pylint: disable=unused-argument ext.show() self.forAllItemsCall(enableExtensionEdit) @@ -639,7 +636,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage): self.selectionModel = ( self.form.extensionTree.selectionModel() - ) # pylint: disable=attribute-defined-outside-init + ) self.selectionModel.selectionChanged.connect(self.selectionChanged) self.selectionChanged() diff --git a/src/Mod/Path/PathScripts/PathFixture.py b/src/Mod/Path/PathScripts/PathFixture.py index 9c871bbdd6..cfa67d4c47 100644 --- a/src/Mod/Path/PathScripts/PathFixture.py +++ b/src/Mod/Path/PathScripts/PathFixture.py @@ -124,7 +124,6 @@ class _ViewProviderFixture: return ":/icons/Path_Datums.svg" def onChanged(self, vobj, prop): # optional - # pylint: disable=unused-argument mode = 2 vobj.setEditorMode("LineWidth", mode) vobj.setEditorMode("MarkerColor", mode) diff --git a/src/Mod/Path/PathScripts/PathGeom.py b/src/Mod/Path/PathScripts/PathGeom.py index 7c8ab9681e..0ea55edd7c 100644 --- a/src/Mod/Path/PathScripts/PathGeom.py +++ b/src/Mod/Path/PathScripts/PathGeom.py @@ -675,7 +675,7 @@ def flipEdge(edge): elif type(edge.Curve) == Part.OffsetCurve: return edge.reversed() - global OddsAndEnds # pylint: disable=global-statement + global OddsAndEnds OddsAndEnds.append(edge) PathLog.warning( translate("PathGeom", "%s not supported for flipping") % type(edge.Curve) diff --git a/src/Mod/Path/PathScripts/PathGetPoint.py b/src/Mod/Path/PathScripts/PathGetPoint.py index a211e5d49e..9f0291ac06 100644 --- a/src/Mod/Path/PathScripts/PathGetPoint.py +++ b/src/Mod/Path/PathScripts/PathGetPoint.py @@ -161,7 +161,6 @@ class TaskPanel: self.pointAcceptAndContinue() def cancel(): - # pylint: disable=unused-variable self.pointReject() self.pointWhenDone = whenDone diff --git a/src/Mod/Path/PathScripts/PathGuiInit.py b/src/Mod/Path/PathScripts/PathGuiInit.py index 947d19ff4b..295c0c8d01 100644 --- a/src/Mod/Path/PathScripts/PathGuiInit.py +++ b/src/Mod/Path/PathScripts/PathGuiInit.py @@ -19,7 +19,6 @@ # * USA * # * * # *************************************************************************** -# pylint: disable=unused-import import PathScripts.PathLog as PathLog @@ -34,7 +33,7 @@ else: Processed = False def Startup(): - global Processed # pylint: disable=global-statement + global Processed if not Processed: PathLog.debug('Initializing PathGui') from PathScripts import PathAdaptiveGui diff --git a/src/Mod/Path/PathScripts/PathIconViewProvider.py b/src/Mod/Path/PathScripts/PathIconViewProvider.py index 74e458f03b..5b08e32edb 100644 --- a/src/Mod/Path/PathScripts/PathIconViewProvider.py +++ b/src/Mod/Path/PathScripts/PathIconViewProvider.py @@ -83,17 +83,14 @@ class ViewProvider(object): callback(self.obj, self.vobj, edit) def setEdit(self, vobj=None, mode=0): - # pylint: disable=unused-argument if 0 == mode: self._onEditCallback(True) return False def unsetEdit(self, arg1, arg2): - # pylint: disable=unused-argument self._onEditCallback(False) def setupContextMenu(self, vobj, menu): - # pylint: disable=unused-argument PathLog.track() from PySide import QtGui @@ -111,7 +108,7 @@ def Attach(vobj, name): If no view provider was registered for the given name a default IconViewProvider is created.""" PathLog.track(vobj.Object.Label, name) - global _factory # pylint: disable=global-statement + global _factory for key, value in PathUtil.keyValueIter(_factory): if key == name: return value(vobj, name) @@ -124,5 +121,5 @@ def RegisterViewProvider(name, provider): an instance of provider is used instead.""" PathLog.track(name) - global _factory # pylint: disable=global-statement + global _factory _factory[name] = provider diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 72d1085c9d..d536ad497a 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -50,7 +50,6 @@ translate = FreeCAD.Qt.translate class JobTemplate: - # pylint: disable=no-init """Attribute and sub element strings for template export/import.""" Description = "Desc" GeometryTolerance = "Tolerance" @@ -69,7 +68,6 @@ class JobTemplate: def isResourceClone(obj, propLink, resourceName): - # pylint: disable=unused-argument if hasattr(propLink, "PathResource") and ( resourceName is None or resourceName == propLink.PathResource ): @@ -464,7 +462,7 @@ class ObjectJob: if getattr(obj.Operations, "ViewObject", None): try: obj.Operations.ViewObject.DisplayMode - except Exception: # pylint: disable=broad-except + except Exception: name = obj.Operations.Name label = obj.Operations.Label ops = FreeCAD.ActiveDocument.addObject( @@ -703,7 +701,7 @@ class ObjectJob: group.insert(group.index(before), op) if removeBefore: group.remove(before) - except Exception as e: # pylint: disable=broad-except + except Exception as e: PathLog.error(e) group.append(op) else: diff --git a/src/Mod/Path/PathScripts/PathJobDlg.py b/src/Mod/Path/PathScripts/PathJobDlg.py index 3e0db9e75a..0a92620279 100644 --- a/src/Mod/Path/PathScripts/PathJobDlg.py +++ b/src/Mod/Path/PathScripts/PathJobDlg.py @@ -48,7 +48,6 @@ class _ItemDelegate(QtGui.QStyledItemDelegate): QtGui.QStyledItemDelegate.__init__(self, parent) def createEditor(self, parent, option, index): - # pylint: disable=unused-argument editor = QtGui.QSpinBox(parent) self.controller.setupColumnEditor(index, editor) return editor @@ -58,7 +57,6 @@ class JobCreate: DataObject = QtCore.Qt.ItemDataRole.UserRole def __init__(self, parent=None, sel=None): - # pylint: disable=unused-argument self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgJobCreate.ui") self.itemsSolid = QtGui.QStandardItem(translate("Path_Job", "Solids")) self.items2D = QtGui.QStandardItem(translate("Path_Job", "2D")) @@ -264,7 +262,7 @@ class JobCreate: for i in range(self.itemsSolid.rowCount()): for j in range( self.itemsSolid.child(i, 1).data(QtCore.Qt.EditRole) - ): # pylint: disable=unused-variable + ): models.append(self.itemsSolid.child(i).data(self.DataObject)) for i in range(self.items2D.rowCount()): diff --git a/src/Mod/Path/PathScripts/PathLog.py b/src/Mod/Path/PathScripts/PathLog.py index 43509bad90..6caf9816f7 100644 --- a/src/Mod/Path/PathScripts/PathLog.py +++ b/src/Mod/Path/PathScripts/PathLog.py @@ -26,7 +26,6 @@ import traceback class Level: """Enumeration of log levels, used for setLevel and getLevel.""" - # pylint: disable=no-init RESET = -1 ERROR = 0 WARNING = 1 @@ -48,15 +47,15 @@ _trackAll = False def logToConsole(yes): """(boolean) - if set to True (default behaviour) log messages are printed to the console. Otherwise they are printed to stdout.""" - global _useConsole # pylint: disable=global-statement + global _useConsole _useConsole = yes def setLevel(level, module = None): """(level, module = None) if no module is specified the default log level is set. Otherwise the module specific log level is changed (use RESET to clear).""" - global _defaultLogLevel # pylint: disable=global-statement - global _moduleLogLevel # pylint: disable=global-statement + global _defaultLogLevel + global _moduleLogLevel if module: if level == Level.RESET: if _moduleLogLevel.get(module, -1) != -1: @@ -82,12 +81,12 @@ def thisModule(): def _caller(): """internal function to determine the calling module.""" - filename, line, func, text = traceback.extract_stack(limit=3)[0] # pylint: disable=unused-variable + filename, line, func, text = traceback.extract_stack(limit=3)[0] return os.path.splitext(os.path.basename(filename))[0], line, func def _log(level, module_line_func, msg): """internal function to do the logging""" - module, line, func = module_line_func # pylint: disable=unused-variable + module, line, func = module_line_func if getLevel(module) >= level: message = "%s.%s: %s" % (module, Level.toString(level), msg) if _useConsole: @@ -125,32 +124,32 @@ def error(msg): def trackAllModules(boolean): """(boolean) - if True all modules will be tracked, otherwise tracking is up to the module setting.""" - global _trackAll # pylint: disable=global-statement + global _trackAll _trackAll = boolean def untrackAllModules(): """In addition to stop tracking all modules it also clears the tracking flag for all individual modules.""" - global _trackAll # pylint: disable=global-statement - global _trackModule # pylint: disable=global-statement + global _trackAll + global _trackModule _trackAll = False _trackModule = { } def trackModule(module = None): """(module = None) - start tracking given module, current module if not set.""" - global _trackModule # pylint: disable=global-statement + global _trackModule if module: _trackModule[module] = True else: - mod, line, func = _caller() # pylint: disable=unused-variable + mod, line, func = _caller() _trackModule[mod] = True def untrackModule(module = None): """(module = None) - stop tracking given module, current module if not set.""" - global _trackModule # pylint: disable=global-statement + global _trackModule if module and _trackModule.get(module, None): del _trackModule[module] elif not module: - mod, line, func = _caller() # pylint: disable=unused-variable + mod, line, func = _caller() if _trackModule.get(mod, None): del _trackModule[mod] diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 5ed12e6fd5..e9b18ade68 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -480,7 +480,6 @@ class ObjectOp(object): """opFeatures(obj) ... returns the OR'ed list of features used and supported by the operation. The default implementation returns "FeatureTool | FeatureDepths | FeatureHeights | FeatureStartPoint" Should be overwritten by subclasses.""" - # pylint: disable=unused-argument return ( FeatureTool | FeatureDepths @@ -494,12 +493,12 @@ class ObjectOp(object): def initOperation(self, obj): """initOperation(obj) ... implement to create additional properties. Should be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def opOnDocumentRestored(self, obj): """opOnDocumentRestored(obj) ... implement if an op needs special handling like migrating the data model. Should be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def opOnChanged(self, obj, prop): """opOnChanged(obj, prop) ... overwrite to process property changes. @@ -508,29 +507,28 @@ class ObjectOp(object): distinguish between assigning a different value and assigning the same value again. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def opSetDefaultValues(self, obj, job): """opSetDefaultValues(obj, job) ... overwrite to set initial default values. Called after the receiver has been fully created with all properties. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def opUpdateDepths(self, obj): """opUpdateDepths(obj) ... overwrite to implement special depths calculation. Can safely be overwritten by subclass.""" - pass # pylint: disable=unnecessary-pass + pass def opExecute(self, obj): """opExecute(obj) ... called whenever the receiver needs to be recalculated. See documentation of execute() for a list of base functionality provided. Should be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def opRejectAddBase(self, obj, base, sub): """opRejectAddBase(base, sub) ... if op returns True the addition of the feature is prevented. Should be overwritten by subclasses.""" - # pylint: disable=unused-argument return False def onChanged(self, obj, prop): @@ -816,7 +814,7 @@ class ObjectOp(object): if obj.Comment: self.commandlist.append(Path.Command("(%s)" % obj.Comment)) - result = self.opExecute(obj) # pylint: disable=assignment-from-no-return + result = self.opExecute(obj) if self.commandlist and (FeatureHeights & self.opFeatures(obj)): # Let's finish by rapid to clearance...just for safety diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index 50d5345539..ba5e222316 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -134,7 +134,6 @@ class ViewProvider(object): job.ViewObject.Proxy.resetEditVisibility(job) def unsetEdit(self, arg1, arg2): - # pylint: disable=unused-argument if self.panel: self.panel.reject(False) @@ -182,12 +181,10 @@ class ViewProvider(object): self.panel.updateData(obj, prop) def onDelete(self, vobj, arg2=None): - # pylint: disable=unused-argument PathUtil.clearExpressionEngine(vobj.Object) return True def setupContextMenu(self, vobj, menu): - # pylint: disable=unused-argument PathLog.track() for action in menu.actions(): menu.removeAction(action) @@ -205,7 +202,7 @@ class TaskPanelPage(object): Do not overwrite, implement initPage(obj) instead.""" self.obj = obj self.job = PathUtils.findParentJob(obj) - self.form = self.getForm() # pylint: disable=assignment-from-no-return + self.form = self.getForm() self.signalDirtyChanged = None self.setClean() self.setTitle("-") @@ -276,7 +273,6 @@ class TaskPanelPage(object): """getTitle(obj) ... return title to be used for the receiver page. The default implementation returns what was previously set with setTitle(title). Can safely be overwritten by subclasses.""" - # pylint: disable=unused-argument return self.title def setIcon(self, icon): @@ -286,7 +282,6 @@ class TaskPanelPage(object): def getIcon(self, obj): """getIcon(obj) ... return icon for page or None. Can safely be overwritten by subclasses.""" - # pylint: disable=unused-argument return self.icon # subclass interface @@ -294,39 +289,37 @@ class TaskPanelPage(object): """initPage(obj) ... overwrite to customize UI for specific model. Note that this function is invoked after all page controllers have been created. Should be overwritten by subclasses.""" - # pylint: disable=unused-argument - pass # pylint: disable=unnecessary-pass + pass def cleanupPage(self, obj): """cleanupPage(obj) ... overwrite to perform any cleanup tasks before page is destroyed. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def modifyStandardButtons(self, buttonBox): """modifyStandardButtons(buttonBox) ... overwrite if the task panel standard buttons need to be modified. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def getForm(self): """getForm() ... return UI form for this page. Must be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def getFields(self, obj): """getFields(obj) ... overwrite to transfer values from UI to obj's properties. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def setFields(self, obj): """setFields(obj) ... overwrite to transfer obj's property values to UI. Can safely be overwritten by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def getSignalsForUpdate(self, obj): """getSignalsForUpdate(obj) ... return signals which, when triggered, cause the receiver to update the model. See also registerSignalHandlers(obj) Can safely be overwritten by subclasses.""" - # pylint: disable=unused-argument return [] def registerSignalHandlers(self, obj): @@ -335,8 +328,7 @@ class TaskPanelPage(object): (see getSignalsForUpdate(obj)) this function can be used to register signal handlers manually. Can safely be overwritten by subclasses.""" - # pylint: disable=unused-argument - pass # pylint: disable=unnecessary-pass + pass def updateData(self, obj, prop): """updateData(obj, prop) ... overwrite if the receiver needs to react to property changes that might not have been caused by the receiver itself. @@ -348,15 +340,13 @@ class TaskPanelPage(object): This can happen if a subclass unconditionally transfers all values in getFields(obj) to the model and just calls setFields(obj) in this callback. In such a scenario the first property assignment will cause all changes in the UI of the other fields to be overwritten by setFields(obj). You have been warned.""" - # pylint: disable=unused-argument - pass # pylint: disable=unnecessary-pass + pass def updateSelection(self, obj, sel): """updateSelection(obj, sel) ... overwrite to customize UI depending on current selection. Can safely be overwritten by subclasses.""" - # pylint: disable=unused-argument - pass # pylint: disable=unnecessary-pass + pass def selectInComboBox(self, name, combo): """selectInComboBox(name, combo) ... @@ -766,7 +756,6 @@ class TaskPanelBaseLocationPage(TaskPanelPage): self.getPoint.getPoint(self.addLocationAt) def addLocationAt(self, point, obj): - # pylint: disable=unused-argument if point: locations = self.obj.Locations locations.append(point) @@ -784,7 +773,6 @@ class TaskPanelBaseLocationPage(TaskPanelPage): self.getPoint.getPoint(self.editLocationAt, start) def editLocationAt(self, point, obj): - # pylint: disable=unused-argument if point: self.formLoc.baseList.item(self.editRow, 0).setData( self.DataLocation, point.x @@ -1238,7 +1226,6 @@ class TaskPanel(object): def pageDirtyChanged(self, page): """pageDirtyChanged(page) ... internal callback""" - # pylint: disable=unused-argument self.buttonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(self.isDirty()) def clicked(self, button): @@ -1332,27 +1319,21 @@ class TaskPanel(object): # SelectionObserver interface def addSelection(self, doc, obj, sub, pnt): - # pylint: disable=unused-argument self.updateSelection() def removeSelection(self, doc, obj, sub): - # pylint: disable=unused-argument self.updateSelection() def setSelection(self, doc): - # pylint: disable=unused-argument self.updateSelection() def clearSelection(self, doc): - # pylint: disable=unused-argument self.updateSelection() class CommandSetStartPoint: """Command to set the start point for an operation.""" - # pylint: disable=no-init - def GetResources(self): return { "Pixmap": "Path_StartPoint", @@ -1370,7 +1351,6 @@ class CommandSetStartPoint: return obj and hasattr(obj, "StartPoint") def setpoint(self, point, o): - # pylint: disable=unused-argument obj = FreeCADGui.Selection.getSelection()[0] obj.StartPoint.x = point.x obj.StartPoint.y = point.y diff --git a/src/Mod/Path/PathScripts/PathOpTools.py b/src/Mod/Path/PathScripts/PathOpTools.py index 290e62ef9a..233c5305bd 100644 --- a/src/Mod/Path/PathScripts/PathOpTools.py +++ b/src/Mod/Path/PathScripts/PathOpTools.py @@ -291,7 +291,7 @@ def offsetWire(wire, base, offset, forward, Side=None): return Part.Wire([edge]) # if we get to this point the assumption is that makeOffset2D can deal with the edge - pass # pylint: disable=unnecessary-pass + pass owire = orientWire(wire.makeOffset2D(offset), True) debugWire("makeOffset2D_%d" % len(wire.Edges), owire) @@ -307,7 +307,7 @@ def offsetWire(wire, base, offset, forward, Side=None): Side[0] = "Inside" try: owire = wire.makeOffset2D(-offset) - except Exception: # pylint: disable=broad-except + except Exception: # most likely offsetting didn't work because the wire is a hole # and the offset is too big - making the hole vanish return None diff --git a/src/Mod/Path/PathScripts/PathPlane.py b/src/Mod/Path/PathScripts/PathPlane.py index d25fa76e2f..9db418952d 100644 --- a/src/Mod/Path/PathScripts/PathPlane.py +++ b/src/Mod/Path/PathScripts/PathPlane.py @@ -86,7 +86,6 @@ class _ViewProviderPlane: return ":/icons/Path_Plane.svg" def onChanged(self, vobj, prop): # optional - # pylint: disable=unused-argument mode = 2 vobj.setEditorMode("LineWidth", mode) vobj.setEditorMode("MarkerColor", mode) diff --git a/src/Mod/Path/PathScripts/PathPocketBase.py b/src/Mod/Path/PathScripts/PathPocketBase.py index c445aae318..6af1e9f1c3 100644 --- a/src/Mod/Path/PathScripts/PathPocketBase.py +++ b/src/Mod/Path/PathScripts/PathPocketBase.py @@ -99,13 +99,12 @@ class ObjectPocket(PathAreaOp.ObjectOp): ) def pocketOpFeatures(self, obj): - # pylint: disable=unused-argument return 0 def initPocketOp(self, obj): """initPocketOp(obj) ... overwrite to initialize subclass. Can safely be overwritten by subclass.""" - pass # pylint: disable=unnecessary-pass + pass def pocketInvertExtraOffset(self): """pocketInvertExtraOffset() ... return True if ExtraOffset's direction is inward. diff --git a/src/Mod/Path/PathScripts/PathPocketBaseGui.py b/src/Mod/Path/PathScripts/PathPocketBaseGui.py index 75d6387933..f80f729249 100644 --- a/src/Mod/Path/PathScripts/PathPocketBaseGui.py +++ b/src/Mod/Path/PathScripts/PathPocketBaseGui.py @@ -59,7 +59,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): FeatureFacing ... used for face milling operation FeatureOutline ... used for pocket-shape operation Must be overwritten by subclasses""" - pass # pylint: disable=unnecessary-pass + pass def getForm(self): """getForm() ... returns UI, adapted to the results from pocketFeatures()""" diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py index 12cbc1c046..ba5d99c7a3 100644 --- a/src/Mod/Path/PathScripts/PathPocketShape.py +++ b/src/Mod/Path/PathScripts/PathPocketShape.py @@ -138,7 +138,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket): self.horiz.append(face) # Add faces for extensions - self.exts = [] # pylint: disable=attribute-defined-outside-init + self.exts = [] for ext in extensions: if not ext.avoid: wire = ext.getWire() diff --git a/src/Mod/Path/PathScripts/PathPocketShapeGui.py b/src/Mod/Path/PathScripts/PathPocketShapeGui.py index 9f88dc128c..dd88dadaf8 100644 --- a/src/Mod/Path/PathScripts/PathPocketShapeGui.py +++ b/src/Mod/Path/PathScripts/PathPocketShapeGui.py @@ -58,7 +58,7 @@ class TaskPanelOpPage(PathPocketBaseGui.TaskPanelOpPage): if not hasattr(self, "extensionsPanel"): self.extensionsPanel = PathFeatureExtensionsGui.TaskPanelExtensionPage( obj, features - ) # pylint: disable=attribute-defined-outside-init + ) return self.extensionsPanel diff --git a/src/Mod/Path/PathScripts/PathPost.py b/src/Mod/Path/PathScripts/PathPost.py index 841872b996..93ce45bf3b 100644 --- a/src/Mod/Path/PathScripts/PathPost.py +++ b/src/Mod/Path/PathScripts/PathPost.py @@ -45,7 +45,6 @@ PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE) class _TempObject: - # pylint: disable=no-init Path = None Name = "Fixture" InList = [] @@ -54,7 +53,6 @@ class _TempObject: class DlgSelectPostProcessor: def __init__(self, parent=None): - # pylint: disable=unused-argument self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgSelectPostProcessor.ui") firstItem = None for post in PathPreferences.allEnabledPostProcessors(): @@ -91,7 +89,6 @@ class DlgSelectPostProcessor: class CommandPathPost: - # pylint: disable=no-init subpart = 1 def resolveFileName(self, job): diff --git a/src/Mod/Path/PathScripts/PathPostProcessor.py b/src/Mod/Path/PathScripts/PathPostProcessor.py index 05dcd3e83b..80820581bb 100644 --- a/src/Mod/Path/PathScripts/PathPostProcessor.py +++ b/src/Mod/Path/PathScripts/PathPostProcessor.py @@ -44,7 +44,7 @@ class PostProcessor: namespace = {} #can't modify function local scope with exec in python3 - exec("import %s as current_post" % postname, namespace) # pylint: disable=exec-used + exec("import %s as current_post" % postname, namespace) current_post = namespace['current_post'] # make sure the script is reloaded if it was previously loaded @@ -53,11 +53,11 @@ class PostProcessor: # resulting in 2 load messages if the script outputs one of those. try: # Python 2.7 - exec("reload(%s)" % 'current_post') # pylint: disable=exec-used + exec("reload(%s)" % 'current_post') except NameError: # Python 3.4+ - from importlib import reload # pylint: disable=redefined-builtin,unused-import - exec("reload(%s)" % 'current_post') # pylint: disable=exec-used + from importlib import reload + exec("reload(%s)" % 'current_post') sys.path = syspath diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index f1b2d4d8a2..fdb08fac8f 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -208,7 +208,7 @@ def postProcessorBlacklist(): blacklist = pref.GetString(PostProcessorBlacklist, "") if not blacklist: return [] - return eval(blacklist) # pylint: disable=eval-used + return eval(blacklist) def setPostProcessorDefaults(processor, args, blacklist): diff --git a/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py b/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py index ce00ad56e9..18fa63336f 100644 --- a/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py +++ b/src/Mod/Path/PathScripts/PathPreferencesPathDressup.py @@ -35,7 +35,6 @@ def RegisterDressup(dressup): class DressupPreferencesPage: def __init__(self, parent=None): - # pylint: disable=unused-argument self.form = QtGui.QToolBox() self.form.setWindowTitle(translate("Path_PreferencesPathDressup", "Dressups")) pages = [] diff --git a/src/Mod/Path/PathScripts/PathPreferencesPathJob.py b/src/Mod/Path/PathScripts/PathPreferencesPathJob.py index eba1549363..15eb42380d 100644 --- a/src/Mod/Path/PathScripts/PathPreferencesPathJob.py +++ b/src/Mod/Path/PathScripts/PathPreferencesPathJob.py @@ -37,7 +37,6 @@ PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) class JobPreferencesPage: def __init__(self, parent=None): - # pylint: disable=unused-argument import FreeCADGui self.form = FreeCADGui.PySideUic.loadUi(":preferences/PathJob.ui") self.form.toolBox.setCurrentIndex(0) # Take that qt designer! diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 554345e239..7e79c2a0f8 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -478,7 +478,7 @@ class ObjectProfile(PathAreaOp.ObjectOp): shapeEnv = PathUtils.getEnvelope( profileshape, depthparams=custDepthparams ) - except Exception as ee: # pylint: disable=broad-except + except Exception as ee: # PathUtils.getEnvelope() failed to return an object. msg = translate("PathProfile", "Unable to create path for face(s).") PathLog.error(msg + "\n{}".format(ee)) @@ -512,7 +512,7 @@ class ObjectProfile(PathAreaOp.ObjectOp): else: shapes.extend(self._processEachModel(obj)) - self.removalshapes = shapes # pylint: disable=attribute-defined-outside-init + self.removalshapes = shapes PathLog.debug("%d shapes" % len(shapes)) # Delete the temporary objects diff --git a/src/Mod/Path/PathScripts/PathProperty.py b/src/Mod/Path/PathScripts/PathProperty.py index 7e3eeb1e6f..e6c8fe3877 100644 --- a/src/Mod/Path/PathScripts/PathProperty.py +++ b/src/Mod/Path/PathScripts/PathProperty.py @@ -83,7 +83,7 @@ class PropertyEnumeration(Property): def setValue(self, value): if list == type(value): - self.enums = value # pylint: disable=attribute-defined-outside-init + self.enums = value else: super(PropertyEnumeration, self).setValue(value) diff --git a/src/Mod/Path/PathScripts/PathPropertyBagGui.py b/src/Mod/Path/PathScripts/PathPropertyBagGui.py index 81d59fac09..464bab015b 100644 --- a/src/Mod/Path/PathScripts/PathPropertyBagGui.py +++ b/src/Mod/Path/PathScripts/PathPropertyBagGui.py @@ -69,15 +69,12 @@ class ViewProvider(object): return None def __setstate__(self, state): - # pylint: disable=unused-argument return None def getDisplayMode(self, mode): - # pylint: disable=unused-argument return "Default" def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument PathLog.track() taskPanel = TaskPanel(vobj) FreeCADGui.Control.closeDialog() @@ -86,7 +83,6 @@ class ViewProvider(object): return True def unsetEdit(self, vobj, mode): - # pylint: disable=unused-argument FreeCADGui.Control.closeDialog() return @@ -106,7 +102,6 @@ class Delegate(QtGui.QStyledItemDelegate): # #PathLog.track(index.column(), type(option)) def createEditor(self, parent, option, index): - # pylint: disable=unused-argument editor = PathPropertyEditor.Editor( index.data(self.RoleObject), index.data(self.RoleProperty) ) @@ -118,14 +113,12 @@ class Delegate(QtGui.QStyledItemDelegate): index.data(self.RoleEditor).setEditorData(widget) def setModelData(self, widget, model, index): - # pylint: disable=unused-argument PathLog.track(index.row(), index.column()) editor = index.data(self.RoleEditor) editor.setModelData(widget) index.model().setData(index, editor.displayString(), QtCore.Qt.DisplayRole) def updateEditorGeometry(self, widget, option, index): - # pylint: disable=unused-argument widget.setGeometry(option.rect) diff --git a/src/Mod/Path/PathScripts/PathPropertyEditor.py b/src/Mod/Path/PathScripts/PathPropertyEditor.py index afc7f1e54d..8a88862bd5 100644 --- a/src/Mod/Path/PathScripts/PathPropertyEditor.py +++ b/src/Mod/Path/PathScripts/PathPropertyEditor.py @@ -49,18 +49,18 @@ class _PropertyEditor(object): def widget(self, parent): """widget(parent) ... called by the delegate to get a new editor widget. Must be implemented by subclasses and return the widget.""" - pass # pylint: disable=unnecessary-pass + pass def setEditorData(self, widget): """setEditorData(widget) ... called by the delegate to initialize the editor. The widget is the object returned by widget(). Must be implemented by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def setModelData(self, widget): """setModelData(widget) ... called by the delegate to store new values. Must be implemented by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def propertyValue(self): return self.obj.getPropertyByName(self.prop) diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py index 18a1c710ea..730fd06c1f 100644 --- a/src/Mod/Path/PathScripts/PathSelection.py +++ b/src/Mod/Path/PathScripts/PathSelection.py @@ -35,17 +35,16 @@ PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) class PathBaseGate(object): - # pylint: disable=no-init pass class EGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): return sub and sub[0:4] == "Edge" class MESHGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): return obj.TypeId[0:4] == "Mesh" @@ -53,7 +52,7 @@ class VCARVEGate: def allow(self, doc, obj, sub): try: shape = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False if math.fabs(shape.Volume) < 1e-9 and len(shape.Wires) > 0: @@ -79,10 +78,10 @@ class VCARVEGate: class ENGRAVEGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): try: shape = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False if math.fabs(shape.Volume) < 1e-9 and len(shape.Wires) > 0: @@ -100,10 +99,10 @@ class ENGRAVEGate(PathBaseGate): class CHAMFERGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): try: shape = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False if math.fabs(shape.Volume) < 1e-9 and len(shape.Wires) > 0: @@ -123,7 +122,7 @@ class CHAMFERGate(PathBaseGate): class DRILLGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): PathLog.debug("obj: {} sub: {}".format(obj, sub)) if not hasattr(obj, "Shape") and sub: return False @@ -137,12 +136,12 @@ class DRILLGate(PathBaseGate): class FACEGate( PathBaseGate ): # formerly PROFILEGate class using allow_ORIG method as allow() - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): profileable = False try: obj = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False if obj.ShapeType == "Compound": @@ -158,12 +157,12 @@ class FACEGate( return profileable - def allow_ORIG(self, doc, obj, sub): # pylint: disable=unused-argument + def allow_ORIG(self, doc, obj, sub): profileable = False try: obj = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False if obj.ShapeType == "Edge": @@ -193,13 +192,13 @@ class FACEGate( class PROFILEGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): if sub and sub[0:4] == "Edge": return True try: obj = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False if obj.ShapeType == "Compound": @@ -220,12 +219,12 @@ class PROFILEGate(PathBaseGate): class POCKETGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): pocketable = False try: obj = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False if obj.ShapeType == "Edge": @@ -246,19 +245,19 @@ class POCKETGate(PathBaseGate): class ADAPTIVEGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): adaptive = True try: obj = obj.Shape - except Exception: # pylint: disable=broad-except + except Exception: return False return adaptive class CONTOURGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): pass @@ -268,7 +267,7 @@ class PROBEGate: class TURNGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): PathLog.debug("obj: {} sub: {}".format(obj, sub)) if hasattr(obj, "Shape") and sub: shape = obj.Shape @@ -279,7 +278,7 @@ class TURNGate(PathBaseGate): class ALLGate(PathBaseGate): - def allow(self, doc, obj, sub): # pylint: disable=unused-argument + def allow(self, doc, obj, sub): if sub and sub[0:6] == "Vertex": return True if sub and sub[0:4] == "Edge": diff --git a/src/Mod/Path/PathScripts/PathSetupSheet.py b/src/Mod/Path/PathScripts/PathSetupSheet.py index e5d84ddf7d..027eea73da 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheet.py +++ b/src/Mod/Path/PathScripts/PathSetupSheet.py @@ -43,7 +43,6 @@ else: class Template: - # pylint: disable=no-init HorizRapid = "HorizRapid" VertRapid = "VertRapid" diff --git a/src/Mod/Path/PathScripts/PathSetupSheetGui.py b/src/Mod/Path/PathScripts/PathSetupSheetGui.py index 4747219bd2..7bc654af45 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheetGui.py +++ b/src/Mod/Path/PathScripts/PathSetupSheetGui.py @@ -71,15 +71,12 @@ class ViewProvider: return None def __setstate__(self, state): - # pylint: disable=unused-argument return None def getDisplayMode(self, mode): - # pylint: disable=unused-argument return "Default" def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument PathLog.track() taskPanel = TaskPanel(vobj) FreeCADGui.Control.closeDialog() @@ -88,7 +85,6 @@ class ViewProvider: return True def unsetEdit(self, vobj, mode): - # pylint: disable=unused-argument FreeCADGui.Control.closeDialog() return @@ -104,7 +100,6 @@ class Delegate(QtGui.QStyledItemDelegate): EditorRole = QtCore.Qt.UserRole + 2 def createEditor(self, parent, option, index): - # pylint: disable=unused-argument if index.data(self.EditorRole) is None: editor = PathSetupSheetOpPrototypeGui.Editor(index.data(self.PropertyRole)) index.model().setData(index, editor, self.EditorRole) @@ -115,14 +110,12 @@ class Delegate(QtGui.QStyledItemDelegate): index.data(self.EditorRole).setEditorData(widget) def setModelData(self, widget, model, index): - # pylint: disable=unused-argument PathLog.track(index.row(), index.column()) editor = index.data(self.EditorRole) editor.setModelData(widget) index.model().setData(index, editor.prop.displayString(), QtCore.Qt.DisplayRole) def updateEditorGeometry(self, widget, option, index): - # pylint: disable=unused-argument widget.setGeometry(option.rect) @@ -151,7 +144,6 @@ class OpTaskPanel: self.model = None def updateData(self, topLeft, bottomRight): - # pylint: disable=unused-argument if 0 == topLeft.column(): isset = self.model.item(topLeft.row(), 0).checkState() == QtCore.Qt.Checked self.model.item(topLeft.row(), 1).setEnabled(isset) diff --git a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py index bb007e5658..03c7fbdb18 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py +++ b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py @@ -83,7 +83,7 @@ class PropertyEnumeration(Property): def setValue(self, value): if list == type(value): - self.enums = value # pylint: disable=attribute-defined-outside-init + self.enums = value else: super(PropertyEnumeration, self).setValue(value) diff --git a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py index aa5205961d..eefc4083eb 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py +++ b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py @@ -50,18 +50,18 @@ class _PropertyEditor(object): def widget(self, parent): """widget(parent) ... called by the delegate to get a new editor widget. Must be implemented by subclasses and return the widget.""" - pass # pylint: disable=unnecessary-pass + pass def setEditorData(self, widget): """setEditorData(widget) ... called by the delegate to initialize the editor. The widget is the object returned by widget(). Must be implemented by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass def setModelData(self, widget): """setModelData(widget) ... called by the delegate to store new values. Must be implemented by subclasses.""" - pass # pylint: disable=unnecessary-pass + pass class _PropertyEnumEditor(_PropertyEditor): diff --git a/src/Mod/Path/PathScripts/PathSimpleCopy.py b/src/Mod/Path/PathScripts/PathSimpleCopy.py index 135edc4fe8..62e269408f 100644 --- a/src/Mod/Path/PathScripts/PathSimpleCopy.py +++ b/src/Mod/Path/PathScripts/PathSimpleCopy.py @@ -46,7 +46,7 @@ class CommandPathSimpleCopy: try: obj = FreeCADGui.Selection.getSelectionEx()[0].Object return isinstance(obj.Proxy, PathScripts.PathOp.ObjectOp) - except Exception: # pylint: disable=broad-except + except Exception: return False def Activated(self): diff --git a/src/Mod/Path/PathScripts/PathSlotGui.py b/src/Mod/Path/PathScripts/PathSlotGui.py index 1c620d4c57..3162844f8b 100644 --- a/src/Mod/Path/PathScripts/PathSlotGui.py +++ b/src/Mod/Path/PathScripts/PathSlotGui.py @@ -56,7 +56,6 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def initPage(self, obj): """initPage(obj) ... Is called after getForm() to initiate the task panel.""" debugMsg("initPage()") - # pylint: disable=attribute-defined-outside-init self.CATS = [None, None] self.propEnums = PathSlot.ObjectSlot.propertyEnumerations(dataType="raw") self.ENUMS = dict() diff --git a/src/Mod/Path/PathScripts/PathStock.py b/src/Mod/Path/PathScripts/PathStock.py index 685fe1de94..b4eedbcf2c 100644 --- a/src/Mod/Path/PathScripts/PathStock.py +++ b/src/Mod/Path/PathScripts/PathStock.py @@ -43,7 +43,6 @@ else: class StockType: - # pylint: disable=no-init NoStock = "None" FromBase = "FromBase" diff --git a/src/Mod/Path/PathScripts/PathStop.py b/src/Mod/Path/PathScripts/PathStop.py index ba79ee605d..196c9ce74a 100644 --- a/src/Mod/Path/PathScripts/PathStop.py +++ b/src/Mod/Path/PathScripts/PathStop.py @@ -91,7 +91,6 @@ class _ViewProviderStop: return ":/icons/Path_Stop.svg" def onChanged(self, vobj, prop): # optional - # pylint: disable=unused-argument mode = 2 vobj.setEditorMode("LineWidth", mode) vobj.setEditorMode("MarkerColor", mode) diff --git a/src/Mod/Path/PathScripts/PathThreadMillingGui.py b/src/Mod/Path/PathScripts/PathThreadMillingGui.py index 23ae4b449b..080835555b 100644 --- a/src/Mod/Path/PathScripts/PathThreadMillingGui.py +++ b/src/Mod/Path/PathScripts/PathThreadMillingGui.py @@ -68,13 +68,13 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage): def initPage(self, obj): self.majorDia = PathGui.QuantitySpinBox( self.form.threadMajor, obj, "MajorDiameter" - ) # pylint: disable=attribute-defined-outside-init + ) self.minorDia = PathGui.QuantitySpinBox( self.form.threadMinor, obj, "MinorDiameter" - ) # pylint: disable=attribute-defined-outside-init + ) self.pitch = PathGui.QuantitySpinBox( self.form.threadPitch, obj, "Pitch" - ) # pylint: disable=attribute-defined-outside-init + ) # setupCombo(self.form.threadOrientation, obj.Proxy.ThreadOrientations) # setupCombo(self.form.threadType, obj.Proxy.ThreadTypes) diff --git a/src/Mod/Path/PathScripts/PathToolBitGui.py b/src/Mod/Path/PathScripts/PathToolBitGui.py index 14c877c756..c5efb283b9 100644 --- a/src/Mod/Path/PathScripts/PathToolBitGui.py +++ b/src/Mod/Path/PathScripts/PathToolBitGui.py @@ -75,7 +75,6 @@ class ViewProvider(object): return None def __setstate__(self, state): - # pylint: disable=unused-argument return None def onDelete(self, vobj, arg2=None): @@ -83,7 +82,6 @@ class ViewProvider(object): vobj.Object.Proxy.onDelete(vobj.Object) def getDisplayMode(self, mode): - # pylint: disable=unused-argument return "Default" def _openTaskPanel(self, vobj, deleteOnReject): @@ -98,12 +96,10 @@ class ViewProvider(object): self._openTaskPanel(vobj, True) def setEdit(self, vobj, mode=0): - # pylint: disable=unused-argument self._openTaskPanel(vobj, False) return True def unsetEdit(self, vobj, mode): - # pylint: disable=unused-argument FreeCADGui.Control.closeDialog() self.panel = None return diff --git a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py index 84d0ff7ad9..b8cca4da6c 100644 --- a/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py +++ b/src/Mod/Path/PathScripts/PathToolBitLibraryGui.py @@ -221,7 +221,6 @@ class _TableView(PySide.QtGui.QTableView): stream = PySide.QtCore.QDataStream(data) srcRows = [] while not stream.atEnd(): - # pylint: disable=unused-variable row = stream.readInt32() srcRows.append(row) diff --git a/src/Mod/Path/PathScripts/PathToolController.py b/src/Mod/Path/PathScripts/PathToolController.py index 00df54f7fc..c0c543ba42 100644 --- a/src/Mod/Path/PathScripts/PathToolController.py +++ b/src/Mod/Path/PathScripts/PathToolController.py @@ -155,7 +155,6 @@ class ToolController: obj.setEditorMode("Placement", 2) def onDelete(self, obj, arg2=None): - # pylint: disable=unused-argument if not self.usesLegacyTool(obj): if hasattr(obj.Tool, "InList") and len(obj.Tool.InList) == 1: if hasattr(obj.Tool.Proxy, "onDelete"): @@ -372,7 +371,6 @@ def Create( def FromTemplate(template, assignViewProvider=True): - # pylint: disable=unused-argument PathLog.track() name = template.get(ToolControllerTemplate.Name, ToolControllerTemplate.Label) diff --git a/src/Mod/Path/PathScripts/PathToolControllerGui.py b/src/Mod/Path/PathScripts/PathToolControllerGui.py index a2e23aa651..fbc4fb92e0 100644 --- a/src/Mod/Path/PathScripts/PathToolControllerGui.py +++ b/src/Mod/Path/PathScripts/PathToolControllerGui.py @@ -75,7 +75,6 @@ class ViewProvider: return ":/icons/Path_ToolController.svg" def onChanged(self, vobj, prop): - # pylint: disable=unused-argument mode = 2 vobj.setEditorMode("LineWidth", mode) vobj.setEditorMode("MarkerColor", mode) @@ -85,14 +84,12 @@ class ViewProvider: vobj.setEditorMode("Selectable", mode) def onDelete(self, vobj, args=None): - # pylint: disable=unused-argument PathUtil.clearExpressionEngine(vobj.Object) self.vobj.Object.Proxy.onDelete(vobj.Object, args) return True def updateData(self, vobj, prop): # this is executed when a property of the APP OBJECT changes - # pylint: disable=unused-argument pass def setEdit(self, vobj=None, mode=0): @@ -111,11 +108,9 @@ class ViewProvider: def unsetEdit(self, vobj, mode): # this is executed when the user cancels or terminates edit mode - # pylint: disable=unused-argument return False def setupContextMenu(self, vobj, menu): - # pylint: disable=unused-argument PathLog.track() for action in menu.actions(): menu.removeAction(action) @@ -143,7 +138,6 @@ def Create(name="Default Tool", tool=None, toolNumber=1): class CommandPathToolController(object): - # pylint: disable=no-init def GetResources(self): return { @@ -331,12 +325,10 @@ class TaskPanel: self.toolrep.Shape = t def edit(self, item, column): - # pylint: disable=unused-argument if not self.updating: self.resetObject() def resetObject(self, remove=None): - # pylint: disable=unused-argument "transfers the values from the widget to the object" FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Path/PathScripts/PathToolLibraryManager.py b/src/Mod/Path/PathScripts/PathToolLibraryManager.py index cd5320a5c0..36c298c821 100644 --- a/src/Mod/Path/PathScripts/PathToolLibraryManager.py +++ b/src/Mod/Path/PathScripts/PathToolLibraryManager.py @@ -424,7 +424,7 @@ class ToolLibraryManager: else: return False - except Exception as e: # pylint: disable=broad-except + except Exception as e: print("could not parse file", e) def write(self, filename, listname): @@ -472,7 +472,7 @@ class ToolLibraryManager: fp.close() print("Written ", PathUtil.toUnicode(fname)) - except Exception as e: # pylint: disable=broad-except + except Exception as e: print("Could not write file:", e) def addnew(self, listname, tool, position=None): diff --git a/src/Mod/Path/PathScripts/PathUtil.py b/src/Mod/Path/PathScripts/PathUtil.py index 5f2c8b9bdc..19657f6d83 100644 --- a/src/Mod/Path/PathScripts/PathUtil.py +++ b/src/Mod/Path/PathScripts/PathUtil.py @@ -66,7 +66,7 @@ def _getProperty(obj, prop): def getProperty(obj, prop): """getProperty(obj, prop) ... answer obj's property defined by its canonical name.""" - o, attr, name = _getProperty(obj, prop) # pylint: disable=unused-variable + o, attr, name = _getProperty(obj, prop) return attr @@ -80,7 +80,7 @@ def getPropertyValueString(obj, prop): def setProperty(obj, prop, value): """setProperty(obj, prop, value) ... set the property value of obj's property defined by its canonical name.""" - o, attr, name = _getProperty(obj, prop) # pylint: disable=unused-variable + o, attr, name = _getProperty(obj, prop) if not attr is None and type(value) == str: if type(attr) == int: value = int(value, 0) @@ -156,7 +156,7 @@ def clearExpressionEngine(obj): is deleted that still has one or more expressions attached to it. Use this function to remove all expressions before deletion.""" if hasattr(obj, "ExpressionEngine"): - for attr, expr in obj.ExpressionEngine: # pylint: disable=unused-variable + for attr, expr in obj.ExpressionEngine: obj.setExpression(attr, None) diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index 4a4e837673..1153ab2cde 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -358,7 +358,7 @@ def getToolControllers(obj, proxy=None): proxy = obj.Proxy try: job = findParentJob(obj) - except Exception: # pylint: disable=broad-except + except Exception: job = None PathLog.debug("op={} ({})".format(obj.Label, type(obj))) @@ -485,7 +485,7 @@ def sort_locations(locations, keys, attractors=None): # prevent dictionary comparison by inserting the index q.put((dist(j, location) + weight(j), i, j)) - prio, i, result = q.get() # pylint: disable=unused-variable + prio, i, result = q.get() return result diff --git a/src/Mod/Path/PathScripts/PathWaterline.py b/src/Mod/Path/PathScripts/PathWaterline.py index 071773ad61..0e54b52bf8 100644 --- a/src/Mod/Path/PathScripts/PathWaterline.py +++ b/src/Mod/Path/PathScripts/PathWaterline.py @@ -2260,7 +2260,7 @@ class ObjectWaterline(PathOp.ObjectOp): PathLog.track() paths = [] - pathParams = {} # pylint: disable=assignment-from-no-return + pathParams = {} pathParams["shapes"] = [wire] pathParams["feedrate"] = self.horizFeed @@ -2276,7 +2276,7 @@ class ObjectWaterline(PathOp.ObjectOp): (pp, end_vector) = Path.fromShapes(**pathParams) paths.extend(pp.Commands) - self.endVector = end_vector # pylint: disable=attribute-defined-outside-init + self.endVector = end_vector return (paths, end_vector) diff --git a/src/Mod/Path/PathScripts/post/centroid_post.py b/src/Mod/Path/PathScripts/post/centroid_post.py index 00c9c3244c..40f45bab02 100644 --- a/src/Mod/Path/PathScripts/post/centroid_post.py +++ b/src/Mod/Path/PathScripts/post/centroid_post.py @@ -122,7 +122,6 @@ if open.__module__ in ['__builtin__', 'io']: def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -161,7 +160,6 @@ def processArguments(argstring): def export(objectslist, filename, argstring): - # pylint: disable=global-statement processArguments(argstring) for i in objectslist: print(i.Name) @@ -237,7 +235,6 @@ def export(objectslist, filename, argstring): def linenumber(): - # pylint: disable=global-statement global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 10 diff --git a/src/Mod/Path/PathScripts/post/comparams_post.py b/src/Mod/Path/PathScripts/post/comparams_post.py index 6845371053..2f31093e3d 100644 --- a/src/Mod/Path/PathScripts/post/comparams_post.py +++ b/src/Mod/Path/PathScripts/post/comparams_post.py @@ -79,7 +79,6 @@ def lineout(command, oldvals, modal): def export(obj, filename, argstring): - # pylint: disable=unused-argument modal = True gcode = '' safetyblock1 = 'G90G40G49\n' diff --git a/src/Mod/Path/PathScripts/post/dumper_post.py b/src/Mod/Path/PathScripts/post/dumper_post.py index efa8262e07..fdd88cbf38 100644 --- a/src/Mod/Path/PathScripts/post/dumper_post.py +++ b/src/Mod/Path/PathScripts/post/dumper_post.py @@ -42,7 +42,6 @@ if open.__module__ in ['__builtin__','io']: def export(objectslist, filename,argstring): "called when freecad exports a list of objects" - # pylint: disable=unused-argument output = '''(This output produced with the dump post processor) (Dump is useful for inspecting the raw commands in your paths) diff --git a/src/Mod/Path/PathScripts/post/dynapath_post.py b/src/Mod/Path/PathScripts/post/dynapath_post.py index 20fd1c65b2..908fcca876 100644 --- a/src/Mod/Path/PathScripts/post/dynapath_post.py +++ b/src/Mod/Path/PathScripts/post/dynapath_post.py @@ -149,7 +149,6 @@ if open.__module__ in ['__builtin__', 'io']: def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -186,14 +185,13 @@ def processArguments(argstring): UNIT_FORMAT = 'in' PRECISION = 4 - except Exception: # pylint: disable=broad-except + except Exception: return False return True def export(objectslist, filename, argstring): - # pylint: disable=unused-argument if not processArguments(argstring): return None global UNITS @@ -278,7 +276,7 @@ def export(objectslist, filename, argstring): def linenumber(): - global LINENR # pylint: disable=global-statement + global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 1 return "N" + str(LINENR) + " " @@ -286,7 +284,6 @@ def linenumber(): def parse(pathobj): - # pylint: disable=global-statement global PRECISION global UNIT_FORMAT global UNIT_SPEED_FORMAT diff --git a/src/Mod/Path/PathScripts/post/example_post.py b/src/Mod/Path/PathScripts/post/example_post.py index 8163008fd9..49ae88db49 100644 --- a/src/Mod/Path/PathScripts/post/example_post.py +++ b/src/Mod/Path/PathScripts/post/example_post.py @@ -42,7 +42,6 @@ if open.__module__ in ['__builtin__','io']: def export(objectslist, filename,argstring): "called when freecad exports a list of objects" - # pylint: disable=unused-argument if len(objectslist) > 1: print("This script is unable to write more than one Path object") return diff --git a/src/Mod/Path/PathScripts/post/fablin_post.py b/src/Mod/Path/PathScripts/post/fablin_post.py index fd96b4474e..2bb3ff935c 100644 --- a/src/Mod/Path/PathScripts/post/fablin_post.py +++ b/src/Mod/Path/PathScripts/post/fablin_post.py @@ -94,7 +94,6 @@ if open.__module__ in ['__builtin__', 'io']: def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -125,7 +124,6 @@ def processArguments(argstring): def export(objectslist, filename, argstring): - # pylint: disable=global-statement processArguments(argstring) global UNITS for obj in objectslist: @@ -207,7 +205,6 @@ def export(objectslist, filename, argstring): def linenumber(): - # pylint: disable=global-statement global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 10 diff --git a/src/Mod/Path/PathScripts/post/fanuc_post.py b/src/Mod/Path/PathScripts/post/fanuc_post.py index 3eee41519d..cadfa9b098 100644 --- a/src/Mod/Path/PathScripts/post/fanuc_post.py +++ b/src/Mod/Path/PathScripts/post/fanuc_post.py @@ -112,7 +112,6 @@ if open.__module__ in ['__builtin__','io']: def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -155,14 +154,13 @@ def processArguments(argstring): if args.no_axis_modal: OUTPUT_DOUBLES = True - except Exception: # pylint: disable=broad-except + except Exception: return False return True def export(objectslist, filename, argstring): - # pylint: disable=global-statement if not processArguments(argstring): return None global UNITS @@ -273,7 +271,6 @@ def export(objectslist, filename, argstring): def linenumber(): - # pylint: disable=global-statement global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 10 @@ -282,7 +279,6 @@ def linenumber(): def parse(pathobj): - # pylint: disable=global-statement global PRECISION global MODAL global OUTPUT_DOUBLES diff --git a/src/Mod/Path/PathScripts/post/jtech_post.py b/src/Mod/Path/PathScripts/post/jtech_post.py index ff9825dc46..e8a06a1ab6 100644 --- a/src/Mod/Path/PathScripts/post/jtech_post.py +++ b/src/Mod/Path/PathScripts/post/jtech_post.py @@ -111,7 +111,6 @@ if open.__module__ == '__builtin__': def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -153,7 +152,7 @@ def processArguments(argstring): OUTPUT_DOUBLES = False POWER_ON_DELAY = float(args.power_on_delay) / 1000 # milliseconds - except Exception: # pylint: disable=broad-except + except Exception: return False return True @@ -228,7 +227,7 @@ def export(objectslist, filename, argstring): def linenumber(): - global LINENR # pylint: disable=global-statement + global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 10 return "N" + str(LINENR) + " " diff --git a/src/Mod/Path/PathScripts/post/linuxcnc_post.py b/src/Mod/Path/PathScripts/post/linuxcnc_post.py index c102528d6b..760d6a22ef 100644 --- a/src/Mod/Path/PathScripts/post/linuxcnc_post.py +++ b/src/Mod/Path/PathScripts/post/linuxcnc_post.py @@ -104,7 +104,6 @@ if open.__module__ in ['__builtin__','io']: def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -148,13 +147,12 @@ def processArguments(argstring): print ('here') OUTPUT_DOUBLES = False - except Exception: # pylint: disable=broad-except + except Exception: return False return True def export(objectslist, filename, argstring): - # pylint: disable=global-statement if not processArguments(argstring): return None global UNITS @@ -261,7 +259,6 @@ def export(objectslist, filename, argstring): def linenumber(): - # pylint: disable=global-statement global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 10 @@ -270,7 +267,6 @@ def linenumber(): def parse(pathobj): - # pylint: disable=global-statement global PRECISION global MODAL global OUTPUT_DOUBLES diff --git a/src/Mod/Path/PathScripts/post/mach3_mach4_post.py b/src/Mod/Path/PathScripts/post/mach3_mach4_post.py index b34f8cae81..f210b1dae1 100644 --- a/src/Mod/Path/PathScripts/post/mach3_mach4_post.py +++ b/src/Mod/Path/PathScripts/post/mach3_mach4_post.py @@ -103,7 +103,6 @@ if open.__module__ in ['__builtin__','io']: def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -147,14 +146,13 @@ def processArguments(argstring): print ('here') OUTPUT_DOUBLES = False - except Exception: # pylint: disable=broad-except + except Exception: return False return True def export(objectslist, filename, argstring): - # pylint: disable=global-statement if not processArguments(argstring): return None global UNITS @@ -259,7 +257,6 @@ def export(objectslist, filename, argstring): def linenumber(): - # pylint: disable=global-statement global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 10 @@ -268,7 +265,6 @@ def linenumber(): def parse(pathobj): - # pylint: disable=global-statement global PRECISION global MODAL global OUTPUT_DOUBLES diff --git a/src/Mod/Path/PathScripts/post/opensbp_post.py b/src/Mod/Path/PathScripts/post/opensbp_post.py index 9a33ddec30..e58613a7cd 100644 --- a/src/Mod/Path/PathScripts/post/opensbp_post.py +++ b/src/Mod/Path/PathScripts/post/opensbp_post.py @@ -98,7 +98,6 @@ GetValue = getMetricValue def export(objectslist, filename, argstring): - # pylint: disable=global-statement global OUTPUT_COMMENTS global OUTPUT_HEADER global SHOW_EDITOR diff --git a/src/Mod/Path/PathScripts/post/philips_post.py b/src/Mod/Path/PathScripts/post/philips_post.py index 254c2dc4c5..4444b7b069 100644 --- a/src/Mod/Path/PathScripts/post/philips_post.py +++ b/src/Mod/Path/PathScripts/post/philips_post.py @@ -216,7 +216,6 @@ parser.add_argument('--no-show-editor', action='store_true', help='don\'t pop up TOOLTIP_ARGS = parser.format_help() def processArguments(argstring): - # pylint: disable=global-statement global LINENUMBERS global SHOW_EDITOR @@ -309,7 +308,7 @@ def mapGCode(command): def linenumberify(GCodeString): # add a linenumber at every beginning of line - global linenr # pylint: disable=global-statement + global linenr if not LINENUMBERS: result = GCodeString + "\n" else: @@ -327,7 +326,6 @@ def linenumberify(GCodeString): return result def export(objectslist, filename, argstring): - # pylint: disable=unused-argument,global-statement global UNITS global linenr @@ -457,7 +455,7 @@ def export(objectslist, filename, argstring): # absolute center outstring.append( '(' + param + PostUtils.fmt(c.Parameters[param], AXIS_DECIMALS, UNITS) + ')') - z = c.Parameters['Z'] # pylint: disable=unused-variable + z = c.Parameters['Z'] k = c.Parameters['K'] if USE_RADIUS_IF_POSSIBLE and angleUnder180(command, lastX, lastY, c.Parameters['X'], c.Parameters['Y'], i, j): # R is handled with the I parameter, here: diff --git a/src/Mod/Path/PathScripts/post/rml_post.py b/src/Mod/Path/PathScripts/post/rml_post.py index ad2c83c2f5..3e5e135868 100644 --- a/src/Mod/Path/PathScripts/post/rml_post.py +++ b/src/Mod/Path/PathScripts/post/rml_post.py @@ -46,7 +46,6 @@ if open.__module__ in ['__builtin__','io']: # Entrypoint used by FreeCAD def export(objectslist, filename, argstring): "Export objects as Roland Modela code." - # pylint: disable=unused-argument code = "" for obj in objectslist: diff --git a/src/Mod/Path/PathScripts/post/smoothie_post.py b/src/Mod/Path/PathScripts/post/smoothie_post.py index 34d41b3bab..6b96609db6 100644 --- a/src/Mod/Path/PathScripts/post/smoothie_post.py +++ b/src/Mod/Path/PathScripts/post/smoothie_post.py @@ -116,7 +116,6 @@ if open.__module__ in ['__builtin__', 'io']: def processArguments(argstring): - # pylint: disable=global-statement global OUTPUT_HEADER global OUTPUT_COMMENTS global OUTPUT_LINE_NUMBERS @@ -163,7 +162,7 @@ def processArguments(argstring): IP_ADDR = args.IP_ADDR VERBOSE = args.verbose - except Exception: # pylint: disable=broad-except + except Exception: return False return True @@ -171,7 +170,7 @@ def processArguments(argstring): def export(objectslist, filename, argstring): processArguments(argstring) - global UNITS # pylint: disable=global-statement + global UNITS for obj in objectslist: if not hasattr(obj, "Path"): FreeCAD.Console.PrintError("the object " + obj.Name + " is not a path. Please select only path and Compounds.\n") @@ -332,7 +331,7 @@ def sendToSmoothie(ip, GCODE, fname): def linenumber(): - global LINENR # pylint: disable=global-statement + global LINENR if OUTPUT_LINE_NUMBERS is True: LINENR += 10 return "N" + str(LINENR) + " " @@ -340,7 +339,7 @@ def linenumber(): def parse(pathobj): - global SPINDLE_SPEED # pylint: disable=global-statement + global SPINDLE_SPEED out = "" lastcommand = None diff --git a/src/Mod/Path/PathTests/TestPathDressupDogbone.py b/src/Mod/Path/PathTests/TestPathDressupDogbone.py index 68a213ccc4..a0f919c1f9 100644 --- a/src/Mod/Path/PathTests/TestPathDressupDogbone.py +++ b/src/Mod/Path/PathTests/TestPathDressupDogbone.py @@ -42,7 +42,6 @@ class TestFeature: self.Path = Path.Path() def addProperty(self, typ, nam, category, tip): - # pylint: disable=unused-argument setattr(self, nam, None) def setEditorMode(self, prop, mode): diff --git a/src/Mod/Path/PathTests/TestPathLog.py b/src/Mod/Path/PathTests/TestPathLog.py index 281d40e0a6..bb85f78a63 100644 --- a/src/Mod/Path/PathTests/TestPathLog.py +++ b/src/Mod/Path/PathTests/TestPathLog.py @@ -33,11 +33,11 @@ class TestPathLog(unittest.TestCase): PathLog.untrackAllModules() def callerFile(self): - return PathLog._caller()[0] # pylint: disable=protected-access + return PathLog._caller()[0] def callerLine(self): - return PathLog._caller()[1] # pylint: disable=protected-access + return PathLog._caller()[1] def callerFunc(self): - return PathLog._caller()[2] # pylint: disable=protected-access + return PathLog._caller()[2] def test00(self): """Check for proper module extraction.""" diff --git a/src/Mod/Path/PathTests/TestPathOpTools.py b/src/Mod/Path/PathTests/TestPathOpTools.py index bcd52de228..eed0eee99e 100644 --- a/src/Mod/Path/PathTests/TestPathOpTools.py +++ b/src/Mod/Path/PathTests/TestPathOpTools.py @@ -81,7 +81,7 @@ class TestPathOpTools(PathTestUtils.PathTestBase): @classmethod def setUpClass(cls): - global doc # pylint: disable=global-statement + global doc doc = FreeCAD.openDocument(FreeCAD.getHomePath() + 'Mod/Path/PathTests/test_geomop.fcstd') @classmethod diff --git a/src/Mod/Path/utils/path-lint.sh b/src/Mod/Path/utils/path-lint.sh deleted file mode 100755 index e1183a7eef..0000000000 --- a/src/Mod/Path/utils/path-lint.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash -# *************************************************************************** -# * Copyright (c) 2017 sliptonic * -# * * -# * This program is free software; you can redistribute it and/or modify * -# * it under the terms of the GNU Lesser General Public License (LGPL) * -# * as published by the Free Software Foundation; either version 2 of * -# * the License, or (at your option) any later version. * -# * for detail see the LICENCE text file. * -# * * -# * This program is distributed in the hope that it will be useful, * -# * but WITHOUT ANY WARRANTY; without even the implied warranty of * -# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -# * GNU Library General Public License for more details. * -# * * -# * You should have received a copy of the GNU Library General Public * -# * License along with this program; if not, write to the Free Software * -# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -# * USA * -# * * -# *************************************************************************** - -# Script to run pylint on Path. Currently only checks for errors. - -if [ 'utils' == $(basename ${PWD}) ]; then - cd .. -elif [ 'PathScripts' == $(basename ${PWD}) ]; then - cd .. -elif [ 'PathTests' == $(basename ${PWD}) ]; then - cd .. -elif [ -d 'src/Mod/Path' ]; then - cd src/Mod/Path -elif [ -d 'Mod/Path' ]; then - cd Mod/Path -elif [ -d 'Path' ]; then - cd Path -fi - -if [ ! -d 'PathScripts' ]; then - echo "Cannot determine source directory, please call from within Path source directory." - exit 2 -fi - -EXTERNAL_MODULES+=' ArchPanel' -EXTERNAL_MODULES+=' Draft' -EXTERNAL_MODULES+=' DraftGeomUtils' -EXTERNAL_MODULES+=' DraftVecUtils' -EXTERNAL_MODULES+=' FreeCAD' -EXTERNAL_MODULES+=' FreeCADGui' -EXTERNAL_MODULES+=' Mesh' -EXTERNAL_MODULES+=' MeshPart' -EXTERNAL_MODULES+=' Part' -EXTERNAL_MODULES+=' Path' -EXTERNAL_MODULES+=' PySide' -EXTERNAL_MODULES+=' PySide.QtCore' -EXTERNAL_MODULES+=' PySide.QtGui' -EXTERNAL_MODULES+=' Sketcher' -EXTERNAL_MODULES+=' TechDraw' -EXTERNAL_MODULES+=' TestSketcherApp' -EXTERNAL_MODULES+=' area' -EXTERNAL_MODULES+=' importlib' -EXTERNAL_MODULES+=' ocl' -EXTERNAL_MODULES+=' pivy' - -IGNORE_MODULES+=' grbl_post.py' -IGNORE_MODULES+=' PathSimulatorGui.py' -IGNORE_MODULES+=' PathSurface.py' - -#ARGS+=" --errors-only" -ARGS+=" --disable=C,R" -ARGS+=" --ignored-modules=$(echo ${EXTERNAL_MODULES} | tr ' ' ',')" -if [ -n "${IGNORE_MODULES}" ]; then - ARGS+=" --ignore=$(echo ${IGNORE_MODULES} | tr ' ' ',')" -fi -ARGS+=" --jobs=0" - -if [ -z "$(which pylint3)" ]; then - echo "Cannot find pylint, please install and try again!" - exit 1 -fi - -pylint3 ${ARGS} PathScripts/ PathTests/ -#pylint3 ${ARGS} PathScripts/ -#pylint3 ${ARGS} PathTests/ -