Skip to content

Commit

Permalink
switched to pylint3 and fixed additional warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mlampert committed Jul 1, 2019
1 parent 04b4db1 commit f34ac89
Show file tree
Hide file tree
Showing 18 changed files with 55 additions and 53 deletions.
7 changes: 5 additions & 2 deletions src/Mod/Path/PathScripts/PathCircularHoleBase.py
Expand Up @@ -85,6 +85,7 @@ def opFeatures(self, obj):
def circularHoleFeatures(self, obj):
'''circularHoleFeatures(obj) ... overwrite to add operations specific features.
Can safely be overwritten by subclasses.'''
# pylint: disable=unused-argument
return 0

def initOperation(self, obj):
Expand All @@ -97,10 +98,11 @@ def initOperation(self, obj):
def initCircularHoleOperation(self, obj):
'''initCircularHoleOperation(obj) ... overwrite if the subclass needs initialisation.
Can safely be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-pass

def baseIsArchPanel(self, obj, base):
'''baseIsArchPanel(obj, base) ... return true if op deals with an Arch.Panel.'''
# pylint: disable=unused-argument
return hasattr(base, "Proxy") and isinstance(base.Proxy, ArchPanel.PanelSheet)

def getArchPanelEdge(self, obj, base, sub):
Expand All @@ -112,6 +114,7 @@ def getArchPanelEdge(self, obj, base, sub):
Obviously this is as fragile as can be, but currently the best we can do while the panel sheets
hide the actual features from Path and they can't be referenced directly.
'''
# pylint: disable=unused-argument
ids = sub.split(".")
holeId = int(ids[0])
wireId = int(ids[1])
Expand Down Expand Up @@ -355,7 +358,7 @@ def circularHoleExecute(self, obj, holes):
holes is a list of dictionaries with 'x', 'y' and 'r' specified for each hole.
Note that for Vertexes, non-circular Edges and Locations r=0.
Must be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-pass

def findAllHoles(self, obj):
if not self.getJob(obj):
Expand Down
10 changes: 5 additions & 5 deletions src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py
Expand Up @@ -57,15 +57,15 @@ def getForm(self):
return FreeCADGui.PySideUic.loadUi(":/panels/PageBaseHoleGeometryEdit.ui")

def initPage(self, obj):
self.updating = False
self.updating = False # pylint: disable=attribute-defined-outside-init

def setFields(self, obj):
'''setFields(obj) ... fill form with values from obj'''
PathLog.track()
self.form.baseList.blockSignals(True)
self.form.baseList.clearContents()
self.form.baseList.setRowCount(0)
for i, (base, subs) in enumerate(obj.Base):
for (base, subs) in obj.Base:
for sub in subs:
self.form.baseList.insertRow(self.form.baseList.rowCount())

Expand Down Expand Up @@ -126,7 +126,7 @@ def deleteBase(self):
self.form.baseList.blockSignals(False)
#self.obj.Proxy.execute(self.obj)
FreeCAD.ActiveDocument.recompute()
self.setFields(self.obj);
self.setFields(self.obj)

def updateBase(self):
'''updateBase() ... helper function to transfer current table to obj'''
Expand All @@ -140,9 +140,9 @@ def updateBase(self):
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
self.updating = True # pylint: disable=attribute-defined-outside-init
self.obj.Base = newlist
self.updating = False
self.updating = False # pylint: disable=attribute-defined-outside-init

def checkedChanged(self):
'''checkeChanged() ... callback when checked status of a base feature changed'''
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Path/PathScripts/PathDressupTag.py
Expand Up @@ -29,7 +29,6 @@
import PathScripts.PathLog as PathLog
import PathScripts.PathUtils as PathUtils
import math
import sys

from PathScripts.PathDressupTagPreferences import HoldingTagPreferences
from PySide import QtCore
Expand All @@ -42,6 +41,7 @@
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)

MaxInt = 99999999999999

class TagSolid:
def __init__(self, proxy, z, R):
Expand Down Expand Up @@ -164,11 +164,11 @@ def execute(self, obj):

self.obj = obj

minZ = +sys.maxint
minZ = +MaxInt
minX = minZ
minY = minZ

maxZ = -sys.maxint
maxZ = -MaxInt
maxX = maxZ
maxY = maxZ

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathGuiInit.py
Expand Up @@ -21,7 +21,7 @@
# * USA *
# * *
# ***************************************************************************
# pylint: disable=unused-variable
# pylint: disable=unused-import

