File: //opt/alt/python311/lib/python3.11/site-packages/jsons/__pycache__/_cache.cpython-311.pyc
�
)�;f� � �^ � d Z ddlmZ ddlmZmZ ddlmZ G d� d� � Zdefd�Z d � Z
d
S )zn
PRIVATE MODULE: do not import (from) it directly.
This module contains functionality for caching functions.
� )�deque)� lru_cache�update_wrapper)�Callablec �X � e Zd ZdZ eg � � Zd� Z ed�� � d� � � ZdS )�_Wrapperz�
A wrapper around a function that needs to be cached. This wrapper allows
for a single point from which cache can be cleared.
c �H � || _ | j � | � � d S �N)�wrapped� instances�append)�selfr s �?/opt/alt/python311/lib/python3.11/site-packages/jsons/_cache.py�__init__z_Wrapper.__init__ s% � ��������d�#�#�#�#�#� T)�typedc � � | j |i |��S r
)r )r �args�kwargss r �__call__z_Wrapper.__call__ s � ��t�|�T�,�V�,�,�,r N) �__name__�
__module__�__qualname__�__doc__r r r r r � r r r r se � � � � � �� � ��b� � �I�$� $� $� �Y�T����-� -� ��-� -� -r r � decoratedc �F � t | � � }t || �� � |S )z�
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.
)�wrapperr )r r )r r s r �cachedr s) � � �y�!�!�G��7�I�6�6�6�6��Nr c �V � t j D ]} | j � � � �dS )z\
Clear all cache of functions that were cached using ``cached``.
:return: None.
N)r r r �cache_clear)�ws r �clearr# ( s7 � �
�
� !� !�� �
��� � � � �!� !r N)r �collectionsr � functoolsr r �typingr r r r# r r r �<module>r'