Skip to content

Commit

Permalink
Add a comment about implicit lru_cache bound
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkin committed Oct 29, 2024
1 parent 9d25b3f commit 59ed9ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tomli/_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def match_to_datetime(match: re.Match) -> datetime | date:
return datetime(year, month, day, hour, minute, sec, micros, tzinfo=tz)


# No need to limit cache size. This is only ever called on input
# that matched RE_DATETIME, so there is an implicit bound of
# 24 (hours) * 60 (minutes) * 2 (offset direction) = 2880.
@lru_cache(maxsize=None)
def cached_tz(hour_str: str, minute_str: str, sign_str: str) -> timezone:
sign = 1 if sign_str == "+" else -1
Expand Down

0 comments on commit 59ed9ef

Please sign in to comment.