From 1de3e8c905c42b91f1e77f9aa1bda2796712b566 Mon Sep 17 00:00:00 2001 From: Janusz Gregorczyk Date: Tue, 29 Oct 2024 17:33:53 +0100 Subject: [PATCH] fix: Fix compatibility with Python 3.9. --- bitmapist/cohort/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bitmapist/cohort/__init__.py b/bitmapist/cohort/__init__.py index 1df06cb..7b8439b 100644 --- a/bitmapist/cohort/__init__.py +++ b/bitmapist/cohort/__init__.py @@ -64,7 +64,7 @@ from datetime import date, datetime, timedelta from os import path -from typing import Any, Callable, Literal, Optional +from typing import Any, Callable, Literal, Optional, Union from dateutil.relativedelta import relativedelta from mako.lookup import TemplateLookup @@ -240,7 +240,7 @@ def get_dates_data( date_range = num_results now = now - timedelta(days=num_results - 1) - def timedelta_inc(delta: int) -> relativedelta | timedelta: + def timedelta_inc(delta: int) -> Union[relativedelta, timedelta]: return timedelta(days=delta) # Weeks @@ -250,7 +250,7 @@ def timedelta_inc(delta: int) -> relativedelta | timedelta: date_range = num_results now = now - relativedelta(weeks=num_results - 1) - def timedelta_inc(delta: int) -> relativedelta | timedelta: + def timedelta_inc(delta: int) -> Union[relativedelta, timedelta]: return relativedelta(weeks=delta) # Months @@ -261,7 +261,7 @@ def timedelta_inc(delta: int) -> relativedelta | timedelta: now = now - relativedelta(months=num_results - 1) now -= timedelta(days=now.day - 1) - def timedelta_inc(delta: int) -> relativedelta | timedelta: + def timedelta_inc(delta: int) -> Union[relativedelta, timedelta]: return relativedelta(months=delta) # Years @@ -273,7 +273,7 @@ def timedelta_inc(delta: int) -> relativedelta | timedelta: date_range = num_results now = now - relativedelta(years=num_results - 1) - def timedelta_inc(delta: int) -> relativedelta | timedelta: + def timedelta_inc(delta: int) -> Union[relativedelta, timedelta]: return relativedelta(years=delta) dates = []