Skip to content

Commit

Permalink
Address type issues and documentation
Browse files Browse the repository at this point in the history
Python doesn't support variable shadowing. Oops
  • Loading branch information
Willenbrink committed Jan 2, 2025
1 parent c6dab02 commit a6b5a82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 4 additions & 6 deletions haystack/core/pipeline/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ def _find_next_runnable_component(
:param components_inputs: The current state of the inputs divided by Component name
:param waiting_queue: Queue of Components waiting for input
:returns: The name and the instance of the next Component that can be run
:returns: None or the name and the instance of the next Component that can be run
"""

def count_inputs(name, comp):
Expand All @@ -962,14 +962,12 @@ def count_inputs(name, comp):
num_inputs += 1
return num_inputs

waiting_queue = [
(name, comp, _is_lazy_variadic(comp), count_inputs(name, comp)) for name, comp in waiting_queue
]
queue = [(name, comp, _is_lazy_variadic(comp), count_inputs(name, comp)) for name, comp in waiting_queue]

first_runnable = next(
(
(name, comp)
for (name, comp, lazy_variadic, num_inputs) in waiting_queue
for (name, comp, lazy_variadic, num_inputs) in queue
if not lazy_variadic and num_inputs is not None and num_inputs > 0
),
None,
Expand All @@ -980,7 +978,7 @@ def count_inputs(name, comp):
first_lazy_variadic = next(
(
(name, comp)
for (name, comp, lazy_variadic, num_inputs) in waiting_queue
for (name, comp, lazy_variadic, num_inputs) in queue
if lazy_variadic and num_inputs is not None and num_inputs > 0
),
None,
Expand Down
4 changes: 1 addition & 3 deletions haystack/core/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ def run( # noqa: PLR0915, PLR0912
without outgoing connections.
:raises PipelineRuntimeError:
If the Pipeline contains cycles with unsupported connections that would cause
it to get stuck and fail running.
Or if a Component fails or returns output in an unsupported type.
If a Component fails or returns output in an unsupported type.
:raises PipelineMaxComponentRuns:
If a Component reaches the maximum number of times it can be run in this Pipeline.
"""
Expand Down

0 comments on commit a6b5a82

Please sign in to comment.