Code Duplication    Length = 12-12 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 589-600 (lines=12) @@
586
                                file_.pageId, ifg))
587
                    else:
588
                        # filter was inactive but no PAGE is in control, this must not happen
589
                        if on_error == 'skip':
590
                            ift[i] = None
591
                        elif on_error == 'first':
592
                            pass # keep first match
593
                        elif on_error == 'last':
594
                            ift[i] = file_
595
                        elif on_error == 'abort':
596
                            raise ValueError(
597
                                "No PAGE-XML for page '%s' in fileGrp '%s' but multiple matches." % (
598
                                    file_.pageId, ifg))
599
                        else:
600
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
601
                else:
602
                    LOG.debug("adding file %s for page %s to input file group %s", file_.ID, file_.pageId, ifg)
603
                    ift[i] = file_
@@ 567-578 (lines=12) @@
564
                    # fileGrp has multiple files for this page ID
565
                    if mimetype:
566
                        # filter was active, this must not happen
567
                        if on_error == 'skip':
568
                            ift[i] = None
569
                        elif on_error == 'first':
570
                            pass # keep first match
571
                        elif on_error == 'last':
572
                            ift[i] = file_
573
                        elif on_error == 'abort':
574
                            raise ValueError(
575
                                "Multiple '%s' matches for page '%s' in fileGrp '%s'." % (
576
                                    mimetype, file_.pageId, ifg))
577
                        else:
578
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
579
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
580
                          file_.mimetype != MIMETYPE_PAGE):
581
                        pass # keep PAGE match