Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mineru/model/_internal/pytorchocr/data/imaug/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def resize_image_type0(self, img):
if int(resize_w) <= 0 or int(resize_h) <= 0:
return None, (None, None)
img = resize_image(img, (int(resize_w), int(resize_h)))
except:
except Exception:
print(img.shape, resize_w, resize_h)
sys.exit(0)
ratio_h = resize_h / float(h)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def decode(self, text_index, text_prob=None, is_remove_duplicate=False):
for idx in range(len(text_index[batch_idx])):
try:
char_idx = self.character[int(text_index[batch_idx][idx])]
except:
except (IndexError, ValueError):
continue
if char_idx == '</s>': # end
break
Expand Down
2 changes: 1 addition & 1 deletion mineru/parser/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def safe_encode(data: str, method: str) -> tuple[bytes | None, bool]:
try:
bit_data = data.encode(encoding=method, errors="replace")
return bit_data, True
except: # noqa
except Exception: # noqa: BLE001
return None, False

for method in ["utf-8", "ascii"]:
Expand Down
Loading