import PathScripts.PathLog as PathLog

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathJobGui.py
Expand Up @@ -296,7 +296,7 @@ def showHide(widget, activeWidget):
widget.hide()
if select:
self.form.stock.setCurrentIndex(self.Index)
editor = self.editorFrame()
editor = self.editorFrame() # pylint: disable=assignment-from-none
showHide(self.form.stockFromExisting, editor)
showHide(self.form.stockFromBase, editor)
showHide(self.form.stockCreateBox, editor)
Expand Down
14 changes: 7 additions & 7 deletions src/Mod/Path/PathScripts/PathOp.py
Expand Up @@ -238,12 +238,12 @@ def opFeatures(self, obj):
def initOperation(self, obj):
'''initOperation(obj) ... implement to create additional properties.
Should be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-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
pass # pylint: disable=unnecessary-pass

def opOnChanged(self, obj, prop):
'''opOnChanged(obj, prop) ... overwrite to process property changes.
Expand All @@ -252,24 +252,24 @@ def opOnChanged(self, obj, prop):
distinguish between assigning a different value and assigning the same
value again.
Can safely be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-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
pass # pylint: disable=unnecessary-pass

def opUpdateDepths(self, obj):
'''opUpdateDepths(obj) ... overwrite to implement special depths calculation.
Can safely be overwritten by subclass.'''
pass
pass # pylint: disable=unnecessary-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
pass # pylint: disable=unnecessary-pass

def opRejectAddBase(self, obj, base, sub):
'''opRejectAddBase(base, sub) ... if op returns True the addition of the feature is prevented.
Expand Down Expand Up @@ -491,7 +491,7 @@ def execute(self, obj):
if obj.Comment:
self.commandlist.append(Path.Command("(%s)" % obj.Comment))

result = self.opExecute(obj)
result = self.opExecute(obj) # pylint: disable=assignment-from-no-return

if FeatureHeights & self.opFeatures(obj):
# Let's finish by rapid to clearance...just for safety
Expand Down
24 changes: 11 additions & 13 deletions src/Mod/Path/PathScripts/PathOpGui.py
Expand Up @@ -198,7 +198,7 @@ def __init__(self, obj, features):
'''__init__(obj, features) ... framework initialisation.
Do not overwrite, implement initPage(obj) instead.'''
self.obj = obj
self.form = self.getForm()
self.form = self.getForm() # pylint: disable=assignment-from-no-return
self.signalDirtyChanged = None
self.setClean()
self.setTitle('-')
Expand Down Expand Up @@ -278,32 +278,32 @@ def initPage(self, obj):
Note that this function is invoked after all page controllers have been created.
Should be overwritten by subclasses.'''
# pylint: disable=unused-argument
pass
pass # pylint: disable=unnecessary-pass

def cleanupPage(self, obj):
'''cleanupPage(obj) ... overwrite to perform any cleanup tasks before page is destroyed.
Can safely be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-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
pass # pylint: disable=unnecessary-pass

def getForm(self):
'''getForm() ... return UI form for this page.
Must be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-pass

