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>
This commit is contained in:
parent
28e07be870
commit
fdad49764a
1 changed files with 4 additions and 2 deletions
|
|
@ -457,7 +457,7 @@ def layered_topological_sort(
|
||||||
predecessor_map: dict[str, list[str]],
|
predecessor_map: dict[str, list[str]],
|
||||||
start_id: str | None = None,
|
start_id: str | None = None,
|
||||||
cycle_vertices: set[str] | None = None,
|
cycle_vertices: set[str] | None = None,
|
||||||
is_input_vertex: Callable[[str], bool] | None = None,
|
is_input_vertex: Callable[[str], bool] | None = None, # noqa: ARG001
|
||||||
*,
|
*,
|
||||||
is_cyclic: bool = False,
|
is_cyclic: bool = False,
|
||||||
) -> list[list[str]]:
|
) -> list[list[str]]:
|
||||||
|
|
@ -503,7 +503,9 @@ def layered_topological_sort(
|
||||||
queue = deque(
|
queue = deque(
|
||||||
vertex_id
|
vertex_id
|
||||||
for vertex_id in vertices_ids
|
for vertex_id in vertices_ids
|
||||||
if in_degree_map[vertex_id] == 0 or (is_input_vertex and is_input_vertex(vertex_id))
|
if in_degree_map[vertex_id] == 0
|
||||||
|
# We checked if it is input but that caused the TextInput to be at the start
|
||||||
|
# or (is_input_vertex and is_input_vertex(vertex_id))
|
||||||
)
|
)
|
||||||
|
|
||||||
layers: list[list[str]] = []
|
layers: list[list[str]] = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue