diff --git a/smartschedule/planning/parallelization/stage_parallelization.py b/smartschedule/planning/parallelization/stage_parallelization.py index 8a50908..70970e8 100644 --- a/smartschedule/planning/parallelization/stage_parallelization.py +++ b/smartschedule/planning/parallelization/stage_parallelization.py @@ -1,12 +1,15 @@ +from smartschedule.planning.parallelization.parallel_stages_list import ( + ParallelStagesList, +) from smartschedule.planning.parallelization.sorted_nodes_to_parallelized_stages import ( sorted_nodes_to_parallelized_stages, ) +from smartschedule.planning.parallelization.stage import Stage from smartschedule.planning.parallelization.stages_to_nodes import stages_to_nodes from smartschedule.sorter import graph_topological_sort -from smartschedule.utils.pipe import pipe -stage_parallelization_of = pipe( - stages_to_nodes, - graph_topological_sort, - sorted_nodes_to_parallelized_stages, -) + +def stage_parallelization_of(stages: set[Stage]) -> ParallelStagesList: + nodes = stages_to_nodes(stages) + sorted_nodes = graph_topological_sort(nodes) + return sorted_nodes_to_parallelized_stages(sorted_nodes) diff --git a/smartschedule/utils/__init__.py b/smartschedule/utils/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/smartschedule/utils/pipe.py b/smartschedule/utils/pipe.py deleted file mode 100644 index 8aab9d3..0000000 --- a/smartschedule/utils/pipe.py +++ /dev/null @@ -1,25 +0,0 @@ -from functools import reduce -from typing import Any, Callable, overload - - -@overload -def pipe[A, B](fn_1: Callable[[A], B], /) -> Callable[[A], B]: ... - - -@overload -def pipe[A, B, C]( - fn_1: Callable[[A], B], fn_2: Callable[[B], C], / -) -> Callable[[A], C]: ... - - -@overload -def pipe[A, B, C, D]( - fn_1: Callable[[A], B], fn_2: Callable[[B], C], fn_3: Callable[[C], D], / -) -> Callable[[A], D]: ... - - -def pipe(*fns: Callable[[Any], Any]) -> Callable[[Any], Any]: - def piped(arg: Any) -> Any: - return reduce(lambda prev_fn, next_fn: next_fn(prev_fn), fns, arg) - - return piped