Skip to content

Commit

Permalink
return types
Browse files Browse the repository at this point in the history
  • Loading branch information
JoschD committed Nov 27, 2024
1 parent 96f556e commit 158b80c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/shift_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def same_day(d1: datetime, d2: datetime) -> bool:
return (d1.year == d2.year) and (d1.month == d2.month) and (d1.day == d2.day)


def is_holiday(date: datetime):
def is_holiday(date: datetime) -> bool:
""" True is date is on a known holiday. """
return any(same_day(date, h) for h in CERN_HOLIDAYS)

Expand Down Expand Up @@ -138,11 +138,11 @@ def calculate_shift_parts(start_time: datetime, end_time: datetime) -> dict[str,
return time_split


def time_delta_to_hours(time_delta: timedelta):
def time_delta_to_hours(time_delta: timedelta) -> float:
return time_delta.total_seconds() / 3600


def time_delta_to_shifts(time_delta: timedelta):
def time_delta_to_shifts(time_delta: timedelta) -> float:
return time_delta_to_hours(time_delta) / SHIFT_LENGTH


Expand Down Expand Up @@ -365,6 +365,8 @@ def plot_all_machines_in_year(
fig.tight_layout()
if output_path:
fig.savefig(output_path)

return fig



Expand Down

0 comments on commit 158b80c

Please sign in to comment.