mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 02:13:15 +08:00
[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:
@ -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]
|
||||
|
Reference in New Issue
Block a user