HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-85-generic #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pip/_vendor/cachecontrol/__pycache__/heuristics.cpython-312.pyc
�

��h�����ddlmZddlZddlZddlmZmZmZddlmZm	Z	m
Z
ddlmZm
Z
mZerddlmZdZddd�Zdd	�ZGd
�d�ZGd�d
e�ZGd�de�ZGd�de�Zy)�)�annotationsN)�datetime�	timedelta�timezone)�
formatdate�	parsedate�parsedate_tz)�
TYPE_CHECKING�Any�Mapping)�HTTPResponsez%a, %d %b %Y %H:%M:%S GMTc�Z�|xs#tjtj�}||zS�N)r�nowr�utc)�delta�dates  �E/usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/heuristics.py�expire_afterrs#���-�8�<�<����-�D��%�<��c�Z�ttj|j���Sr)r�calendar�timegm�	timetuple)�dts r�datetime_to_headerrs���h�o�o�b�l�l�n�5�6�6rc�$�eZdZdd�Zdd�Zdd�Zy)�
BaseHeuristicc��y)a!
        Return a valid 1xx warning header value describing the cache
        adjustments.

        The response is provided too allow warnings like 113
        http://tools.ietf.org/html/rfc7234#section-5.5.4 where we need
        to explicitly say response is over 24 hours old.
        z110 - "Response is Stale"���self�responses  r�warningzBaseHeuristic.warnings��+rc��iS)z�Update the response headers with any new headers.

        NOTE: This SHOULD always include some Warning header to
              signify that the response was cached by the client, not
              by way of the provided headers.
        r r!s  r�update_headerszBaseHeuristic.update_headers's	���	rc���|j|�}|rK|jj|�|j|�}|�|jjd|i�|S)N�Warning)r&�headers�updater$)r"r#�updated_headers�warning_header_values    r�applyzBaseHeuristic.apply0s]���-�-�h�7������#�#�O�4�#'�<�<��#9� �#�/�� � �'�'��4H�(I�J��rN�r#r
�return�
str | None�r#r
r/�dict[str, str])r#r
r/r
)�__name__�
__module__�__qualname__r$r&r-r rrrrs��	+��	rrc��eZdZdZdd�Zy)�OneDayCachezM
    Cache the response by providing an expires 1 day in the
    future.
    c���i}d|jvr\t|jd�}ttd��t	|dddt
ji���}t|�|d<d|d	<|S)
N�expiresr�)�days��tzinfo)r�public�
cache-control)r)rrrrrrr)r"r#r)rr9s     rr&zOneDayCache.update_headersBsp�����H�,�,�,��X�-�-�f�5�6�D�"�9�!�#4�8�T�"�1�X�;c�V^�Vb�Vb�;c�d�G�!3�G�!<�G�I��'/�G�O�$��rNr1)r3r4r5�__doc__r&r rrr7r7<s���
rr7c�(�eZdZdZdd�Zdd�Zdd�Zy)	�ExpiresAfterz;
    Cache **all** requests for a defined time period.
    c�$�tdi|��|_y)Nr )rr)r"�kws  r�__init__zExpiresAfter.__init__Rs���_��_��
rc�H�t|j�}t|�dd�S)Nr>)r9r?)rrr)r"r#r9s   rr&zExpiresAfter.update_headersUs ���t�z�z�*��-�g�6��R�Rrc�$�d}||jzS)Nz:110 - Automatically cached for %s. Response might be stale)r)r"r#�tmpls   rr$zExpiresAfter.warningYs��K���d�j�j� � rN)rDrr/�Noner1r.)r3r4r5r@rEr&r$r rrrBrBMs���%�S�!rrBc�(�eZdZdZhd�Zdd�Zdd�Zy)�LastModifieda�
    If there is no Expires header already, fall back on Last-Modified
    using the heuristic from
    http://tools.ietf.org/html/rfc7234#section-4.2.2
    to calculate a reasonable value.

    Firefox also does something like this per
    https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching_FAQ
    http://lxr.mozilla.org/mozilla-release/source/netwerk/protocol/http/nsHttpResponseHead.cpp#397
    Unlike mozilla we limit this to 24-hr.
    >�,�-�������������c� �|j}d|vriSd|vr
|ddk7riS|j|jvriSd|vsd|vriSt|d�}|�J�t	j
|dd�}t
|d�}|�iStj�}td||z
�}|t	j
|�z
}tdt|dzd	��}	|	|kriS||	z}
dtjttj|
��iS)
Nr9r?r>rz
last-modifiedr<r�
i�Q)
r)�status�cacheable_by_default_statusesr	rrr�time�max�min�strftime�TIME_FMT�gmtime)r"�respr)�
time_tupler�
last_modifiedr�current_ager�freshness_lifetimer9s           rr&zLastModified.update_headersys!��%)�\�\������I��g�%�'�/�*B�h�*N��I��;�;�d�@�@�@��I��� �O�7�$B��I�!�'�&�/�2�
��%�%�%����z�"�1�~�.��!�'�/�":�;�
�� ��I��i�i�k���!�S�4�Z�(���x���}�5�5�� ��C���
�I�$>�?����,��I��+�+���4�=�=��4�;�;�w�3G�H�I�Irc��yrr )r"ras  rr$zLastModified.warning�s��rN)rar
r/r2)rar
r/r0)r3r4r5r@rZr&r$r rrrKrK^s��
�%�!�J�@rrKr)rrrzdatetime | Noner/r)rrr/�str)�
__future__rrr[rrr�email.utilsrrr	�typingr
rr�pip._vendor.urllib3r
r_rrrr7rBrKr rr�<module>rlsf��#���2�2�;�;�.�.��0�&���
7���B�-��"!�=�!�"<�=�<r