Skip to content

Commit

Permalink
Merge pull request #69 from Doist/proxi/fix-39-2
Browse files Browse the repository at this point in the history
fix: Fix compatibility with Python 3.9.
  • Loading branch information
proxi authored Oct 29, 2024
2 parents fa0b5b0 + 1de3e8c commit c5c3ee6
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 c5c3ee6

Please sign in to comment.