Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 709-718 (lines=10) @@
706
                        # filter was inactive but no PAGE is in control, this must not happen
707
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
708
                                                  f"conflicts with file {ift[i].ID} but no PAGE available - on_error={on_error}")
709
                        if on_error == 'skip':
710
                            ift[i] = None
711
                        elif on_error == 'first':
712
                            pass # keep first match
713
                        elif on_error == 'last':
714
                            ift[i] = file_
715
                        elif on_error == 'abort':
716
                            raise NonUniqueInputFile(ifg, file_.pageId, None)
717
                        else:
718
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
719
                else:
720
                    self._base_logger.debug(f"adding file {file_.ID} for page {file_.pageId} to input file group {ifg}")
721
                    ift[i] = file_
@@ 689-698 (lines=10) @@
686
                        # filter was active, this must not happen
687
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
688
                                                  f"conflicts with file {ift[i].ID} of same MIME type {mimetype} - on_error={on_error}")
689
                        if on_error == 'skip':
690
                            ift[i] = None
691
                        elif on_error == 'first':
692
                            pass # keep first match
693
                        elif on_error == 'last':
694
                            ift[i] = file_
695
                        elif on_error == 'abort':
696
                            raise NonUniqueInputFile(ifg, file_.pageId, mimetype)
697
                        else:
698
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
699
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
700
                          file_.mimetype != MIMETYPE_PAGE):
701
                        pass # keep PAGE match