Code Duplication    Length = 12-12 lines in 2 locations

ocrd/ocrd/processor/base.py 2 locations

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