Use lru_cache for Python 3.8 compatibilty

This commit is contained in:
Hugo van Kemenade 2024-01-15 13:45:52 +02:00
parent 96eb24b768
commit 9f75bbaf90

View File

@ -17,7 +17,7 @@
from __future__ import annotations from __future__ import annotations
import builtins import builtins
from functools import cache from functools import lru_cache
from types import CodeType from types import CodeType
from typing import Any from typing import Any
@ -225,7 +225,7 @@ def imagemath_convert(self: _Operand, mode: str) -> _Operand:
return _Operand(self.im.convert(mode)) return _Operand(self.im.convert(mode))
@cache @lru_cache
def _get_ops() -> dict[str, Any]: def _get_ops() -> dict[str, Any]:
return {k[10:]: v for k, v in globals().items() if k[:10] == "imagemath_"} return {k[10:]: v for k, v in globals().items() if k[:10] == "imagemath_"}