Code Duplication    Length = 12-12 lines in 2 locations

ocrd/ocrd/processor/base.py 2 locations

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