Skip to content
Snippets Groups Projects
Commit 2ec484bb authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Make missing annotations None instead of empty dict

parent dd5f62bb
No related branches found
No related tags found
1 merge request!135Make missing annotations None instead of empty dict
Pipeline #
...@@ -26,7 +26,7 @@ class FailSafe(Annotator): ...@@ -26,7 +26,7 @@ class FailSafe(Annotator):
def annotate(self, sample, **kwargs): def annotate(self, sample, **kwargs):
if 'annotations' not in kwargs or kwargs['annotations'] is None: if 'annotations' not in kwargs or kwargs['annotations'] is None:
kwargs['annotations'] = {} kwargs['annotations'] = None
for annotator in self.annotators: for annotator in self.annotators:
try: try:
annotations = annotator(sample, **kwargs) annotations = annotator(sample, **kwargs)
...@@ -34,7 +34,7 @@ class FailSafe(Annotator): ...@@ -34,7 +34,7 @@ class FailSafe(Annotator):
logger.debug( logger.debug(
"The annotator `%s' failed to annotate!", annotator, "The annotator `%s' failed to annotate!", annotator,
exc_info=True) exc_info=True)
annotations = {} annotations = None
if not annotations: if not annotations:
logger.debug( logger.debug(
"Annotator `%s' returned empty annotations.", annotator) "Annotator `%s' returned empty annotations.", annotator)
...@@ -44,5 +44,5 @@ class FailSafe(Annotator): ...@@ -44,5 +44,5 @@ class FailSafe(Annotator):
break break
else: # this else is for the for loop else: # this else is for the for loop
# we don't want to return half of the annotations # we don't want to return half of the annotations
kwargs['annotations'] = {} kwargs['annotations'] = None
return kwargs['annotations'] return kwargs['annotations']
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment