diff --git a/b_asic/GUI/drag_button.py b/b_asic/GUI/drag_button.py index cb6a9ca0a32b8a1bb149c8f8a887fc32e491434c..36d03c0796c3139db13f6a5b15e0abb6f71238d0 100644 --- a/b_asic/GUI/drag_button.py +++ b/b_asic/GUI/drag_button.py @@ -19,6 +19,8 @@ from b_asic.operation import Operation from b_asic.port import InputPort if TYPE_CHECKING: + from qtpy.QtWidgets import QGraphicsTextItem + from b_asic.GUI.main_window import SFGMainWindow @@ -90,13 +92,13 @@ class DragButton(QPushButton): """Return the type name of the underlying operation.""" return self.operation.type_name() - def add_label(self, label: str) -> None: + def add_label(self, label: "QGraphicsTextItem") -> None: """ Add label to button. Parameters ---------- - label : src + label : QGraphicsTextItem The label to add. """ self.label = label diff --git a/b_asic/resources.py b/b_asic/resources.py index 41dcac6bf30cbbf2fa7e5a6cf7b5773459f79553..1fad9dbaabb7aa1e611b81ecacb7c854e303ab4c 100644 --- a/b_asic/resources.py +++ b/b_asic/resources.py @@ -3,7 +3,7 @@ import re from collections import Counter, defaultdict from functools import reduce from math import log2 -from typing import Dict, Iterable, List, Optional, Tuple, TypeVar, Union +from typing import Dict, Iterable, List, Literal, Optional, Tuple, TypeVar, Union import matplotlib.pyplot as plt import networkx as nx @@ -864,7 +864,7 @@ class ProcessCollection: def split_on_execution_time( self, - heuristic: str = "left_edge", + heuristic: Literal["graph_color", "left_edge"] = "left_edge", coloring_strategy: str = "saturation_largest_first", ) -> List["ProcessCollection"]: """ diff --git a/b_asic/schedule.py b/b_asic/schedule.py index 8365d194b1dc39afdc2713d5c84b3d6f1ee72fad..54066e2e73a64c9766d3c3f714dcfe6fcaf73a98 100644 --- a/b_asic/schedule.py +++ b/b_asic/schedule.py @@ -7,7 +7,7 @@ Contains the schedule class for scheduling operations in an SFG. import io import sys from collections import defaultdict -from typing import Dict, List, Optional, Sequence, Tuple, cast +from typing import Dict, List, Literal, Optional, Sequence, Tuple, cast import matplotlib.pyplot as plt import numpy as np @@ -100,7 +100,7 @@ class Schedule: sfg: SFG, schedule_time: Optional[int] = None, cyclic: bool = False, - algorithm: str = "ASAP", + algorithm: Literal["ASAP", "ALAP", "provided"] = "ASAP", start_times: Optional[Dict[GraphID, int]] = None, laps: Optional[Dict[GraphID, int]] = None, max_resources: Optional[Dict[TypeName, int]] = None, diff --git a/b_asic/scheduler_gui/main_window.py b/b_asic/scheduler_gui/main_window.py index b331abcc35e48620e427096a70a4d5959fa72156..7a0c41147385419af5af61a34ee7ef9f333b68fc 100644 --- a/b_asic/scheduler_gui/main_window.py +++ b/b_asic/scheduler_gui/main_window.py @@ -14,7 +14,7 @@ import webbrowser from collections import defaultdict, deque from copy import deepcopy from importlib.machinery import SourceFileLoader -from typing import TYPE_CHECKING, Deque, List, Optional, cast +from typing import TYPE_CHECKING, Deque, List, Optional, cast, overload # Qt/qtpy import qtpy @@ -1006,6 +1006,18 @@ class ScheduleMainWindow(QMainWindow, Ui_MainWindow): self.actionToggle_full_screen.setIcon(get_icon('full-screen-exit')) +@overload +def start_scheduler(schedule: Schedule) -> Schedule: ... + + +@overload +def start_scheduler(schedule: None) -> Optional[Schedule]: ... + + +@overload +def start_scheduler() -> Optional[Schedule]: ... + + def start_scheduler(schedule: Optional[Schedule] = None) -> Optional[Schedule]: """ Start scheduler GUI.