From b3e37fff323deda1c304aa322808b6d3b8ce4fb7 Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Thu, 1 Aug 2019 02:04:08 -0500 Subject: [PATCH] Draft: importSVG.py, improved Pythonic style, 4 spaces instead of 8 --- src/Mod/Draft/importSVG.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index dc15fdd626..9eb156b76a 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -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):