Skip to content

Commit a34a844

Browse files
committed
fix: solve Lint error
1 parent f583ae3 commit a34a844

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

unstructured/partition/common/common.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import contextlib
34
import numbers
45
import subprocess
56
from enum import Enum
@@ -392,10 +393,8 @@ def convert_to_bytes(file: bytes | IO[bytes]) -> bytes:
392393
if hasattr(file, "read"):
393394
f_bytes = file.read()
394395
if hasattr(file, "seek"):
395-
try:
396+
with contextlib.suppress(OSError):
396397
file.seek(0)
397-
except OSError:
398-
pass
399398
return f_bytes
400399

401400
raise ValueError("Invalid file-like object type")

0 commit comments

Comments
 (0)