Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 809-818 (lines=10) @@
806
                        # filter was inactive but no PAGE is in control, this must not happen
807
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
808
                                                  f"conflicts with file {ift[i].ID} but no PAGE available - on_error={on_error}")
809
                        if on_error == 'skip':
810
                            ift[i] = None
811
                        elif on_error == 'first':
812
                            pass # keep first match
813
                        elif on_error == 'last':
814
                            ift[i] = file_
815
                        elif on_error == 'abort':
816
                            raise NonUniqueInputFile(ifg, file_.pageId, None)
817
                        else:
818
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
819
                else:
820
                    self._base_logger.debug(f"adding file {file_.ID} for page {file_.pageId} to input file group {ifg}")
821
                    ift[i] = file_
@@ 789-798 (lines=10) @@
786
                        # filter was active, this must not happen
787
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
788
                                                  f"conflicts with file {ift[i].ID} of same MIME type {mimetype} - on_error={on_error}")
789
                        if on_error == 'skip':
790
                            ift[i] = None
791
                        elif on_error == 'first':
792
                            pass # keep first match
793
                        elif on_error == 'last':
794
                            ift[i] = file_
795
                        elif on_error == 'abort':
796
                            raise NonUniqueInputFile(ifg, file_.pageId, mimetype)
797
                        else:
798
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
799
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
800
                          file_.mimetype != MIMETYPE_PAGE):
801
                        pass # keep PAGE match