Get rid of more lintian complaints from github Python linter.
While working on https://github.com/FreeCAD/FreeCAD/pull/9867 I noticed my patch showed up with a lot of linting issues in code I did not touch, to a point where the view was very cluttered by lintian issues. Here is my second try to reduce the number of issues discovered by the linter. Some issues are still left, as I fail to see how to sensibly reduce the number of parameters or local variable used.
This commit is contained in:
@@ -40,7 +40,8 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
LOG_MODULE = Path.Log.thisModule()
|
||||
|
||||
if False:
|
||||
debugmodule = False
|
||||
if debugmodule:
|
||||
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
|
||||
Path.Log.trackModule(Path.Log.thisModule())
|
||||
else:
|
||||
@@ -238,11 +239,11 @@ def resolveFileName(job, subpartname, sequencenumber):
|
||||
fullPath = f"{fn}{n:03d}{ext}"
|
||||
|
||||
if openDialog:
|
||||
foo = QtGui.QFileDialog.getSaveFileName(
|
||||
requestedfile = QtGui.QFileDialog.getSaveFileName(
|
||||
QtGui.QApplication.activeWindow(), "Output File", fullPath
|
||||
)
|
||||
if foo[0]:
|
||||
fullPath = foo[0]
|
||||
fullPath = requestedfile[0]
|
||||
else:
|
||||
fullPath = None
|
||||
|
||||
@@ -294,7 +295,7 @@ def buildPostList(job):
|
||||
if tc is not None and PathUtil.opProperty(obj, "Active"):
|
||||
if tc.ToolNumber != currTool:
|
||||
sublist.append(tc)
|
||||
Path.Log.debug("Appending TC: {}".format(tc.Name))
|
||||
Path.Log.debug(f"Appending TC: {tc.Name}")
|
||||
currTool = tc.ToolNumber
|
||||
sublist.append(obj)
|
||||
postlist.append((f, sublist))
|
||||
@@ -388,7 +389,7 @@ def buildPostList(job):
|
||||
continue
|
||||
|
||||
sublist = []
|
||||
Path.Log.debug("obj: {}".format(obj.Name))
|
||||
Path.Log.debug(f"obj: {obj.Name}")
|
||||
|
||||
for f in wcslist:
|
||||
fobj = _TempObject()
|
||||
@@ -417,16 +418,18 @@ def buildPostList(job):
|
||||
if job.SplitOutput:
|
||||
Path.Log.track()
|
||||
return postlist
|
||||
else:
|
||||
Path.Log.track()
|
||||
finalpostlist = [
|
||||
("allitems", [item for slist in postlist for item in slist[1]])
|
||||
]
|
||||
return finalpostlist
|
||||
|
||||
Path.Log.track()
|
||||
finalpostlist = [
|
||||
("allitems", [item for slist in postlist for item in slist[1]])
|
||||
]
|
||||
return finalpostlist
|
||||
|
||||
|
||||
class DlgSelectPostProcessor:
|
||||
def __init__(self, parent=None):
|
||||
"""Provide user with list of available and active post processor
|
||||
choices."""
|
||||
def __init__(self):
|
||||
self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgSelectPostProcessor.ui")
|
||||
firstItem = None
|
||||
for post in Path.Preferences.allEnabledPostProcessors():
|
||||
@@ -511,7 +514,7 @@ class CommandPathPost:
|
||||
postArgs = ""
|
||||
|
||||
if extraargs is not None:
|
||||
postArgs += " {}".format(extraargs)
|
||||
postArgs += f" {extraargs}"
|
||||
|
||||
Path.Log.track(postArgs)
|
||||
|
||||
@@ -564,7 +567,7 @@ class CommandPathPost:
|
||||
if hasattr(o, "Proxy"):
|
||||
if isinstance(o.Proxy, PathJob.ObjectJob):
|
||||
targetlist.append(o.Label)
|
||||
Path.Log.debug("Possible post objects: {}".format(targetlist))
|
||||
Path.Log.debug(f"Possible post objects: {targetlist}")
|
||||
if len(targetlist) > 1:
|
||||
jobname, result = QtGui.QInputDialog.getItem(
|
||||
None, translate("Path", "Choose a Path Job"), None, targetlist
|
||||
@@ -576,7 +579,7 @@ class CommandPathPost:
|
||||
jobname = targetlist[0]
|
||||
job = FreeCAD.ActiveDocument.getObject(jobname)
|
||||
|
||||
Path.Log.debug("about to postprocess job: {}".format(job.Name))
|
||||
Path.Log.debug(f"about to postprocess job: {job.Name}")
|
||||
|
||||
postlist = buildPostList(job)
|
||||
# filename = resolveFileName(job, "allitems", 0)
|
||||
|
||||
Reference in New Issue
Block a user