Addressed pylint warnings for PathPost
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathPreferences as PathPreferences
|
||||
import sys
|
||||
@@ -47,7 +46,7 @@ class PostProcessor:
|
||||
namespace = {}
|
||||
|
||||
#can't modify function local scope with exec in python3
|
||||
exec("import %s as current_post" % postname, namespace)
|
||||
exec("import %s as current_post" % postname, namespace) # pylint: disable=exec-used
|
||||
current_post = namespace['current_post']
|
||||
|
||||
# make sure the script is reloaded if it was previously loaded
|
||||
@@ -56,40 +55,34 @@ class PostProcessor:
|
||||
# resulting in 2 load messages if the script outputs one of those.
|
||||
try:
|
||||
# Python 2.7
|
||||
exec("reload(%s)" % 'current_post')
|
||||
exec("reload(%s)" % 'current_post') # pylint: disable=exec-used
|
||||
except NameError:
|
||||
# Python 3.4+
|
||||
from importlib import reload
|
||||
exec("reload(%s)" % 'current_post')
|
||||
from importlib import reload # pylint: disable=redefined-builtin,unused-variable
|
||||
exec("reload(%s)" % 'current_post') # pylint: disable=exec-used
|
||||
|
||||
sys.path = syspath
|
||||
|
||||
instance = PostProcessor(current_post)
|
||||
instance.units = None
|
||||
if hasattr(current_post, "UNITS"):
|
||||
if current_post.UNITS == "G21":
|
||||
instance.units = "Metric"
|
||||
else:
|
||||
instance.units = "Inch"
|
||||
|
||||
instance.machineName = None
|
||||
if hasattr(current_post, "MACHINE_NAME"):
|
||||
instance.machineName = current_post.MACHINE_NAME
|
||||
|
||||
instance.cornerMax = None
|
||||
if hasattr(current_post, "CORNER_MAX"):
|
||||
instance.cornerMax = {'x': current_post.CORNER_MAX['x'],
|
||||
'y': current_post.CORNER_MAX['y'],
|
||||
'z': current_post.CORNER_MAX['z']}
|
||||
|
||||
instance.cornerMin = None
|
||||
if hasattr(current_post, "CORNER_MIN"):
|
||||
instance.cornerMin = {'x': current_post.CORNER_MIN['x'],
|
||||
'y': current_post.CORNER_MIN['y'],
|
||||
'z': current_post.CORNER_MIN['z']}
|
||||
|
||||
instance.tooltip = None
|
||||
instance.tooltipArgs = None
|
||||
if hasattr(current_post, "TOOLTIP"):
|
||||
instance.tooltip = current_post.TOOLTIP
|
||||
if hasattr(current_post, "TOOLTIP_ARGS"):
|
||||
@@ -98,6 +91,12 @@ class PostProcessor:
|
||||
|
||||
def __init__(self, script):
|
||||
self.script = script
|
||||
self.tooltip = None
|
||||
self.tooltipArgs = None
|
||||
self.cornerMax = None
|
||||
self.cornerMin = None
|
||||
self.units = None
|
||||
self.machineName = None
|
||||
|
||||
def export(self, obj, filename, args):
|
||||
return self.script.export(obj, filename, args)
|
||||
|
||||
Reference in New Issue
Block a user