This commit is contained in:
Dima Gerasimov 2024-10-19 19:15:36 +01:00
parent bc7c3ac253
commit d1511929a8
33 changed files with 117 additions and 117 deletions

View file

@ -1,7 +1,7 @@
import datetime
from dataclasses import asdict, is_dataclass
from decimal import Decimal
from functools import lru_cache
from functools import cache, lru_cache
from pathlib import Path
from typing import Any, Callable, NamedTuple, Optional
@ -57,7 +57,7 @@ def _default_encode(obj: Any) -> Any:
# could possibly run multiple times/raise warning if you provide different 'default'
# functions or change the kwargs? The alternative is to maintain all of this at the module
# level, which is just as annoying
@lru_cache(maxsize=None)
@cache
def _dumps_factory(**kwargs) -> Callable[[Any], str]:
use_default: DefaultEncoder = _default_encode
# if the user passed an additional 'default' parameter,