[mypy] Add/fix type annotations for scheduling algorithms (#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
This commit is contained in:
shan7030
2020-12-28 09:34:40 +05:30
committed by GitHub
parent 64d8504170
commit 00e279ea44
3 changed files with 18 additions and 19 deletions

View File

@ -3,12 +3,11 @@ Round Robin is a scheduling algorithm.
In Round Robin each process is assigned a fixed time slot in a cyclic way.
https://en.wikipedia.org/wiki/Round-robin_scheduling
"""
from __future__ import annotations
from statistics import mean
from typing import List
def calculate_waiting_times(burst_times: list[int]) -> list[int]:
def calculate_waiting_times(burst_times: List[int]) -> List[int]:
"""
Calculate the waiting times of a list of processes that have a specified duration.
@ -41,8 +40,8 @@ def calculate_waiting_times(burst_times: list[int]) -> list[int]:
def calculate_turn_around_times(
burst_times: list[int], waiting_times: list[int]
) -> list[int]:
burst_times: List[int], waiting_times: List[int]
) -> List[int]:
"""
>>> calculate_turn_around_times([1, 2, 3, 4], [0, 1, 3])
[1, 3, 6]