From 0a62875742f5155dca11e12d00ac2c9e536db454 Mon Sep 17 00:00:00 2001 From: Martin <maarand@teklia.com> Date: Tue, 15 Feb 2022 17:32:47 +0100 Subject: [PATCH] fix linting --- kaldi_data_generator/main.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/kaldi_data_generator/main.py b/kaldi_data_generator/main.py index cf204cf..e341f86 100644 --- a/kaldi_data_generator/main.py +++ b/kaldi_data_generator/main.py @@ -184,10 +184,7 @@ class HTRDataGenerator: for elt in self.api_client.cached_paginate( "ListElementChildren", id=page_id, with_classes=True ): - elem_classes = [c - for c in elt["classes"] - if c["state"] != "rejected" - ] + elem_classes = [c for c in elt["classes"] if c["state"] != "rejected"] should_accept = True if self.should_filter_by_class: @@ -218,7 +215,9 @@ class HTRDataGenerator: found_class = list(style_counts.keys())[0] found_class = Style(found_class) else: - raise ValueError(f"Multiple style classes on the same element! {elt['id']} - {elem_classes}") + 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"]) @@ -237,7 +236,6 @@ class HTRDataGenerator: ) raise e - def _validate_transcriptions(self, page_id: str, lines: List[TranscriptionData]): if not lines: return @@ -296,9 +294,8 @@ class HTRDataGenerator: and res["worker_version_id"] not in self.accepted_worker_version_ids ): continue - if ( - (self.should_filter_by_class or self.should_filter_by_style) - and res["element"]["zone"]["id"] not in accepted_zones + if (self.should_filter_by_class or self.should_filter_by_style) and ( + res["element"]["zone"]["id"] not in accepted_zones ): continue if res["element"]["type"] != self.transcription_type: @@ -902,8 +899,10 @@ def main(): if args.style and args.accepted_classes: if any(c in args.accepted_classes for c in STYLE_CLASSES): - parser.error(f"--style class values ({STYLE_CLASSES}) shouldn't be in the accepted_classes list " - "if both --style and --accepted_classes are used together.") + parser.error( + f"--style class values ({STYLE_CLASSES}) shouldn't be in the accepted_classes list " + "if both --style and --accepted_classes are used together." + ) logger.info(f"ARGS {args} \n") -- GitLab