diff --git a/lib/matplotlib/_fontconfig_pattern.py b/lib/matplotlib/_fontconfig_pattern.py index a1341c633243..bc7a6c8cd84a 100644 --- a/lib/matplotlib/_fontconfig_pattern.py +++ b/lib/matplotlib/_fontconfig_pattern.py @@ -9,7 +9,7 @@ # there would have created cyclical dependency problems, because it also needs # to be available from `matplotlib.rcsetup` (for parsing matplotlibrc files). -from functools import lru_cache, partial +from functools import cache, lru_cache, partial import re from pyparsing import ( @@ -52,7 +52,7 @@ } -@lru_cache # The parser instance is a singleton. +@cache # The parser instance is a singleton. def _make_fontconfig_parser(): def comma_separated(elem): return elem + ZeroOrMore(Suppress(",") + elem) diff --git a/lib/matplotlib/dviread.py b/lib/matplotlib/dviread.py index 9850b73ea410..a8371ff4de41 100644 --- a/lib/matplotlib/dviread.py +++ b/lib/matplotlib/dviread.py @@ -19,7 +19,7 @@ from collections import namedtuple import enum -from functools import lru_cache, partial, wraps +from functools import cache, lru_cache, partial, wraps import logging import os from pathlib import Path @@ -1020,7 +1020,7 @@ def _parse_enc(path): class _LuatexKpsewhich: - @lru_cache # A singleton. + @cache # A singleton. def __new__(cls): self = object.__new__(cls) self._proc = self._new_proc() diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index cbcd72ea3cec..583473464036 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -30,7 +30,7 @@ from base64 import b64encode import copy import dataclasses -from functools import lru_cache +from functools import cache, lru_cache import functools from io import BytesIO import json @@ -247,7 +247,7 @@ def _get_win32_installed_fonts(): return items -@lru_cache +@cache def _get_fontconfig_fonts(): """Cache and list the font paths known to ``fc-list``.""" try: @@ -261,7 +261,7 @@ def _get_fontconfig_fonts(): return [Path(os.fsdecode(fname)) for fname in out.split(b'\n')] -@lru_cache +@cache def _get_macos_fonts(): """Cache and list the font paths known to ``system_profiler SPFontsDataType``.""" try: