Code Duplication    Length = 12-12 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 604-615 (lines=12) @@
601
                                file_.pageId, ifg))
602
                    else:
603
                        # filter was inactive but no PAGE is in control, this must not happen
604
                        if on_error == 'skip':
605
                            ift[i] = None
606
                        elif on_error == 'first':
607
                            pass # keep first match
608
                        elif on_error == 'last':
609
                            ift[i] = file_
610
                        elif on_error == 'abort':
611
                            raise ValueError(
612
                                "No PAGE-XML for page '%s' in fileGrp '%s' but multiple matches." % (
613
                                    file_.pageId, ifg))
614
                        else:
615
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
616
                else:
617
                    LOG.debug("adding file %s for page %s to input file group %s", file_.ID, file_.pageId, ifg)
618
                    ift[i] = file_
@@ 582-593 (lines=12) @@
579
                    # fileGrp has multiple files for this page ID
580
                    if mimetype:
581
                        # filter was active, this must not happen
582
                        if on_error == 'skip':
583
                            ift[i] = None
584
                        elif on_error == 'first':
585
                            pass # keep first match
586
                        elif on_error == 'last':
587
                            ift[i] = file_
588
                        elif on_error == 'abort':
589
                            raise ValueError(
590
                                "Multiple '%s' matches for page '%s' in fileGrp '%s'." % (
591
                                    mimetype, file_.pageId, ifg))
592
                        else:
593
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
594
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
595
                          file_.mimetype != MIMETYPE_PAGE):
596
                        pass # keep PAGE match