switched to pylint3 and fixed additional warnings
This commit is contained in:
@@ -85,6 +85,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
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):
|
||||
@@ -97,10 +98,11 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
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):
|
||||
@@ -112,6 +114,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
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])
|
||||
@@ -355,7 +358,7 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
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):
|
||||
|
||||
@@ -57,7 +57,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
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'''
|
||||
@@ -65,7 +65,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
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())
|
||||
|
||||
@@ -126,7 +126,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage):
|
||||
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'''
|
||||
@@ -140,9 +140,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
|
||||
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'''
|
||||
|
||||
@@ -29,7 +29,6 @@ import PathScripts.PathGeom as PathGeom
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathUtils as PathUtils
|
||||
import math
|
||||
import sys
|
||||
|
||||
from PathScripts.PathDressupTagPreferences import HoldingTagPreferences
|
||||
from PySide import QtCore
|
||||
@@ -42,6 +41,7 @@ PathLog.trackModule()
|
||||
def translate(context, text, disambig=None):
|
||||
return QtCore.QCoreApplication.translate(context, text, disambig)
|
||||
|
||||
MaxInt = 99999999999999
|
||||
|
||||
class TagSolid:
|
||||
def __init__(self, proxy, z, R):
|
||||
@@ -164,11 +164,11 @@ class ObjectDressup:
|
||||
|
||||
self.obj = obj
|
||||
|
||||
minZ = +sys.maxint
|
||||
minZ = +MaxInt
|
||||
minX = minZ
|
||||
minY = minZ
|
||||
|
||||
maxZ = -sys.maxint
|
||||
maxZ = -MaxInt
|
||||
maxX = maxZ
|
||||
maxY = maxZ
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
# pylint: disable=unused-variable
|
||||
# pylint: disable=unused-import
|
||||
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ class StockEdit(object):
|
||||
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)
|
||||
|
||||
@@ -238,12 +238,12 @@ class ObjectOp(object):
|
||||
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.
|
||||
@@ -252,24 +252,24 @@ class ObjectOp(object):
|
||||
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.
|
||||
@@ -491,7 +491,7 @@ class ObjectOp(object):
|
||||
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
|
||||
|
||||
@@ -198,7 +198,7 @@ class TaskPanelPage(object):
|
||||
'''__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('-')
|
||||
@@ -278,32 +278,32 @@ class TaskPanelPage(object):
|
||||
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.
|
||||
@@ -319,7 +319,7 @@ class TaskPanelPage(object):
|
||||
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.
|
||||
@@ -332,13 +332,13 @@ class TaskPanelPage(object):
|
||||
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):
|
||||
@@ -1040,9 +1040,7 @@ class TaskPanel(object):
|
||||
|
||||
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',
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
|
||||
@@ -54,7 +54,6 @@ if LOGLEVEL:
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
|
||||
|
||||
# Qt translation handling
|
||||
def translate(context, text, disambig=None):
|
||||
return QtCore.QCoreApplication.translate(context, text, disambig)
|
||||
@@ -83,7 +82,6 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
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:
|
||||
|
||||
@@ -59,7 +59,7 @@ class ObjectPocket(PathAreaOp.ObjectOp):
|
||||
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.
|
||||
|
||||
@@ -54,7 +54,7 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
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()'''
|
||||
|
||||
@@ -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]
|
||||
@@ -136,6 +136,8 @@ class Extension(object):
|
||||
self.length = length
|
||||
self.direction = direction
|
||||
|
||||
self.wire = None
|
||||
|
||||
def getSubLink(self):
|
||||
return "%s:%s" % (self.feature, self.sub)
|
||||
|
||||
@@ -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'''
|
||||
@@ -522,7 +524,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
|
||||
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:
|
||||
|
||||
@@ -170,7 +170,7 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
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.
|
||||
@@ -207,19 +207,19 @@ class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
|
||||
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)
|
||||
|
||||
@@ -58,7 +58,7 @@ class PostProcessor:
|
||||
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
|
||||
|
||||
@@ -53,16 +53,16 @@ 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
|
||||
pass # pylint: disable=unnecessary-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
|
||||
pass # pylint: disable=unnecessary-pass
|
||||
def setModelData(self, widget):
|
||||
'''setModelData(widget) ... called by the delegate to store new values.
|
||||
Must be implemented by subclasses.'''
|
||||
pass
|
||||
pass # pylint: disable=unnecessary-pass
|
||||
|
||||
class _PropertyEnumEditor(_PropertyEditor):
|
||||
'''Editor for enumeration values - uses a combo box.'''
|
||||
|
||||
@@ -311,7 +311,7 @@ class ToolLibraryManager():
|
||||
fp,fname = openFileWithExtension(filename[0], '.tbl')
|
||||
for key in tt.Tools:
|
||||
t = tt.Tools[key]
|
||||
fp.write("T{} P{} Y{} Z{} A{} B{} C{} U{} V{} W{} D{} I{} J{} Q{} ;{}\n".format(key,key,0,t.LengthOffset,0,0,0,0,0,0,t.Diameter,0,0,0,t.Name))
|
||||
fp.write("T{0} P{0} Y{1} Z{2} A{3} B{4} C{5} U{6} V{7} W{8} D{9} I{10} J{11} Q{12} ;{13}\n".format(key,0,t.LengthOffset,0,0,0,0,0,0,t.Diameter,0,0,0,t.Name))
|
||||
else:
|
||||
fp,fname = openFileWithExtension(filename[0], '.json')
|
||||
json.dump(self.templateAttrs(tt), fp, sort_keys=True, indent=2)
|
||||
|
||||
@@ -155,7 +155,7 @@ def isDrillable(obj, candidate, tooldiameter=None, includePartials=False):
|
||||
return drillable
|
||||
|
||||
|
||||
# fixme set at 4 decimal places for testing
|
||||
# set at 4 decimal places for testing
|
||||
def fmt(val):
|
||||
return format(val, '.4f')
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ EXTERNAL_MODULES+=' PySide.QtGui'
|
||||
EXTERNAL_MODULES+=' TechDraw'
|
||||
EXTERNAL_MODULES+=' area'
|
||||
EXTERNAL_MODULES+=' importlib'
|
||||
EXTERNAL_MODULES+=' ocl'
|
||||
EXTERNAL_MODULES+=' pivy'
|
||||
|
||||
#ARGS+=" --errors-only"
|
||||
@@ -72,6 +73,6 @@ if [ -z "$(which pylint)" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#pylint ${ARGS} PathScripts/ PathTests/
|
||||
pylint ${ARGS} PathScripts/
|
||||
#pylint3 ${ARGS} PathScripts/ PathTests/
|
||||
pylint3 ${ARGS} PathScripts/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user