[Tools] Fix static analyis issues

This commit addresses issues identified by LGTM for the various
independent (and mostly-independent) files in the Tools subdirectory.
The vast majority of the issues are trivial, and are things like unused
imports or catching BaseException. There was one true bug identified, a
global variable being changed in a function where it was not marked
global, but it only affected output quantity (the variable is named
"VERBOSE"). A couple of other issues identified variables that appear to
represent no-longer-existing options in the code. The options were left,
but a deprecation printout replaces the variable in the event the option
is provided.
This commit is contained in:
Chris Hennes
2021-02-25 22:48:01 -06:00
committed by wwmayer
parent bcb070def1
commit e2bb84fd2f
22 changed files with 144 additions and 183 deletions

View File

@@ -4,6 +4,11 @@
from __future__ import print_function # this allows py2 to print(str1, str2) correctly
import os,sys,getopt
import generateBase.generateModel_Module
import generateTemplates.templateModule
import generateTemplates.templateClassPyExport
Usage = """generate - generates a FreeCAD Module out of an XML model
Usage:
@@ -24,11 +29,6 @@ Version:
0.2
"""
import os,sys,string,re,getopt,codecs,binascii
import generateBase.generateModel_Module
import generateTemplates.templateModule
import generateTemplates.templateClassPyExport
# Globals
@@ -45,7 +45,7 @@ def generate(filename,path):
else:
Export = generateTemplates.templateClassPyExport.TemplateClassPyExport()
Export.path = path+"/"
Export.dirname = os.path.dirname(filename)+"/";
Export.dirname = os.path.dirname(filename)+"/"
Export.export = GenerateModelInst.PythonExport[0]
Export.Generate()
print("Done generating: " + GenerateModelInst.PythonExport[0].Name)
@@ -83,8 +83,7 @@ def main():
# running through the files
if (len(args) ==0):
#sys.stderr.write(Usage)
generate("../Mod/PartDesign/PartDesign_Model.xml")
sys.stderr.write(Usage)
else:
for i in args:
filename = os.path.abspath(i)