def getFields(self, obj):
'''getFields(obj) ... overwrite to transfer values from UI to obj's properties.
Can safely be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-pass

def setFields(self, obj):
'''setFields(obj) ... overwrite to transfer obj's property values to UI.
Can safely be overwritten by subclasses.'''
pass
pass # pylint: disable=unnecessary-pass

def getSignalsForUpdate(self, obj):
'''getSignalsForUpdate(obj) ... return signals which, when triggered, cause the receiver to update the model.
Expand All @@ -319,7 +319,7 @@ def registerSignalHandlers(self, obj):
manually.
Can safely be overwritten by subclasses.'''
# pylint: disable=unused-argument
pass
pass # pylint: disable=unnecessary-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.
Expand All @@ -332,13 +332,13 @@ def updateData(self, obj, prop):
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
pass # pylint: disable=unnecessary-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
pass # pylint: disable=unnecessary-pass

# helpers
def selectInComboBox(self, name, combo):
Expand Down Expand Up @@ -1040,9 +1040,7 @@ def clearSelection(self, doc):

class CommandSetStartPoint:
'''Command to set the start point for an operation.'''

def __init__(self):
pass
# pylint: disable=no-init

def GetResources(self):
return {'Pixmap': 'Path-StartPoint',
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Path/PathScripts/PathOpTools.py
Expand Up @@ -192,7 +192,7 @@ def offsetWire(wire, base, offset, forward):
return Part.Wire([edge])

# if we get to this point the assumption is that makeOffset2D can deal with the edge
pass
pass # pylint: disable=unnecessary-pass

owire = orientWire(wire.makeOffset2D(offset), True)
debugWire('makeOffset2D_%d' % len(wire.Edges), owire)
Expand All @@ -204,7 +204,7 @@ def offsetWire(wire, base, offset, forward):
PathLog.track('closed - inside')
try:
owire = wire.makeOffset2D(-offset)
except Exception:
except Exception: # pylint: disable=broad-except
# most likely offsetting didn't work because the wire is a hole
# and the offset is too big - making the hole vanish
return None
Expand Down
2 changes: 0 additions & 2 deletions src/Mod/Path/PathScripts/PathPocket.py
Expand Up @@ -54,7 +54,6 @@
else:
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())


# Qt translation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
Expand Down Expand Up @@ -83,7 +82,6 @@ def pocketInvertExtraOffset(self):
def areaOpShapes(self, obj):
'''areaOpShapes(obj) ... return shapes representing the solids to be removed.'''
PathLog.track()
PathLog.info("----- areaOpShapes() in PathPocket.py")

removalshapes = []
if obj.Base:
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathPocketBase.py
Expand Up @@ -59,7 +59,7 @@ def pocketOpFeatures(self, obj):
def initPocketOp(self, obj):
'''initPocketOp(obj) ... overwrite to initialize subclass.
Can safely be overwritten by subclass.'''
pass
pass # pylint: disable=unnecessary-pass

def pocketInvertExtraOffset(self):
'''pocketInvertExtraOffset() ... return True if ExtraOffset's direction is inward.
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathPocketBaseGui.py
Expand Up @@ -54,7 +54,7 @@ def pocketFeatures(self):
FeatureFacing ... used for face milling operation
FeatureOutline ... used for pocket-shape operation
Must be overwritten by subclasses'''
pass
pass # pylint: disable=unnecessary-pass

def getForm(self):
'''getForm() ... returns UI, adapted to the results from pocketFeatures()'''
Expand Down
8 changes: 5 additions & 3 deletions src/Mod/Path/PathScripts/PathPocketShape.py
Expand Up @@ -96,7 +96,7 @@ def selectOffsetWire(feature, wires):
closest = None
for w in wires:
dist = feature.distToShape(w)[0]
if closest is None or dist > closest[0]:
if closest is None or dist > closest[0]: # pylint: disable=unsubscriptable-object
closest = (dist, w)
if closest is not None:
return closest[1]
Expand Down Expand Up @@ -136,6 +136,8 @@ def __init__(self, obj, feature, sub, length, direction):
self.length = length
self.direction = direction

self.wire = None

def getSubLink(self):
return "%s:%s" % (self.feature, self.sub)

Expand Down Expand Up @@ -228,7 +230,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
'''Proxy object for Pocket operation.'''

def areaOpFeatures(self, obj):
return super(self.__class__, self).areaOpFeatures(obj) | PathOp.FeatureLocations
return super(ObjectPocket, self).areaOpFeatures(obj) | PathOp.FeatureLocations

def initPocketOp(self, obj):
'''initPocketOp(obj) ... setup receiver'''
Expand Down Expand Up @@ -522,7 +524,7 @@ def clasifySub(self, bs, sub):
self.guiMessage(title, msg, False)

# add faces for extensions
self.exts = []
self.exts = [] # pylint: disable=attribute-defined-outside-init
for ext in self.getExtensions(obj):
wire = ext.getWire()
if wire:
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/Path/PathScripts/PathPocketShapeGui.py
Expand Up @@ -170,7 +170,7 @@ def initPage(self, obj):
else:
self.form.showExtensions.setCheckState(QtCore.Qt.Unchecked)

self.blockUpdateData = False
self.blockUpdateData = False # pylint: disable=attribute-defined-outside-init

def cleanupPage(self, obj):
# If the object was already destroyed we can't access obj.Name.
Expand Down Expand Up @@ -207,19 +207,19 @@ def extractExtension(item, ext):
return extensions

def updateProxyExtensions(self, obj):
self.extensions = self.currentExtensions()
self.extensions = self.currentExtensions() # pylint: disable=attribute-defined-outside-init
obj.Proxy.setExtensions(obj, self.extensions)

def getFields(self, obj):
PathLog.track(obj.Label, self.model.rowCount(), self.model.columnCount())
self.blockUpdateData = True
self.blockUpdateData = True # pylint: disable=attribute-defined-outside-init

if obj.ExtensionCorners != self.form.extendCorners.isChecked():
obj.ExtensionCorners = self.form.extendCorners.isChecked()
self.defaultLength.updateProperty()

self.updateProxyExtensions(obj)
self.blockUpdateData = False
self.blockUpdateData = False # pylint: disable=attribute-defined-outside-init

def setFields(self, obj):
PathLog.track(obj.Label)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathPostProcessor.py
Expand Up @@ -58,7 +58,7 @@ def load(cls, processor):
exec("reload(%s)" % 'current_post') # pylint: disable=exec-used
except NameError:
# Python 3.4+
from importlib import reload # pylint: disable=redefined-builtin,unused-variable
from importlib import reload # pylint: disable=redefined-builtin,unused-import
exec("reload(%s)" % 'current_post') # pylint: disable=exec-used

sys.path = syspath
Expand Down

0 comments on commit f34ac89

Please sign in to comment.