From 585aeeab6e58a114ff23e9f23e276d9ae441bed3 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 12 Jun 2023 13:05:27 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20refactor(base.py):=20remove=20un?= =?UTF-8?q?necessary=20build=20method=20call=20in=20Graph=20class=20The=20?= =?UTF-8?q?build=20method=20call=20in=20the=20for=20loop=20of=20the=20buil?= =?UTF-8?q?d=5Fvertices=20method=20is=20unnecessary=20as=20the=20vertices?= =?UTF-8?q?=20are=20already=20sorted=20and=20built=20in=20the=20topologica?= =?UTF-8?q?l=5Fsort=20method.=20The=20yield=20from=20statement=20is=20used?= =?UTF-8?q?=20to=20return=20the=20sorted=20vertices.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/graph/graph/base.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/backend/langflow/graph/graph/base.py b/src/backend/langflow/graph/graph/base.py index b4f71772a..3ec63e387 100644 --- a/src/backend/langflow/graph/graph/base.py +++ b/src/backend/langflow/graph/graph/base.py @@ -147,9 +147,7 @@ class Graph: """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: - node.build() - yield node._built_object_repr(), node.id + yield from sorted_vertices def get_node_neighbors(self, node: Vertex) -> Dict[Vertex, int]: """Returns the neighbors of a node."""