mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -2,10 +2,10 @@
|
||||
# In this Algorithm we just care about the order that the processes arrived
|
||||
# without carring about their duration time
|
||||
# https://en.wikipedia.org/wiki/Scheduling_(computing)#First_come,_first_served
|
||||
from typing import List
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def calculate_waiting_times(duration_times: List[int]) -> List[int]:
|
||||
def calculate_waiting_times(duration_times: list[int]) -> list[int]:
|
||||
"""
|
||||
This function calculates the waiting time of some processes that have a
|
||||
specified duration time.
|
||||
@ -24,8 +24,8 @@ def calculate_waiting_times(duration_times: List[int]) -> List[int]:
|
||||
|
||||
|
||||
def calculate_turnaround_times(
|
||||
duration_times: List[int], waiting_times: List[int]
|
||||
) -> List[int]:
|
||||
duration_times: list[int], waiting_times: list[int]
|
||||
) -> list[int]:
|
||||
"""
|
||||
This function calculates the turnaround time of some processes.
|
||||
Return: The time difference between the completion time and the
|
||||
@ -44,7 +44,7 @@ def calculate_turnaround_times(
|
||||
]
|
||||
|
||||
|
||||
def calculate_average_turnaround_time(turnaround_times: List[int]) -> float:
|
||||
def calculate_average_turnaround_time(turnaround_times: list[int]) -> float:
|
||||
"""
|
||||
This function calculates the average of the turnaround times
|
||||
Return: The average of the turnaround times.
|
||||
@ -58,7 +58,7 @@ def calculate_average_turnaround_time(turnaround_times: List[int]) -> float:
|
||||
return sum(turnaround_times) / len(turnaround_times)
|
||||
|
||||
|
||||
def calculate_average_waiting_time(waiting_times: List[int]) -> float:
|
||||
def calculate_average_waiting_time(waiting_times: list[int]) -> float:
|
||||
"""
|
||||
This function calculates the average of the waiting times
|
||||
Return: The average of the waiting times.
|
||||
|
Reference in New Issue
Block a user