Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 889-898 (lines=10) @@
886
                        # filter was inactive but no PAGE is in control, this must not happen
887
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
888
                                                  f"conflicts with file {ift[i].ID} but no PAGE available - on_error={on_error}")
889
                        if on_error == 'skip':
890
                            ift[i] = None
891
                        elif on_error == 'first':
892
                            pass # keep first match
893
                        elif on_error == 'last':
894
                            ift[i] = file_
895
                        elif on_error == 'abort':
896
                            raise NonUniqueInputFile(ifg, file_.pageId, None)
897
                        else:
898
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
899
                else:
900
                    self._base_logger.debug(f"adding file {file_.ID} for page {file_.pageId} to input file group {ifg}")
901
                    ift[i] = file_
@@ 869-878 (lines=10) @@
866
                        # filter was active, this must not happen
867
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
868
                                                  f"conflicts with file {ift[i].ID} of same MIME type {mimetype} - on_error={on_error}")
869
                        if on_error == 'skip':
870
                            ift[i] = None
871
                        elif on_error == 'first':
872
                            pass # keep first match
873
                        elif on_error == 'last':
874
                            ift[i] = file_
875
                        elif on_error == 'abort':
876
                            raise NonUniqueInputFile(ifg, file_.pageId, mimetype)
877
                        else:
878
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
879
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
880
                          file_.mimetype != MIMETYPE_PAGE):
881
                        pass # keep PAGE match