Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 826-835 (lines=10) @@
823
                        # filter was inactive but no PAGE is in control, this must not happen
824
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
825
                                                  f"conflicts with file {ift[i].ID} but no PAGE available - on_error={on_error}")
826
                        if on_error == 'skip':
827
                            ift[i] = None
828
                        elif on_error == 'first':
829
                            pass # keep first match
830
                        elif on_error == 'last':
831
                            ift[i] = file_
832
                        elif on_error == 'abort':
833
                            raise NonUniqueInputFile(ifg, file_.pageId, None)
834
                        else:
835
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
836
                else:
837
                    self._base_logger.debug(f"adding file {file_.ID} for page {file_.pageId} to input file group {ifg}")
838
                    ift[i] = file_
@@ 806-815 (lines=10) @@
803
                        # filter was active, this must not happen
804
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
805
                                                  f"conflicts with file {ift[i].ID} of same MIME type {mimetype} - on_error={on_error}")
806
                        if on_error == 'skip':
807
                            ift[i] = None
808
                        elif on_error == 'first':
809
                            pass # keep first match
810
                        elif on_error == 'last':
811
                            ift[i] = file_
812
                        elif on_error == 'abort':
813
                            raise NonUniqueInputFile(ifg, file_.pageId, mimetype)
814
                        else:
815
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
816
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
817
                          file_.mimetype != MIMETYPE_PAGE):
818
                        pass # keep PAGE match