Skip to content

Commit

Permalink
update schedules docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
geraintpalmer committed Apr 3, 2024
1 parent 2d0ea67 commit ae4655d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions ciw/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

class Schedule:
"""
A Schedule class for storing information about server schedules and generating the next shifts.
A Schedule class for storing information about server schedules and
generating the next shifts.
Parameters
----------
schedule : List[Tuple[int, float]]
A list of tuples representing shifts, where each tuple contains the number of servers and the shift date.
A list of tuples representing shifts, where each tuple contains the
number of servers and the shift end date.
preemption : Union[bool, str], optional
Pre-emption option, should be either 'resume', 'restart', 'resample', or False. Default is False.
Pre-emption option, should be either 'resume', 'restart', 'resample',
or False. Default is False.
Attributes
----------
schedule_type : str
Type of the schedule.
schedule_dates : List[float]
List of shift dates.
List of shift end dates.
schedule_servers : List[int]
List of corresponding server numbers.
preemption : Union[bool, str]
Expand All @@ -29,7 +32,8 @@ class Schedule:
initialise()
Initializes the generator object at the beginning of a simulation.
get_schedule_generator(boundaries, values)
A generator that yields the next time and number of servers according to a given schedule.
A generator that yields the next time and number of servers according
to a given schedule.
get_next_shift()
Updates the next shifts from the generator.
"""
Expand All @@ -43,7 +47,8 @@ def __init__(self, schedule: List[Tuple[int, float]], preemption: Union[bool, st
A list of tuples representing shifts, where each tuple contains
the number of servers and the shift date.
preemption : Union[bool, str], optional
Pre-emption option, should be either 'resume', 'restart', 'resample', or False.
Pre-emption option, should be either 'resume', 'restart',
'resample', or False.
Default is False.
"""
if preemption not in [False, 'resume', 'restart', 'resample']:
Expand All @@ -64,7 +69,8 @@ def initialise(self) -> NoReturn:

def get_schedule_generator(self, boundaries: List[float], values:List[int]) -> Generator[Tuple[float, int], None, None]:
"""
A generator that yields the next time and number of servers according to a given schedule.
A generator that yields the next time and number of servers according
to a given schedule.
Parameters
----------
Expand Down

0 comments on commit ae4655d

Please sign in to comment.