Skip to content

Update type hints in disciplines #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions ciw/disciplines.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from typing import List
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ciw.individual import Individual

from ciw.individual import Individual
from ciw.auxiliary import random_choice


def FIFO(individuals: List[Individual], t: float) -> Individual:
def FIFO(individuals: list[Individual], t: float) -> Individual:
"""
FIFO: First In, First Out (FIFO)

Expand All @@ -20,14 +24,14 @@ def FIFO(individuals: List[Individual], t: float) -> Individual:
return individuals[0]


def SIRO(individuals: List[Individual], t: float) -> Individual:
def SIRO(individuals: list[Individual], t: float) -> Individual:
"""
SIRO: Service In Random Order (SIRO)

Returns a random individual from the queue.

Parameters:
- individuals (List[Individual]): List of individuals in the queue.
- individuals (list[Individual]): List of individuals in the queue.
- t (float): The current simulation time

Returns:
Expand All @@ -36,14 +40,14 @@ def SIRO(individuals: List[Individual], t: float) -> Individual:
return random_choice(individuals)


def LIFO(individuals: List[Individual], t: float) -> Individual:
def LIFO(individuals: list[Individual], t: float) -> Individual:
"""
LIFO: Last In, First Out (LIFO)

Returns the individual who joined the queue most recently.

Parameters:
- individuals (List[Individual]): List of individuals in the queue.
- individuals (list[Individual]): List of individuals in the queue.
- t (float): The current simulation time

Returns:
Expand Down
Loading