Skip to content

Commit f10b228

Browse files
Fogapodvagenas
andauthored
chore: annotate kwargs across BaseChunker class hierarchy (#116)
* chore: add missing type hint for HybridChunker.chunk Signed-off-by: Eugene <[email protected]> * chore: apply typing to whole hierarchy Signed-off-by: Panos Vagenas <[email protected]> --------- Signed-off-by: Eugene <[email protected]> Signed-off-by: Panos Vagenas <[email protected]> Co-authored-by: Panos Vagenas <[email protected]>
1 parent b741eea commit f10b228

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

docling_core/transforms/chunker/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class BaseChunker(BaseModel, ABC):
5151
delim: str = DFLT_DELIM
5252

5353
@abstractmethod
54-
def chunk(self, dl_doc: DLDocument, **kwargs) -> Iterator[BaseChunk]:
54+
def chunk(self, dl_doc: DLDocument, **kwargs: Any) -> Iterator[BaseChunk]:
5555
"""Chunk the provided document.
5656
5757
Args:

docling_core/transforms/chunker/hybrid_chunker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""Hybrid chunker implementation leveraging both doc structure & token awareness."""
77

88
import warnings
9-
from typing import Iterable, Iterator, Optional, Union
9+
from typing import Any, Iterable, Iterator, Optional, Union
1010

1111
from pydantic import BaseModel, ConfigDict, PositiveInt, TypeAdapter, model_validator
1212
from typing_extensions import Self
@@ -231,7 +231,7 @@ def _merge_chunks_with_matching_metadata(self, chunks: list[DocChunk]):
231231

232232
return output_chunks
233233

234-
def chunk(self, dl_doc: DoclingDocument, **kwargs) -> Iterator[BaseChunk]:
234+
def chunk(self, dl_doc: DoclingDocument, **kwargs: Any) -> Iterator[BaseChunk]:
235235
r"""Chunk the provided document.
236236
237237
Args:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ module = [
136136
"jsonref.*",
137137
"jsonschema.*",
138138
"requests.*",
139+
"semchunk.*",
139140
"tabulate.*",
140141
"transformers.*",
141142
"yaml.*",

0 commit comments

Comments
 (0)