X7ROOT File Manager
Current Path:
/opt/alt/python311/lib/python3.11/site-packages/jsons
opt
/
alt
/
python311
/
lib
/
python3.11
/
site-packages
/
jsons
/
📁
..
📄
__init__.py
(11.57 KB)
📁
__pycache__
📄
_cache.py
(1.23 KB)
📄
_common_impl.py
(5.89 KB)
📄
_compatibility_impl.py
(3.06 KB)
📄
_datetime_impl.py
(4.98 KB)
📄
_dump_impl.py
(4.01 KB)
📄
_extra_impl.py
(1.7 KB)
📄
_fork_impl.py
(1.39 KB)
📄
_key_transformers.py
(1.32 KB)
📄
_lizers_impl.py
(5.73 KB)
📄
_load_impl.py
(8.16 KB)
📄
_multitasking.py
(2.34 KB)
📄
_package_info.py
(376 B)
📄
_transform_impl.py
(1.48 KB)
📄
_validation.py
(2.64 KB)
📁
classes
📄
decorators.py
(6.62 KB)
📁
deserializers
📄
exceptions.py
(6.02 KB)
📁
serializers
Editing: _cache.py
""" PRIVATE MODULE: do not import (from) it directly. This module contains functionality for caching functions. """ from collections import deque from functools import lru_cache, update_wrapper from typing import Callable class _Wrapper: """ A wrapper around a function that needs to be cached. This wrapper allows for a single point from which cache can be cleared. """ instances = deque([]) def __init__(self, wrapped): self.wrapped = wrapped self.instances.append(self) @lru_cache(typed=True) def __call__(self, *args, **kwargs): return self.wrapped(*args, **kwargs) def cached(decorated: Callable): """ Alternative for ``functools.lru_cache``. By decorating a function with ``cached``, you can clear the cache of that function by calling ``clear()``. :param decorated: the decorated function. :return: a wrapped function. """ wrapper = _Wrapper(decorated) update_wrapper(wrapper=wrapper, wrapped=decorated) return wrapper def clear(): """ Clear all cache of functions that were cached using ``cached``. :return: None. """ for w in _Wrapper.instances: w.__call__.cache_clear()
Upload File
Create Folder