Ë
    Fü´j‘  ã                  óH   — d Z ddlmZ ddlmZmZ erddlmZ  G d„ d«      Zy)zCaching utilities.é    )Úannotations)ÚTYPE_CHECKINGÚAny)ÚCallablec                  ó4   — e Zd ZdZdd„Zdd	d„Zdd
d„Zdd„Zy)Úcachedpropertyar  A decorator for caching a property's result.

    Similar to :py:class:`property`, but the wrapped method's result is cached on the
    instance. This is achieved by setting an entry in the object's instance dictionary
    with the same name as the property. When the name is later accessed, the value in
    the instance dictionary takes precedence over the (non-data descriptor) property.

    This is useful for implementing lazy-loaded properties.

    The cache can be invalidated via :py:meth:`delattr`, or by modifying ``__dict__``
    directly. It will be repopulated on next access.

    .. versionadded:: 6.3.0

    c                 ó   — y)z)Empty method to make sphinx run properly.N© )ÚselfÚargsÚkwargss      úM/root/workspace/ytshorts/venv/lib/python3.12/site-packages/praw/util/cache.pyÚ__call__zcachedproperty.__call__   s   � ó    Nc                óv   — |€| S | j                  |«      x}|j                  | j                   j                  <   |S )z˜Implement descriptor getter.

        Calculate the property's value and then store it in the associated object's
        instance dictionary.

        )ÚfuncÚ__dict__Ú__name__)r   ÚobjÚobjtypeÚvalues       r   Ú__get__zcachedproperty.__get__    s8   € ð ˆ;ØˆKà37·9±9¸S³>ÐAˆ�—‘˜TŸY™Y×/Ñ/Ñ0Øˆr   c                óJ   — |x| _         | _        |€|j                  }|| _        y)z/Initialize a :class:`.cachedproperty` instance.N)r   Ú__wrapped__Ú__doc__)r   r   Údocs      r   Ú__init__zcachedproperty.__init__-   s&   € à'+Ð+ˆŒ	�DÔ$àˆ;Ø—,‘,ˆCØˆ�r   c                óP   — d| j                   j                  › d| j                  › d�S )z?Return an object initialization representation of the instance.ú<ú ú>)Ú	__class__r   r   )r   s    r   Ú__repr__zcachedproperty.__repr__5   s&   € à�4—>‘>×*Ñ*Ð+¨1¨T¯Y©Y¨K°qÐ9Ð9r   )r   r   r   r   Úreturnr   )N)r   ú
Any | Noner   r%   r$   r   )r   zCallable[[Any], Any]r   z
str | Noner$   ÚNone)r$   Ústr)r   Ú
__module__Ú__qualname__r   r   r   r   r#   r
   r   r   r   r      s   „ ñó"8ôôô:r   r   N)	r   Ú
__future__r   Útypingr   r   Úcollections.abcr   r   r
   r   r   ú<module>r-      s   ðÙ å "ç %áÝ(÷,:ò ,:r   