Skip to content

Commit

Permalink
use lru_cache for get_year/month/day
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Feb 25, 2022
1 parent 5fb408e commit 461f0dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions augur/filter_support/date_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def valid_date(date_in):
return False


@lru_cache()
def get_year(date_in):
"""Get the year from a date. Only works for ISO dates."""
date_in = str(date_in)
Expand All @@ -44,6 +45,7 @@ def get_year(date_in):
return None


@lru_cache()
def get_month(date_in):
"""Get the month from a date. Only works for ISO dates."""
date_in = str(date_in)
Expand All @@ -53,6 +55,7 @@ def get_month(date_in):
return None


@lru_cache()
def get_day(date_in):
"""Get the day from a date. Only works for ISO dates."""
date_in = str(date_in)
Expand Down

0 comments on commit 461f0dc

Please sign in to comment.