Check the type annotations at runtime with typeguard #15

Merged
alexander merged 8 commits from add-typeguard into develop 2026-12-01 17:54:26 +01:00
Showing only changes of commit f92fd35ce3 - Show all commits

Revert to bare pd.Series in OrderHistory

`typeguard` evaluates the annotations at runtime where `pd.Series[int]` raises a `TypeError`
Alexander Hess 2026-12-01 15:31:58 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -255,7 +255,7 @@ class OrderHistory:
pixel_id: int,
predict_at: dt.datetime,
train_horizon: int,
) -> tuple["pd.Series[int]", int, "pd.Series[int]"]:
) -> tuple[pd.Series, int, pd.Series]:
"""Slice a horizontal time series out of the `.totals`.
Create a time series covering `train_horizon` weeks that can be used
@ -331,7 +331,7 @@ class OrderHistory:
pixel_id: int,
predict_day: dt.date,
train_horizon: int,
) -> tuple["pd.Series[int]", int, "pd.Series[int]"]:
) -> tuple[pd.Series, int, pd.Series]:
"""Slice a vertical time series out of the `.totals`.
Create a time series covering `train_horizon` weeks that can be used
@ -424,7 +424,7 @@ class OrderHistory:
pixel_id: int,
predict_at: dt.datetime,
train_horizon: int,
) -> tuple["pd.Series[int]", int, "pd.Series[int]"]:
) -> tuple[pd.Series, int, pd.Series]:
"""Slice a vertical real-time time series out of the `.totals`.
Create a time series covering `train_horizon` weeks that can be used
@ -557,7 +557,7 @@ class OrderHistory:
# `+1` as both `first_day` and `last_day` are included.
n_days: int = (last_day - first_day).days + 1
return round(training_ts.sum() / n_days, 1)
return round(float(training_ts.sum()) / n_days, 1)
def choose_tactical_model(
self,