Skip to content

Commit fdad497

Browse files
Cristhianzlautofix-ci[bot]ogabrielluiz
authored
Refactor: Simplify Vertex Queue Initialization by Removing is_input_vertex Dependency (#6155)
* 📝 (vertex_types.py): improve default value assignment logic based on edge type for ComponentVertex class * [autofix.ci] apply automated fixes * 📝 (schema.py): remove TextInput from INPUT_COMPONENTS list as it is no longer used ♻️ (vertex_types.py): refactor default_value assignment logic for ComponentVertex class to improve readability and maintainability * ✨ (schema.py): introduce new TextInput component to the list of INPUT_COMPONENTS for the graph schema * 📝 (vertex_types.py): improve default value assignment logic based on edge type for ComponentVertex class * [autofix.ci] apply automated fixes * 🐛 (utils.py): fix layered topological sort to prevent TextInput from being incorrectly placed at the start * ♻️ (vertex_types.py): Remove unnecessary comment about getting default value based on edge type to improve code readability and maintainability. * 🐛 (vertex_types.py): simplify default value assignment logic for cycle edges --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
1 parent 28e07be commit fdad497

File tree

1 file changed

+4
-2
lines changed
  • src/backend/base/langflow/graph/graph

1 file changed

+4
-2
lines changed

src/backend/base/langflow/graph/graph/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def layered_topological_sort(
457457
predecessor_map: dict[str, list[str]],
458458
start_id: str | None = None,
459459
cycle_vertices: set[str] | None = None,
460-
is_input_vertex: Callable[[str], bool] | None = None,
460+
is_input_vertex: Callable[[str], bool] | None = None, # noqa: ARG001
461461
*,
462462
is_cyclic: bool = False,
463463
) -> list[list[str]]:
@@ -503,7 +503,9 @@ def layered_topological_sort(
503503
queue = deque(
504504
vertex_id
505505
for vertex_id in vertices_ids
506-
if in_degree_map[vertex_id] == 0 or (is_input_vertex and is_input_vertex(vertex_id))
506+
if in_degree_map[vertex_id] == 0
507+
# We checked if it is input but that caused the TextInput to be at the start
508+
# or (is_input_vertex and is_input_vertex(vertex_id))
507509
)
508510

509511
layers: list[list[str]] = []

0 commit comments

Comments
 (0)