Skip to content

Commit

Permalink
fix: Fix compatibility with Python 3.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
proxi committed Oct 29, 2024
1 parent 1e2e101 commit 1de3e8c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bitmapist/cohort/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 = []
Expand Down

0 comments on commit 1de3e8c

Please sign in to comment.