Skip to content

Commit 1c330fe

Browse files
committed
[xmlparser] Cleanup elif after raise
1 parent 3072df2 commit 1c330fe

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

odml/tools/xmlparser.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def save_element(curr_el):
156156
val = getattr(curr_el, fmt.map(k))
157157
if val is None:
158158
continue
159+
159160
if isinstance(fmt, ofmt.Property.__class__) and k == "value":
160161
# Custom odML tuples require special handling for save loading from file.
161162
if curr_el.dtype and curr_el.dtype.endswith("-tuple") and val:
@@ -274,10 +275,12 @@ def _handle_version(root):
274275
"""
275276
if root.tag != 'odML':
276277
raise ParserException("Expecting <odML> tag but got <%s>.\n" % root.tag)
277-
elif 'version' not in root.attrib:
278-
raise ParserException("Could not find format version attribute "
279-
"in <odML> tag.\n")
280-
elif root.attrib['version'] != FORMAT_VERSION:
278+
279+
if 'version' not in root.attrib:
280+
msg = "Could not find format version attribute in <odML> tag.\n"
281+
raise ParserException(msg)
282+
283+
if root.attrib['version'] != FORMAT_VERSION:
281284
msg = ("Cannot parse odML document with format version '%s'. \n"
282285
"\tUse the 'VersionConverter' from 'odml.tools.converters' "
283286
"to import previous odML formats."

0 commit comments

Comments
 (0)