Skip to content

Commit 85e66bb

Browse files
committed
Remove unused code
1 parent 356bf4a commit 85e66bb

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

integrations/paddleocr/src/haystack_integrations/components/converters/paddleocr/paddleocr_vl_document_converter.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
)
1414
from haystack.dataclasses import ByteStream
1515
from haystack.utils import Secret, deserialize_secrets_inplace
16-
from paddlex.inference.serving.schemas.paddleocr_vl import InferRequest as PaddleOCRVLInferRequest # type: ignore
17-
from paddlex.inference.serving.schemas.paddleocr_vl import InferResult as PaddleOCRVLInferResult # type: ignore
18-
from paddlex.inference.serving.schemas.shared.ocr import FileType # type: ignore
16+
from paddlex.inference.serving.schemas.paddleocr_vl import InferRequest as PaddleOCRVLInferRequest # type: ignore[import-untyped]
17+
from paddlex.inference.serving.schemas.paddleocr_vl import InferResult as PaddleOCRVLInferResult # type: ignore[import-untyped]
18+
from paddlex.inference.serving.schemas.shared.ocr import FileType # type: ignore[import-untyped]
1919
from typing_extensions import Self, TypeAlias
2020

2121
logger = logging.getLogger(__name__)
@@ -88,7 +88,7 @@ def _normalize_file_type(file_type: Optional[FileTypeInput]) -> Optional[FileTyp
8888
Normalize file type input to the numeric format expected by the API.
8989
9090
:param file_type:
91-
File type input. Can be "pdf" or 0 for PDF, "image" or 1 for image,
91+
File type input. Can be "pdf" for PDF, "image" for image,
9292
or `None` for auto-detection.
9393
:returns:
9494
Normalized file type: 0 for PDF, 1 for image, or `None` for
@@ -103,9 +103,7 @@ def _normalize_file_type(file_type: Optional[FileTypeInput]) -> Optional[FileTyp
103103
return 1
104104
msg = f"Invalid `file_type` string: {file_type}. Must be 'pdf' or 'image'."
105105
raise ValueError(msg)
106-
if file_type in (0, 1):
107-
return file_type
108-
msg = f"Invalid `file_type` value: {file_type}. Must be 0, 1, 'pdf', 'image', or `None`."
106+
msg = f"Invalid `file_type` value: {file_type}. Must be 'pdf', 'image', or `None`."
109107
raise ValueError(msg)
110108

111109

integrations/paddleocr/tests/test_paddleocr_vl_document_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def test_from_dict_with_custom_parameters(self, monkeypatch):
277277
"strict": True,
278278
"type": "env_var",
279279
},
280-
"file_type": 0,
280+
"file_type": "pdf",
281281
"use_doc_orientation_classify": True,
282282
"use_doc_unwarping": False,
283283
"use_layout_detection": True,

0 commit comments

Comments
 (0)