Code Duplication    Length = 10-10 lines in 2 locations

src/ocrd/processor/base.py 2 locations

@@ 1115-1124 (lines=10) @@
1112
                        self._base_logger.warning(
1113
                            f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
1114
                            f"conflicts with file {ift[i].ID} but no PAGE available - on_error={on_error}")
1115
                        if on_error == 'skip':
1116
                            ift[i] = None
1117
                        elif on_error == 'first':
1118
                            pass  # keep first match
1119
                        elif on_error == 'last':
1120
                            ift[i] = file_
1121
                        elif on_error == 'abort':
1122
                            raise NonUniqueInputFile(ifg, file_.pageId, None)
1123
                        else:
1124
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
1125
                else:
1126
                    self._base_logger.debug(f"adding file {file_.ID} for page {file_.pageId} to input file group {ifg}")
1127
                    ift[i] = file_
@@ 1094-1103 (lines=10) @@
1091
                        self._base_logger.warning(
1092
                            f"added file {file_.ID} for page {file_.pageId} in input file group {ifg} "
1093
                            f"conflicts with file {ift[i].ID} of same MIME type {mimetype} - on_error={on_error}")
1094
                        if on_error == 'skip':
1095
                            ift[i] = None
1096
                        elif on_error == 'first':
1097
                            pass  # keep first match
1098
                        elif on_error == 'last':
1099
                            ift[i] = file_
1100
                        elif on_error == 'abort':
1101
                            raise NonUniqueInputFile(ifg, file_.pageId, mimetype)
1102
                        else:
1103
                            raise Exception("Unknown 'on_error' strategy '%s'" % on_error)
1104
                    elif (ift[i].mimetype == MIMETYPE_PAGE and
1105
                          file_.mimetype != MIMETYPE_PAGE):
1106
                        pass  # keep PAGE match