Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

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