[mypy] Add/fix type annotations for scheduling algorithms (#4074) · silam/TheAlgorithmPython@00e279e · GitHub
Skip to content

Commit 00e279e

Browse files
authored
[mypy] Add/fix type annotations for scheduling algorithms (TheAlgorithms#4074)
* Fix mypy errors for scheduling/first_come_first_served * Fix mypy errors for scheduling/round_robin.py * Fix mypy errors for scheduling/shortest_job_first.py * Fix isort errors
1 parent 64d8504 commit 00e279e

3 files changed

Lines changed: 18 additions & 19 deletions

File tree

scheduling/first_come_first_served.py

Lines changed: 6 additions & 6 deletions

scheduling/round_robin.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
In Round Robin each process is assigned a fixed time slot in a cyclic way.
44
https://en.wikipedia.org/wiki/Round-robin_scheduling
55
"""
6-
from __future__ import annotations
7-
86
from statistics import mean
7+
from typing import List
98

109

11-
def calculate_waiting_times(burst_times: list[int]) -> list[int]:
10+
def calculate_waiting_times(burst_times: List[int]) -> List[int]:
1211
"""
1312
Calculate the waiting times of a list of processes that have a specified duration.
1413
@@ -41,8 +40,8 @@ def calculate_waiting_times(burst_times: list[int]) -> list[int]:
4140

4241

4342
def calculate_turn_around_times(
44-
burst_times: list[int], waiting_times: list[int]
45-
) -> list[int]:
43+
burst_times: List[int], waiting_times: List[int]
44+
) -> List[int]:
4645
"""
4746
>>> calculate_turn_around_times([1, 2, 3, 4], [0, 1, 3])
4847
[1, 3, 6]

scheduling/shortest_job_first.py

Lines changed: 8 additions & 8 deletions

0 commit comments

Comments
 (0)