fix(context): replace type: ignore with cast() in ACMSPipeline semantic_chunking registration
Use typing.cast(ContextStrategy, _sc_cls()) instead of a # type: ignore[assignment] comment when registering SemanticChunkingStrategy in ACMSPipeline.__init__. This eliminates the type suppression comment and makes the structural subtype relationship explicit to the type checker.
This commit is contained in:
@@ -26,7 +26,7 @@ import re
|
||||
from collections.abc import Sequence
|
||||
from dataclasses import dataclass
|
||||
from threading import local
|
||||
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, runtime_checkable
|
||||
from typing import TYPE_CHECKING, Any, ClassVar, Protocol, cast, runtime_checkable
|
||||
|
||||
import structlog
|
||||
|
||||
@@ -785,7 +785,7 @@ class ACMSPipeline:
|
||||
# Imported lazily to avoid circular imports.
|
||||
if "semantic_chunking" not in self._strategies:
|
||||
_sc_cls = _get_semantic_chunking_strategy_class()
|
||||
self._strategies["semantic_chunking"] = _sc_cls() # type: ignore[assignment]
|
||||
self._strategies["semantic_chunking"] = cast(ContextStrategy, _sc_cls())
|
||||
# Register the 6 spec-required built-in strategies via adapters.
|
||||
# These strategies implement the domain-model ContextStrategy protocol
|
||||
# (strategy_stubs.py) and are wrapped in SpecStrategyAdapter instances
|
||||
|
||||
Reference in New Issue
Block a user