Code Duplication    Length = 12-12 lines in 2 locations

ocrd/ocrd/processor/base.py 2 locations

@@ 290-301 (lines=12) @@
287
                                    file_.pageId, ifg))
288
                    else:
289
                        # filter was inactive but no PAGE is in control, this must not happen
290
                        if on_error == 'skip':
291
                            ift[i] = None
292
                        elif on_error == 'first':
293
                            pass # keep first match
294
                        elif on_error == 'last':
295
                            ift[i] = file_
296
                        elif on_error == 'abort':
297
                            raise ValueError(
298
                                "No PAGE-XML for page '%s' in fileGrp '%s' but multiple matches." % (
299
                                    file_.pageId, ifg))
300
                        else:
301
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
302
                else:
303
                    LOG.debug("adding file %s for page %s to input file group %s", file_.ID, file_.pageId, ifg)
304
                    ift[i] = file_
@@ 268-279 (lines=12) @@
265
                    # fileGrp has multiple files for this page ID
266
                    if mimetype:
267
                        # filter was active, this must not happen
268
                        if on_error == 'skip':
269
                            ift[i] = None
270
                        elif on_error == 'first':
271
                            pass # keep first match
272
                        elif on_error == 'last':
273
                            ift[i] = file_
274
                        elif on_error == 'abort':
275
                            raise ValueError(
276
                                "Multiple '%s' matches for page '%s' in fileGrp '%s'." % (
277
                                    mimetype, file_.pageId, ifg))
278
                        else:
279
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
280
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
281
                          file_.mimetype != MIMETYPE_PAGE):
282
                        pass # keep PAGE match