Skip to content

Commit

Permalink
fix: solving mypy check issue
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielBeFr committed Sep 22, 2022
1 parent 3114aea commit 3a5f9ab
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions robotoff/prediction/ocr/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,18 @@ def find_category(content: Union[OCRResult, str]) -> List[Prediction]:

for match in ocr_regex.regex.finditer(text):

category_value = ocr_regex.processing_func(lang, match)

if category_value is not None:

predictions.append(
Prediction(
type=PredictionType.category,
value_tag=category_value,
predictor="regex",
data={"text": match.group(), "notify": ocr_regex.notify},
)
if ocr_regex.processing_func:
category_value = ocr_regex.processing_func(lang, match)

if category_value is None:
continue

predictions.append(
Prediction(
type=PredictionType.category,
value_tag=category_value,
predictor="regex",
data={"text": match.group(), "notify": ocr_regex.notify},
)
)
return predictions

0 comments on commit 3a5f9ab

Please sign in to comment.