Skip to content
Snippets Groups Projects
Commit a4332b0e authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Some typing fixes

parent b496973b
No related branches found
No related tags found
1 merge request!262Some typing fixes
Pipeline #93205 passed
...@@ -2,10 +2,10 @@ LATENCY_COLOR = (0, 185, 231) ...@@ -2,10 +2,10 @@ LATENCY_COLOR = (0, 185, 231)
EXECUTION_TIME_COLOR = (255, 100, 66, 200) EXECUTION_TIME_COLOR = (255, 100, 66, 200)
SIGNAL_COLOR = (0, 0, 0) SIGNAL_COLOR = (0, 0, 0)
SIGNAL_LINEWIDTH = 1.0 SIGNAL_LINEWIDTH: float = 1.0
OPERATION_GAP = 0.5 OPERATION_GAP: float = 0.5
SCHEDULE_OFFSET = 0.2 SCHEDULE_OFFSET: float = 0.2
SPLINE_OFFSET = 0.2 SPLINE_OFFSET: float = 0.2
...@@ -16,7 +16,7 @@ from b_asic.signal_flow_graph import SFG ...@@ -16,7 +16,7 @@ from b_asic.signal_flow_graph import SFG
def sfg_to_python( def sfg_to_python(
sfg: SFG, counter: int = 0, suffix: Optional[str] = None, schedule=False sfg: SFG, counter: int = 0, suffix: Optional[str] = None, schedule: bool = False
) -> str: ) -> str:
""" """
Given an SFG structure try to serialize it for saving to a file. Given an SFG structure try to serialize it for saving to a file.
......
...@@ -7,7 +7,7 @@ Contains the schedule class for scheduling operations in an SFG. ...@@ -7,7 +7,7 @@ Contains the schedule class for scheduling operations in an SFG.
import io import io
import sys import sys
from collections import defaultdict from collections import defaultdict
from typing import Dict, List, Optional, Tuple, cast from typing import Dict, List, Optional, Sequence, Tuple, cast
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
...@@ -720,8 +720,8 @@ class Schedule: ...@@ -720,8 +720,8 @@ class Schedule:
line_cache = [] line_cache = []
def _draw_arrow( def _draw_arrow(
start: List[float], end: List[float], name: str = "", laps: int = 0 start: Sequence[float], end: Sequence[float], name: str = "", laps: int = 0
): ) -> None:
"""Draw an arrow from *start* to *end*.""" """Draw an arrow from *start* to *end*."""
if end[0] < start[0] or laps > 0: # Wrap around if end[0] < start[0] or laps > 0: # Wrap around
if start not in line_cache: if start not in line_cache:
...@@ -802,7 +802,14 @@ class Schedule: ...@@ -802,7 +802,14 @@ class Schedule:
) )
ax.add_patch(path_patch) ax.add_patch(path_patch)
def _draw_offset_arrow(start, end, start_offset, end_offset, name="", laps=0): def _draw_offset_arrow(
start: Sequence[float],
end: Sequence[float],
start_offset: Sequence[float],
end_offset: Sequence[float],
name: str = "",
laps: int = 0,
) -> None:
"""Draw an arrow from *start* to *end*, but with an offset.""" """Draw an arrow from *start* to *end*, but with an offset."""
_draw_arrow( _draw_arrow(
[start[0] + start_offset[0], start[1] + start_offset[1]], [start[0] + start_offset[0], start[1] + start_offset[1]],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment