From 7866bd2718594bb4978deededfe607b19d86bbd9 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Sat, 16 Nov 2024 16:57:32 -0800 Subject: [PATCH] lib: find_subgraph doesn't need to look in both func and afunc - if they both exist they're expected to share the same implementation, so looking in both is redundant --- libs/langgraph/langgraph/pregel/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/pregel/utils.py b/libs/langgraph/langgraph/pregel/utils.py index cc7221ea4..66464ef9a 100644 --- a/libs/langgraph/langgraph/pregel/utils.py +++ b/libs/langgraph/langgraph/pregel/utils.py @@ -48,7 +48,7 @@ def find_subgraph_pregel(candidate: Runnable) -> Optional[Runnable]: nl.__self__ if hasattr(nl, "__self__") else nl for nl in get_function_nonlocals(c.func) ) - if c.afunc is not None: + elif c.afunc is not None: candidates.extend( nl.__self__ if hasattr(nl, "__self__") else nl for nl in get_function_nonlocals(c.afunc)