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:
Christian Clauss
2021-09-07 13:37:03 +02:00
committed by GitHub
parent 5d5831bdd0
commit cecf43d648
142 changed files with 523 additions and 530 deletions

View File

@ -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.