Code Duplication    Length = 12-12 lines in 2 locations

ocrd/ocrd/processor/base.py 2 locations

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