Draft: importSVG.py, improved Pythonic style, 4 spaces instead of 8

This commit is contained in:
vocx-fc
2019-08-01 02:04:08 -05:00
committed by Yorik van Havre
parent 6571ce7f2f
commit b3e37fff32

View File

@@ -1533,29 +1533,29 @@ class svgHandler(xml.sax.ContentHandler):
def decodeName(name):
"""Decode encoded name.
"""Decode encoded name.
Parameters
----------
name : str
The string to decode.
Parameters
----------
name : str
The string to decode.
Returns
-------
tuple
(string)
A tuple containing the decoded `name` in 'utf8', otherwise in 'latin1'.
If it fails it returns the original `name`.
"""
Returns
-------
tuple
(string)
A tuple containing the decoded `name` in 'utf8', otherwise in 'latin1'.
If it fails it returns the original `name`.
"""
try:
decodedName = (name.decode("utf8"))
except UnicodeDecodeError:
try:
decodedName = (name.decode("utf8"))
decodedName = (name.decode("latin1"))
except UnicodeDecodeError:
try:
decodedName = (name.decode("latin1"))
except UnicodeDecodeError:
FreeCAD.Console.PrintError("svg: error: couldn't determine character encoding\n")
decodedName = name
return decodedName
FreeCAD.Console.PrintError("SVG: error: couldn't determine character encoding\n")
decodedName = name
return decodedName
def getContents(filename, tag, stringmode=False):