Skip to content

Commit

Permalink
Ensure types are v2 pandas ready
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Nov 13, 2024
1 parent 4b5ad2a commit c76fce7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions augur/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'\\': '_'}
)

def fix_dates(d, dayfirst=True):
def fix_dates(d: str, dayfirst: bool = True) -> str:
'''
attempt to parse a date string using pandas date parser. If ambiguous,
the argument 'dayfirst' determines whether month or day is assumed to be
Expand All @@ -35,7 +35,7 @@ def fix_dates(d, dayfirst=True):
try:
try:
# pandas <= 2.1
from pandas.core.tools.datetimes import parsing
from pandas.core.tools.datetimes import parsing # type: ignore
except ImportError:
# pandas >= 2.2
from pandas._libs.tslibs import parsing
Expand All @@ -44,7 +44,7 @@ def fix_dates(d, dayfirst=True):
results = parsing.parse_datetime_string_with_reso(d, dayfirst=dayfirst)
except AttributeError:
# pandas 1.x
results = parsing.parse_time_string(d, dayfirst=dayfirst)
results = parsing.parse_time_string(d, dayfirst=dayfirst) # type: ignore
if len(results) == 2:
dto, res = results
else:
Expand Down

0 comments on commit c76fce7

Please sign in to comment.