Adding small amount of cache to common functions (#3565)

This commit is contained in:
dgtlmoon
2025-10-28 10:43:20 +01:00
committed by GitHub
parent 2116b2cb93
commit f304ae19db
2 changed files with 6 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
from functools import lru_cache
from loguru import logger
from typing import List
import html
@@ -41,6 +43,7 @@ def is_safe_url(test_url):
# Doesn't look like python supports forward slash auto enclosure in re.findall
# So convert it to inline flag "(?i)foobar" type configuration
@lru_cache(maxsize=100)
def perl_style_slash_enclosed_regex_to_options(regex):
res = re.search(PERL_STYLE_REGEX, regex, re.IGNORECASE)

View File

@@ -1,3 +1,5 @@
from functools import lru_cache
import arrow
from enum import IntEnum
@@ -12,7 +14,7 @@ class Weekday(IntEnum):
Saturday = 5
Sunday = 6
@lru_cache(maxsize=100)
def am_i_inside_time(
day_of_week: str,
time_str: str,