Code Duplication    Length = 12-12 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 617-628 (lines=12) @@
614
                                file_.pageId, ifg))
615
                    else:
616
                        # filter was inactive but no PAGE is in control, this must not happen
617
                        if on_error == 'skip':
618
                            ift[i] = None
619
                        elif on_error == 'first':
620
                            pass # keep first match
621
                        elif on_error == 'last':
622
                            ift[i] = file_
623
                        elif on_error == 'abort':
624
                            raise ValueError(
625
                                "No PAGE-XML for page '%s' in fileGrp '%s' but multiple matches." % (
626
                                    file_.pageId, ifg))
627
                        else:
628
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
629
                else:
630
                    LOG.debug("adding file %s for page %s to input file group %s", file_.ID, file_.pageId, ifg)
631
                    ift[i] = file_
@@ 595-606 (lines=12) @@
592
                    # fileGrp has multiple files for this page ID
593
                    if mimetype:
594
                        # filter was active, this must not happen
595
                        if on_error == 'skip':
596
                            ift[i] = None
597
                        elif on_error == 'first':
598
                            pass # keep first match
599
                        elif on_error == 'last':
600
                            ift[i] = file_
601
                        elif on_error == 'abort':
602
                            raise ValueError(
603
                                "Multiple '%s' matches for page '%s' in fileGrp '%s'." % (
604
                                    mimetype, file_.pageId, ifg))
605
                        else:
606
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
607
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
608
                          file_.mimetype != MIMETYPE_PAGE):
609
                        pass # keep PAGE match