From 601a3fceb79dbf0c87cfd6334f5f1c102f440a71 Mon Sep 17 00:00:00 2001 From: Martin <maarand@teklia.com> Date: Wed, 16 Feb 2022 17:16:21 +0100 Subject: [PATCH] fail with error instead of error message --- kaldi_data_generator/main.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/kaldi_data_generator/main.py b/kaldi_data_generator/main.py index 1a6bf9a..a9706ba 100644 --- a/kaldi_data_generator/main.py +++ b/kaldi_data_generator/main.py @@ -184,7 +184,6 @@ class HTRDataGenerator: def get_accepted_zones(self, page_id: str): try: - skip_count = 0 accepted_zones = [] for elt in self.api_client.cached_paginate( "ListElementChildren", id=page_id, with_classes=True @@ -223,14 +222,9 @@ class HTRDataGenerator: found_class = list(style_counts.keys())[0] found_class = Style(found_class) else: - logger.info( - f"Multiple style classes on the same element! Skipping {elt['id']} - {elem_classes}" + raise ValueError( + f"Multiple style classes on the same element! {elt['id']} - {elem_classes}" ) - skip_count += 1 - continue - # raise ValueError( - # f"Multiple style classes on the same element! {elt['id']} - {elem_classes}" - # ) if found_class == self.style: accepted_zones.append(elt["zone"]["id"]) @@ -238,8 +232,8 @@ class HTRDataGenerator: accepted_zones.append(elt["zone"]["id"]) logger.info( - "Number of accepted zone for page {} : {} ; skipped {}".format( - page_id, len(accepted_zones), skip_count + "Number of accepted zone for page {} : {}".format( + page_id, len(accepted_zones) ) ) return accepted_zones -- GitLab