From e4c532a227377fdeaa4796173a28b20f1a06cf84 Mon Sep 17 00:00:00 2001 From: Thomas Paviot Date: Tue, 17 Dec 2024 05:27:38 +0100 Subject: [PATCH] Cleanup plotter --- processscheduler/plotter.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/processscheduler/plotter.py b/processscheduler/plotter.py index 200967b..8b9de3c 100644 --- a/processscheduler/plotter.py +++ b/processscheduler/plotter.py @@ -18,8 +18,6 @@ from typing import Optional, Tuple, Union import warnings -from processscheduler.task_constraint import TaskStartAt - try: import numpy as np @@ -94,14 +92,17 @@ def plot_function( if show_plot: plt.show() -def sort_by_task_start(tasks: dict[str, TaskSolution], solution: SchedulingSolution) -> dict[str, TaskSolution]: + +def sort_by_task_start( + tasks: dict[str, TaskSolution], solution: SchedulingSolution +) -> dict[str, TaskSolution]: return dict( sorted( - tasks.items(), - key=lambda item: solution.tasks[item[0]].start, - reverse=True + tasks.items(), key=lambda item: solution.tasks[item[0]].start, reverse=True ) ) + + # # Gantt graphical rendering using plotly and matplotlib # @@ -221,7 +222,7 @@ def render_gantt_matplotlib( show_indicators: Optional[bool] = True, render_mode: Optional[str] = "Resource", fig_filename: Optional[str] = None, - sort_by_start: bool = False + sort_by_start: bool = False, ) -> None: """generate a gantt diagram using matplotlib. Inspired by