🔀 chore(base.py): change return type of generator_build method from List[Vertex] to Generator
The return type of the generator_build method has been changed from List[Vertex] to Generator to improve the semantics of the method. The method now yields each vertex in the graph instead of returning a list of vertices.
This commit is contained in:
parent
a15cc30da5
commit
42d11894a2
1 changed files with 3 additions and 4 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue