� ��^i����ddlZddlZddlmZmZmZddlmZmZdZdd�Z d�Z Gd�de ��Z Gd �d e ��Z Gd �d e ��ZGd �de ��ZdS)�N)� formatdate� parsedate� parsedate_tz)�datetime� timedeltaz%a, %d %b %Y %H:%M:%S GMTc�6�|ptj��}||zS�N)r�utcnow)�delta�dates ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/cachecontrol/heuristics.py� expire_afterr s�� � $�8�?�$�$�D� �%�<��c�h�ttj|�������Sr )r�calendar�timegm� timetuple)�dts r �datetime_to_headerrs"�� �h�o�b�l�l�n�n�5�5� 6� 6�6rc� �eZdZd�Zd�Zd�ZdS)� BaseHeuristicc��dS)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. rrs r �update_headerszBaseHeuristic.update_headers!s ��� rc���|�|��}|rM|j�|��|�|��}|�|j�d|i��|S)N�Warning)r�headers�updater)rr�updated_headers�warning_header_values r �applyzBaseHeuristic.apply*so���-�-�h�7�7�� � K� � � #� #�O� 4� 4� 4�#'�<�<��#9�#9� �#�/�� �'�'��4H�(I�J�J�J��rN)�__name__� __module__� __qualname__rrr&rrr rrsA������ +� +� +���� � � � � rrc��eZdZdZd�ZdS)� OneDayCachezM Cache the response by providing an expires 1 day in the future. c���i}d|jvr_t|jd��}ttd���t |dd�����}t |��|d<d|d<|S) N�expiresr �)�days�)r �public� cache-control)r"rrrrr)rrr"r r-s r rzOneDayCache.update_headers<su���� �H�,� ,� ,��X�-�f�5�6�6�D�"�9�!�#4�#4�#4�8�T�"�1�"�X�;N�O�O�O�G�!3�G�!<�!<�G�I� �'/�G�O� $��rN)r'r(r)�__doc__rrrr r+r+6s-�������� ����rr+c�$�eZdZdZd�Zd�Zd�ZdS)� ExpiresAfterz; Cache **all** requests for a defined time period. c �(�tdi|��|_dS)Nr)rr )r�kws r �__init__zExpiresAfter.__init__Ls���_�_��_�_�� � � rc�N�t|j��}t|��dd�S)Nr1)r-r2)rr r)rrr-s r rzExpiresAfter.update_headersOs'���t�z�*�*��-�g�6�6��R�R�Rrc��d}||jzS)Nz:110 - Automatically cached for %s. Response might be stale)r )rr�tmpls r rzExpiresAfter.warningSs��K���d�j� � rN)r'r(r)r3r8rrrrr r5r5GsN��������%�%�%�S�S�S�!�!�!�!�!rr5c�&�eZdZdZhd�Zd�Zd�ZdS)� 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|ddkriS|j|jvriSd|vsd|vriStjt |d����}t |d��}|�|�iStj��}td||z ��}|tj|��z }tdt|dz d����}||kriS||z} dtj ttj | ����iS) Nr-r2r1r z last-modifiedr� i�Q) r"�status�cacheable_by_default_statusesrrrr�time�max�min�strftime�TIME_FMT�gmtime) r�respr"r � last_modified�now� current_ager �freshness_lifetimer-s r rzLastModified.update_headershs/���,�� �� � ��I� �g� %� %�'�/�*B�h�*N�*N��I� �;�d�@� @� @��I� �� � �O�7�$B�$B��I���|�G�F�O�<�<�=�=��!�'�/�":�;�;� � �<�=�0��I��i�k�k���!�S�4�Z�(�(� ��x��}�5�5�5�� ��C��� �I�$>�$>�?�?�� �� ,� ,��I��+�+���4�=��4�;�w�3G�3G�H�H�I�Irc��dSr r)rrSs r rzLastModified.warning�s���trN)r'r(r)r3rLrrrrr r=r=XsQ������ � �%�%�%�!�J�J�J�<����rr=r )rrM� email.utilsrrrrrrQrr�objectrr+r5r=rrr �r[s(������ � � � �;�;�;�;�;�;�;�;�;�;�(�(�(�(�(�(�(�(� &������ 7�7�7������F����D�����-����"!�!�!�!�!�=�!�!�!�"/�/�/�/�/�=�/�/�/�/�/r