Skip to content

Commit 5991ede

Browse files
committed
[xmlparser.py] Whitespace Adjustments in Error Messages
1 parent 9beda58 commit 5991ede

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

odml/tools/xmlparser.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ def from_string(self, string):
218218
def check_mandatory_arguments(self, data, ArgClass, tag_name, node):
219219
for k, v in ArgClass.arguments:
220220
if v != 0 and not ArgClass.map(k) in data:
221-
self.error("missing element <%s> within <%s> tag" %
221+
self.error("missing element <%s> within <%s> tag\n" %
222222
(k, tag_name) + repr(data), node)
223223

224224
def is_valid_argument(self, tag_name, ArgClass, parent_node, child=None):
225225
if tag_name not in ArgClass.arguments_keys:
226-
self.error("Invalid element <%s> inside <%s> tag" %
226+
self.error("Invalid element <%s> inside <%s> tag\n" %
227227
(tag_name, parent_node.tag),
228228
parent_node if child is None else child)
229229

@@ -247,7 +247,7 @@ def warn(self, msg, elem):
247247

248248
def parse_element(self, node):
249249
if node.tag not in self.tags:
250-
self.error("Invalid element <%s>" % node.tag, node)
250+
self.error("Invalid element <%s> " % node.tag, node)
251251
return None # won't be able to parse this one
252252
return getattr(self, "parse_" + node.tag)(node, self.tags[node.tag])
253253

@@ -273,7 +273,7 @@ def parse_tag(self, root, fmt, insert_children=True):
273273
continue
274274

275275
# We currently do not support XML attributes.
276-
self.error("Attribute not supported, ignoring '%s=%s'" % (k, v), root)
276+
self.error("Attribute not supported, ignoring '%s=%s' " % (k, v), root)
277277

278278
for node in root:
279279
node.tag = node.tag.lower()
@@ -299,7 +299,7 @@ def parse_tag(self, root, fmt, insert_children=True):
299299
else:
300300
arguments[tag] = curr_text
301301
else:
302-
self.error("Invalid element <%s> in odML document section <%s>"
302+
self.error("Invalid element <%s> in odML document section <%s> "
303303
% (node.tag, root.tag), node)
304304

305305
if sys.version_info > (3,):
@@ -314,7 +314,8 @@ def parse_tag(self, root, fmt, insert_children=True):
314314
try:
315315
obj = fmt.create(**arguments)
316316
except ValueError:
317-
self.error("ValueError: Values '%s' do not match given DType '%s'!" % (arguments['values'], arguments['dtype']), root)
317+
self.error("ValueError: Values '%s' do not match given DType '%s'!" %
318+
(arguments['values'], arguments['dtype']), root)
318319

319320
if insert_children:
320321
for child in children:

0 commit comments

Comments
 (0)