We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f583ae3 commit a34a844Copy full SHA for a34a844
1 file changed
unstructured/partition/common/common.py
@@ -1,5 +1,6 @@
1
from __future__ import annotations
2
3
+import contextlib
4
import numbers
5
import subprocess
6
from enum import Enum
@@ -392,10 +393,8 @@ def convert_to_bytes(file: bytes | IO[bytes]) -> bytes:
392
393
if hasattr(file, "read"):
394
f_bytes = file.read()
395
if hasattr(file, "seek"):
- try:
396
+ with contextlib.suppress(OSError):
397
file.seek(0)
- except OSError:
398
- pass
399
return f_bytes
400
401
raise ValueError("Invalid file-like object type")
0 commit comments