Code Duplication    Length = 12-12 lines in 2 locations

ocrd/ocrd/processor/base.py 2 locations

@@ 275-286 (lines=12) @@
272
                                    file_.pageId, ifg))
273
                    else:
274
                        # filter was inactive but no PAGE is in control, this must not happen
275
                        if on_error == 'skip':
276
                            ift[i] = None
277
                        elif on_error == 'first':
278
                            pass # keep first match
279
                        elif on_error == 'last':
280
                            ift[i] = file_
281
                        elif on_error == 'abort':
282
                            raise ValueError(
283
                                "No PAGE-XML for page '%s' in fileGrp '%s' but multiple matches." % (
284
                                    file_.pageId, ifg))
285
                        else:
286
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
287
                else:
288
                    LOG.debug("adding file %s for page %s to input file group %s", file_.ID, file_.pageId, ifg)
289
                    ift[i] = file_
@@ 253-264 (lines=12) @@
250
                    # fileGrp has multiple files for this page ID
251
                    if mimetype:
252
                        # filter was active, this must not happen
253
                        if on_error == 'skip':
254
                            ift[i] = None
255
                        elif on_error == 'first':
256
                            pass # keep first match
257
                        elif on_error == 'last':
258
                            ift[i] = file_
259
                        elif on_error == 'abort':
260
                            raise ValueError(
261
                                "Multiple '%s' matches for page '%s' in fileGrp '%s'." % (
262
                                    mimetype, file_.pageId, ifg))
263
                        else:
264
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
265
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
266
                          file_.mimetype != MIMETYPE_PAGE):
267
                        pass # keep PAGE match