Code Duplication    Length = 12-12 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 419-430 (lines=12) @@
416
                                file_.pageId, ifg))
417
                    else:
418
                        # filter was inactive but no PAGE is in control, this must not happen
419
                        if on_error == 'skip':
420
                            ift[i] = None
421
                        elif on_error == 'first':
422
                            pass # keep first match
423
                        elif on_error == 'last':
424
                            ift[i] = file_
425
                        elif on_error == 'abort':
426
                            raise ValueError(
427
                                "No PAGE-XML for page '%s' in fileGrp '%s' but multiple matches." % (
428
                                    file_.pageId, ifg))
429
                        else:
430
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
431
                else:
432
                    LOG.debug("adding file %s for page %s to input file group %s", file_.ID, file_.pageId, ifg)
433
                    ift[i] = file_
@@ 397-408 (lines=12) @@
394
                    # fileGrp has multiple files for this page ID
395
                    if mimetype:
396
                        # filter was active, this must not happen
397
                        if on_error == 'skip':
398
                            ift[i] = None
399
                        elif on_error == 'first':
400
                            pass # keep first match
401
                        elif on_error == 'last':
402
                            ift[i] = file_
403
                        elif on_error == 'abort':
404
                            raise ValueError(
405
                                "Multiple '%s' matches for page '%s' in fileGrp '%s'." % (
406
                                    mimetype, file_.pageId, ifg))
407
                        else:
408
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
409
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
410
                          file_.mimetype != MIMETYPE_PAGE):
411
                        pass # keep PAGE match