From 001075f88aac2b3fc416972b9fd07840ac25df4e Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 2 Feb 2022 13:03:38 +0530 Subject: [PATCH] fix: Use lru_cache instead of cache * Mainly because it was introduced in PY39 * Making this change beacuse I'd like to evict cold caches too --- frappe/website/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/website/utils.py b/frappe/website/utils.py index 1772d8ada1..152d312533 100644 --- a/frappe/website/utils.py +++ b/frappe/website/utils.py @@ -4,7 +4,7 @@ import json import mimetypes import os import re -from functools import cache, wraps +from functools import lru_cache, wraps from typing import Dict, Optional import yaml @@ -512,7 +512,7 @@ def add_preload_headers(response): import traceback traceback.print_exc() -@cache +@lru_cache() def is_binary_file(path): # ref: https://stackoverflow.com/a/7392391/10309266 textchars = bytearray({7,8,9,10,12,13,27} | set(range(0x20, 0x100)) - {0x7f})