Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 904-913 (lines=10) @@
901
                        # filter was inactive but no PAGE is in control, this must not happen
902
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
903
                                                  f"conflicts with file {ift[i].ID} but no PAGE available - on_error={on_error}")
904
                        if on_error == 'skip':
905
                            ift[i] = None
906
                        elif on_error == 'first':
907
                            pass # keep first match
908
                        elif on_error == 'last':
909
                            ift[i] = file_
910
                        elif on_error == 'abort':
911
                            raise NonUniqueInputFile(ifg, file_.pageId, None)
912
                        else:
913
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
914
                else:
915
                    self._base_logger.debug(f"adding file {file_.ID} for page {file_.pageId} to input file group {ifg}")
916
                    ift[i] = file_
@@ 884-893 (lines=10) @@
881
                        # filter was active, 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} of same MIME type {mimetype} - 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, mimetype)
892
                        else:
893
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
894
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
895
                          file_.mimetype != MIMETYPE_PAGE):
896
                        pass # keep PAGE match