mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-11 20:27:54 +02:00
Use casting instead
This commit is contained in:
@@ -390,7 +390,7 @@ class Pregel(Runnable[Union[dict[str, Any], Any], Union[dict[str, Any], Any]]):
|
||||
continue
|
||||
|
||||
# find the subgraph, if any
|
||||
graph: Optional[Pregel] = find_subgraph_pregel(node.bound)
|
||||
graph = cast(Optional[Pregel], find_subgraph_pregel(node.bound))
|
||||
|
||||
# if found, yield recursively
|
||||
if graph:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from typing import Optional
|
||||
|
||||
from langchain_core.runnables import RunnableLambda, RunnableSequence
|
||||
from langchain_core.runnables.utils import get_function_nonlocals
|
||||
@@ -6,9 +6,6 @@ from langchain_core.runnables.utils import get_function_nonlocals
|
||||
from langgraph.checkpoint.base import ChannelVersions
|
||||
from langgraph.utils.runnable import Runnable, RunnableCallable, RunnableSeq
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from langgraph.pregel import Pregel
|
||||
|
||||
|
||||
def get_new_channel_versions(
|
||||
previous_versions: ChannelVersions, current_versions: ChannelVersions
|
||||
@@ -28,7 +25,7 @@ def get_new_channel_versions(
|
||||
return new_versions
|
||||
|
||||
|
||||
def find_subgraph_pregel(candidate: Runnable) -> Optional[Pregel]:
|
||||
def find_subgraph_pregel(candidate: Runnable) -> Optional[Runnable]:
|
||||
candidates: list[Runnable] = [candidate]
|
||||
|
||||
for c in candidates:
|
||||
|
||||
Reference in New Issue
Block a user