Skip to content

Instantly share code, notes, and snippets.

def lru_cache(maxsize=128, typed=False, initial_data = None):
"""Least-recently-used cache decorator.
If *maxsize* is set to None, the LRU features are disabled and the cache
can grow without bound.
If *typed* is True, arguments of different types will be cached separately.
For example, f(decimal.Decimal("3.0")) and f(3.0) will be treated as
distinct calls with distinct results. Some types such as str and int may
@JamesParrott
JamesParrott / test_bug_148_fixed.py
Created April 26, 2023 20:14
Test code to apply toml test_bug_148 and its fix to multiple toml libraries, for https://github.com/uiri/toml/issues/422
r""" Commands to reproduce:
python -m venv test_bug_148
Posix: source test_bug_148/bin.activate.sh
Windows: .\test_bug_148\Scripts\activate.bat
pip install pytest toml tomli tomli-w tomlkit toml_tools
pytest --tb=no -rA -q test_bug_148_fixed.py
Expected on Windows 10 Python 3.12:
.F....... [100%]
======================================================================== short test summary info ========================================================================