Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hed/schema/hed_schema_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ def load_schema_version(xml_version=None, xml_folder=None):
- The xml_version is not valid.
- A fatal error was encountered in parsing
"""
# Check if we start and end with a square bracket, or double quote. This might be valid json
if xml_version and isinstance(xml_version, str) and \
((xml_version.startswith("[") and xml_version.endswith("]")) or
(xml_version.startswith('"') and xml_version.endswith('"'))):
((xml_version[0], xml_version[-1]) in [('[', ']'), ('"', '"')]):
try:
xml_version = json.loads(xml_version)
except json.decoder.JSONDecodeError as e:
Expand Down
4 changes: 2 additions & 2 deletions hed/schema/schema_io/wiki2schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ def _remove_nowiki_tag_from_line(self, line_number, tag_line):
"""
index1 = tag_line.find(no_wiki_start_tag)
index2 = tag_line.find(no_wiki_end_tag)
if (index1 == -1 and index2 != -1) or (index2 == -1 and index1 != -1):
if index1 == -1 ^ index2 == -1: # XOR operation, true if exactly one of the conditions is true
self._add_fatal_error(line_number, tag_line, "Invalid or non matching <nowiki> tags found")
elif index1 != -1 and index2 != -1 and index2 <= index1:
elif index1 != -1 and index2 <= index1:
self._add_fatal_error(line_number, tag_line, "</nowiki> appears before <nowiki> on a line")
tag_line = re.sub(no_wiki_tag, '', tag_line)
return tag_line
Expand Down