From 42d11894a2b5a3064b4bd011b67a6f0c8247ebe4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 12 Jun 2023 09:35:19 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=80=20chore(base.py):=20change=20retur?= =?UTF-8?q?n=20type=20of=20generator=5Fbuild=20method=20from=20List[Vertex?= =?UTF-8?q?]=20to=20Generator=20The=20return=20type=20of=20the=20generator?= =?UTF-8?q?=5Fbuild=20method=20has=20been=20changed=20from=20List[Vertex]?= =?UTF-8?q?=20to=20Generator=20to=20improve=20the=20semantics=20of=20the?= =?UTF-8?q?=20method.=20The=20method=20now=20yields=20each=20vertex=20in?= =?UTF-8?q?=20the=20graph=20instead=20of=20returning=20a=20list=20of=20ver?= =?UTF-8?q?tices.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/graph/base.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index d81613fff..b4f71772a 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Type, Union +from typing import Dict, Generator, List, Type, Union from langflow.graph.edge.base import Edge from langflow.graph.graph.constants import VERTEX_TYPE_MAP @@ -143,9 +143,8 @@ class Graph: return list(reversed(sorted_vertices)) - def generator_build(self) -> List[Vertex]: - """Builds each - node in the graph and yields it.""" + def generator_build(self) -> Generator: + """Builds each vertex in the graph and yields it.""" sorted_vertices = self.topological_sort() logger.info("Sorted vertices: %s", sorted_vertices) for node in sorted_vertices: