Skip to content
Merged
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
13 changes: 11 additions & 2 deletions hed/errors/error_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
ErrorContext.SIDECAR_KEY_NAME,
ErrorContext.ROW,
ErrorContext.COLUMN,
ErrorContext.HED_STRING,
ErrorContext.SCHEMA_SECTION,
ErrorContext.SCHEMA_TAG,
ErrorContext.SCHEMA_ATTRIBUTE,
Expand All @@ -32,6 +31,10 @@
ErrorContext.ROW,
]

hed_string_sort_list = [
ErrorContext.HED_STRING
]

def _register_error_function(error_type, wrapper_func):
if error_type in error_functions:
raise KeyError(f"{error_type} defined more than once.")
Expand Down Expand Up @@ -186,10 +189,13 @@ def push_error_context(self, context_type, context):

"""
if context is None:
from hed import HedString
if context_type in int_sort_list:
context = 0
elif context_type in hed_string_sort_list:
context = HedString("")
else:
context_type = ""
context = ""
self.error_context.append((context_type, context))

def pop_error_context(self):
Expand Down Expand Up @@ -446,10 +452,13 @@ def sort_issues(issues, reverse=False):
Returns:
list: The sorted list of issues."""
def _get_keys(d):
from hed import HedString
result = []
for key in default_sort_list:
if key in int_sort_list:
result.append(d.get(key, -1))
elif key in hed_string_sort_list:
result.append(d.get(key, HedString("")))
else:
result.append(d.get(key, ""))
return tuple(result)
Expand Down