From 8ab47639bff386c7f329900ab4aaf8013531ae6b Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 19 Jan 2024 22:03:03 -0300 Subject: [PATCH] Update type hints in ContractEdge class --- src/backend/langflow/graph/edge/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/graph/edge/base.py b/src/backend/langflow/graph/edge/base.py index ef00afaa9..455b06421 100644 --- a/src/backend/langflow/graph/edge/base.py +++ b/src/backend/langflow/graph/edge/base.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, List, Optional +from typing import TYPE_CHECKING, Any, List, Optional from loguru import logger from pydantic import BaseModel, Field @@ -104,7 +104,7 @@ class ContractEdge(Edge): self.is_fulfilled = False # Whether the contract has been fulfilled. self.result: Any = None - def honor(self, source, target) -> None: + def honor(self, source: "Vertex", target: "Vertex") -> None: """ Fulfills the contract by setting the result of the source vertex to the target vertex's parameter. If the edge is runnable, the source vertex is run with the message text and the target vertex's @@ -142,7 +142,7 @@ class ContractEdge(Edge): params[key] = [item for item in value if isinstance(item, (str, int, bool, float, list, dict))] return params - async def get_result(self, source, target): + async def get_result(self, source: "Vertex", target: "Vertex"): # Fulfill the contract if it has not been fulfilled. if not self.is_fulfilled: self.honor(source, target)