Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 1092-1101 (lines=10) @@
1089
                        # filter was inactive but no PAGE is in control, this must not happen
1090
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
1091
                                                  f"conflicts with file {ift[i].ID} but no PAGE available - on_error={on_error}")
1092
                        if on_error == 'skip':
1093
                            ift[i] = None
1094
                        elif on_error == 'first':
1095
                            pass # keep first match
1096
                        elif on_error == 'last':
1097
                            ift[i] = file_
1098
                        elif on_error == 'abort':
1099
                            raise NonUniqueInputFile(ifg, file_.pageId, None)
1100
                        else:
1101
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
1102
                else:
1103
                    self._base_logger.debug(f"adding file {file_.ID} for page {file_.pageId} to input file group {ifg}")
1104
                    ift[i] = file_
@@ 1072-1081 (lines=10) @@
1069
                        # filter was active, this must not happen
1070
                        self._base_logger.warning(f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
1071
                                                  f"conflicts with file {ift[i].ID} of same MIME type {mimetype} - on_error={on_error}")
1072
                        if on_error == 'skip':
1073
                            ift[i] = None
1074
                        elif on_error == 'first':
1075
                            pass # keep first match
1076
                        elif on_error == 'last':
1077
                            ift[i] = file_
1078
                        elif on_error == 'abort':
1079
                            raise NonUniqueInputFile(ifg, file_.pageId, mimetype)
1080
                        else:
1081
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
1082
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
1083
                          file_.mimetype != MIMETYPE_PAGE):
1084
                        pass # keep PAGE match