[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

@@ -3,7 +3,7 @@
# (c) 2010 Werner Mayer LGPL
# FreeCAD Python script to work with the FCStd file format.
import os,sys,string
import os
import xml.sax
import xml.sax.handler
import xml.sax.xmlreader
@@ -12,12 +12,13 @@ import zipfile
# SAX handler to parse the Document.xml
class DocumentHandler(xml.sax.handler.ContentHandler):
def __init__(self, dirname):
super().__init__()
self.files = []
self.dirname = dirname
def startElement(self, name, attributes):
item=attributes.get("file")
if item != None:
if item is not None:
self.files.append(os.path.join(self.dirname,str(item)))
def characters(self, data):