Skip to content

Commit 01d90f2

Browse files
committed
feat: fix ruff lint errors in ASR files
- Sort imports alphabetically in cli/main.py - Replace Optional[str] with str | None in pipeline_options_asr_model.py - Remove unused Optional import Signed-off-by: BBC, Esquire <bbc@chintellalaw.com>
1 parent 6551ef3 commit 01d90f2

2 files changed

Lines changed: 16 additions & 17 deletions

File tree

docling/cli/main.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,36 @@
2929
from docling.datamodel.accelerator_options import AcceleratorDevice, AcceleratorOptions
3030
from docling.datamodel.asr_model_specs import (
3131
WHISPER_BASE,
32+
WHISPER_BASE_EN_S2T,
3233
WHISPER_BASE_MLX,
3334
WHISPER_BASE_NATIVE,
35+
WHISPER_BASE_S2T,
36+
WHISPER_DISTIL_LARGE_V3_S2T,
37+
WHISPER_DISTIL_MEDIUM_EN_S2T,
38+
WHISPER_DISTIL_SMALL_EN_S2T,
3439
WHISPER_LARGE,
3540
WHISPER_LARGE_MLX,
3641
WHISPER_LARGE_NATIVE,
42+
WHISPER_LARGE_V3_S2T,
43+
WHISPER_LARGE_V3_TURBO_S2T,
3744
WHISPER_MEDIUM,
45+
WHISPER_MEDIUM_EN_S2T,
3846
WHISPER_MEDIUM_MLX,
3947
WHISPER_MEDIUM_NATIVE,
48+
WHISPER_MEDIUM_S2T,
4049
WHISPER_SMALL,
50+
WHISPER_SMALL_EN_S2T,
4151
WHISPER_SMALL_MLX,
4252
WHISPER_SMALL_NATIVE,
53+
WHISPER_SMALL_S2T,
4354
WHISPER_TINY,
55+
WHISPER_TINY_EN_S2T,
4456
WHISPER_TINY_MLX,
4557
WHISPER_TINY_NATIVE,
58+
WHISPER_TINY_S2T,
4659
WHISPER_TURBO,
4760
WHISPER_TURBO_MLX,
4861
WHISPER_TURBO_NATIVE,
49-
# WhisperS2T models
50-
WHISPER_TINY_S2T,
51-
WHISPER_TINY_EN_S2T,
52-
WHISPER_BASE_S2T,
53-
WHISPER_BASE_EN_S2T,
54-
WHISPER_SMALL_S2T,
55-
WHISPER_SMALL_EN_S2T,
56-
WHISPER_DISTIL_SMALL_EN_S2T,
57-
WHISPER_MEDIUM_S2T,
58-
WHISPER_MEDIUM_EN_S2T,
59-
WHISPER_DISTIL_MEDIUM_EN_S2T,
60-
WHISPER_LARGE_V3_S2T,
61-
WHISPER_DISTIL_LARGE_V3_S2T,
62-
WHISPER_LARGE_V3_TURBO_S2T,
6362
AsrModelType,
6463
)
6564
from docling.datamodel.backend_options import PdfBackendOptions

docling/datamodel/pipeline_options_asr_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from enum import Enum
2-
from typing import Annotated, Any, Literal, Optional, Union
2+
from typing import Annotated, Any, Literal, Union
33

44
from pydantic import AnyUrl, BaseModel, Field
55
from typing_extensions import deprecated
@@ -97,7 +97,7 @@ class InlineAsrOptions(BaseAsrOptions):
9797
),
9898
] = 30.0
9999
torch_dtype: Annotated[
100-
Optional[str],
100+
str | None,
101101
Field(
102102
description=(
103103
"PyTorch data type for model weights. Options: `float32`, "
@@ -352,7 +352,7 @@ class InlineAsrWhisperS2TOptions(InlineAsrOptions):
352352
Field(description=("Number of parallel workers for CTranslate2.")),
353353
] = 1
354354
initial_prompt: Annotated[
355-
Optional[str],
355+
str | None,
356356
Field(
357357
description=(
358358
"Optional text prompt to condition the transcription style or "

0 commit comments

Comments
 (0)