Code Duplication    Length = 12-12 lines in 2 locations

ocrd/ocrd/processor/base.py 2 locations

@@ 362-373 (lines=12) @@
359
                                file_.pageId, ifg))
360
                    else:
361
                        # filter was inactive but no PAGE is in control, this must not happen
362
                        if on_error == 'skip':
363
                            ift[i] = None
364
                        elif on_error == 'first':
365
                            pass # keep first match
366
                        elif on_error == 'last':
367
                            ift[i] = file_
368
                        elif on_error == 'abort':
369
                            raise ValueError(
370
                                "No PAGE-XML for page '%s' in fileGrp '%s' but multiple matches." % (
371
                                    file_.pageId, ifg))
372
                        else:
373
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
374
                else:
375
                    LOG.debug("adding file %s for page %s to input file group %s", file_.ID, file_.pageId, ifg)
376
                    ift[i] = file_
@@ 340-351 (lines=12) @@
337
                    # fileGrp has multiple files for this page ID
338
                    if mimetype:
339
                        # filter was active, this must not happen
340
                        if on_error == 'skip':
341
                            ift[i] = None
342
                        elif on_error == 'first':
343
                            pass # keep first match
344
                        elif on_error == 'last':
345
                            ift[i] = file_
346
                        elif on_error == 'abort':
347
                            raise ValueError(
348
                                "Multiple '%s' matches for page '%s' in fileGrp '%s'." % (
349
                                    mimetype, file_.pageId, ifg))
350
                        else:
351
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
352
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
353
                          file_.mimetype != MIMETYPE_PAGE):
354
                        pass # keep PAGE match