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__/controller.cpython-312.pyc
�

��h�G���dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZmZddl
mZddlmZmZddlmZe
rdd	l	mZdd
lmZddlmZddlmZej4e�Zej:d
�ZdZdd�Z Gd�d�Z!y)z7
The httplib2 algorithms ported for use with requests.
�)�annotationsN)�parsedate_tz)�
TYPE_CHECKING�
Collection�Mapping)�CaseInsensitiveDict)�	DictCache�SeparateBodyBaseCache)�
Serializer)�Literal)�PreparedRequest)�HTTPResponse)�	BaseCachez9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)�-�4c��tj|�}|�J�|j�}|d|d|d|d|dfS)z�Parses a URI using the regex given in Appendix B of RFC 3986.

    (scheme, authority, path, query, fragment) = parse_uri(uri)
    �����)�URI�match�groups)�urirrs   �E/usr/lib/python3/dist-packages/pip/_vendor/cachecontrol/controller.py�	parse_urir%sM��

�I�I�c�N�E�����
�\�\�^�F��1�I�v�a�y�&��)�V�A�Y��q�	�B�B�c���eZdZdZ				d
							dd�Zedd��Zedd��Zdd�Zdd�Z	dd�Z
dd	�Z		d											dd
�Z		d									dd�Z
						dd�Zy)�CacheControllerz4An interface to see if request should cached or not.Nc�t�|�
t�n||_||_|xs
t�|_|xsd|_y)N)����i,rr)r	�cache�cache_etagsr�
serializer�cacheable_status_codes)�selfr$r%r&�status_codess     r�__init__zCacheController.__init__3s7��%*�M�Y�[�u��
�&���$�4�
����&2�&O�6O��#rc���t|�\}}}}}|r|std|z��|j�}|j�}|sd}|xrdj||g�xs|}|dz|z|z}|S)z4Normalize the URL to create a safe key for the cachez(Only absolute URIs are allowed. uri = %s�/�?z://)r�	Exception�lower�join)	�clsr�scheme�	authority�path�query�fragment�request_uri�
defrag_uris	         r�_urlnormzCacheController._urlnorm?s���6?�s�^�2���D�%���Y��F��L�M�M�������O�O�%�	���D��7����$��� 7�?�4���e�^�i�/�+�=�
��rc�$�|j|�S)N)r9)r1rs  r�	cache_urlzCacheController.cache_urlSs���|�|�C� � rc
��tdftdftdfddddddddtdfd�}|jd|jdd��}i}|jd�D]j}|j�s�|jd	d
�}|dj�}	||\}}	|r|	sd||<|s�N	||d
j��||<�l|S#t$rt
j
d|�Y��wxYw#t$r|	rt
j
d
|�Y��t$r$t
j
d||j�Y��wxYw)NTF)NF)�max-agez	max-stale�	min-fresh�no-cache�no-storezno-transformzonly-if-cachedzmust-revalidate�public�privatezproxy-revalidatezs-maxagez
cache-controlz
Cache-Control��,�=rrz,Ignoring unknown cache-control directive: %sz-Missing value for cache-control directive: %sz8Invalid value for cache-control directive %s, must be %s)
�int�get�split�strip�KeyError�logger�debug�
IndexError�
ValueError�__name__)
r(�headers�known_directives�
cc_headers�retval�cc_directive�parts�	directive�typ�requireds
          r�parse_cache_controlz#CacheController.parse_cache_controlWsf���T�{��u���t��%�%�)�+�,�#�$� -��d��
�� �[�[��'�+�+�o�r�2R�S�
�(*��&�,�,�S�1�	�L��%�%�'�� �&�&�s�A�.�E��a����(�I�
� 0�� ;�
��X�
�h�$(��y�!��
�(+�E�!�H�N�N�,<�(=�F�9�%�#	�>�
��-�
����K�Y�W��
��"������N�%���"���L�L�U�!������s*�C�,C1�C.�-C.�1!E�)E�?Ec�d�|j}|�J�|jj|�}|�tj	d�yt|jt�r|jj|�}nd}|jj|||�}|�tjd�|S)zO
        Load a cached response, or return None if it's not available.
        NzNo cache entry availablez1Cache entry deserialization failed, entry ignored)�urlr$rGrKrL�
isinstancer
�get_bodyr&�loads�warning)r(�requestr;�
cache_data�	body_file�results      r�_load_from_cachez CacheController._load_from_cache�s����K�K�	��$�$�$��Z�Z�^�^�I�.�
����L�L�3�4���d�j�j�"7�8��
�
�+�+�I�6�I��I����&�&�w�
�I�F���>��N�N�N�O��
rc���|j�J�|j|j�}tjd|�|j	|j
�}d|vrtjd�yd|vr|ddk(rtjd�y|j
|�}|syt|j�tvrd	}tj|�|St|j
�}|rd
|vrJd|vr0tjd�|jj|�tjd
�ytj�}t|d
�}|�J�tj |dd�}	t#d||	z
�}
tjd|
�|j	|�}d}|j%d�}
|
�|
}tjd|�nQd|vrMt|d�}|�=tj |dd�|	z
}t#d|�}tjd|�|j%d�}
|
�|
}tjd|�|j%d�}|�|
|z
}
tjd|
�||
kDr.tjd�tjd||
�|Sd|vr0tjd�|jj|�y)ze
        Return a cached response if it exists in the cache, otherwise
        return False.
        NzLooking up "%s" in the cacher?z-Request header has "no-cache", cache bypassedFr=rz1Request header has "max_age" as 0, cache bypassedzQReturning cached permanent redirect response (ignoring date and etag information)�date�etagz(Purging cached response: no date or etagz!Ignoring cached response: no daterzCurrent age based on date: %iz#Freshness lifetime from max-age: %i�expiresz#Freshness lifetime from expires: %iz+Freshness lifetime from request max-age: %ir>z'Adjusted current age from min-fresh: %iz2The response is "fresh", returning cached responsez%i > %iz4The cached response is "stale" with no etag, purging)r[r;rKrLrYrPrdrF�status�PERMANENT_REDIRECT_STATUSESrr$�delete�timer�calendar�timegm�maxrG)r(r`r;�cc�resp�msgrP�now�
time_tuplerf�current_age�resp_cc�freshness_lifetime�max_agerh�expire_time�	min_freshs                 r�cached_requestzCacheController.cached_request�s���
�{�{�&�&�&��N�N�7�;�;�/�	����3�Y�?�
�
%�
%�g�o�o�
6������L�L�H�I����?�r�)�}��1��L�L�L�M���$�$�W�-�����t�{�{��:�:�7�
�
�L�L����K�,?����,M���&��/��W�$����G�H��
�
�!�!�)�,��L�L�<�=���i�i�k��!�'�&�/�2�
��%�%�%����z�"�1�~�.���!�S�4�Z�(�����4�k�B��*�*�7�3�����+�+�i�(����!(���L�L�>�@R�S��'�
!�"�7�9�#5�6�G��"�&�o�o�g�b�q�k�:�T�A��%(��K�%8�"����B�DV�W��&�&��#����!(���L�L�=�?Q�
��F�F�;�'�	�� ��9�$�K��L�L�B�K�P���+��L�L�M�N��L�L��$6��D��K��� ��L�L�O�P��J�J���i�(�rc��|j|�}i}|r-t|j�}d|vr|d|d<d|vr|d|d<|S)Nrg�ETagz
If-None-Matchz
last-modifiedz
Last-ModifiedzIf-Modified-Since)rdrrP)r(r`rq�new_headersrPs     r�conditional_headersz#CacheController.conditional_headerss\���$�$�W�-�����0C�D�L�L�0Q�G��� �/6�v���O�,��'�)�3:�?�3K��/�0��rc�\�t|jt�rY|jj||jj||d�|��|�|jj
||�yy|jj||jj|||�|��y)z.
        Store the data in the cache.
        r)rhN)r\r$r
�setr&�dumps�set_body)r(r;r`�response�body�expires_times      r�
_cache_setzCacheController._cache_sets����d�j�j�"7�8�
�J�J�N�N�����%�%�g�x��=�$�
�
����
�
�#�#�I�t�4� �
�J�J�N�N�����%�%�g�x��>�$�
�
rc�D�|xs|j}|j|vr"tjd|j|�yt	|j
�}d|vr+t
|d�}|�J�tj|dd�}nd}|�2d|vr.|dj�rt|d�t|�k7ry|j|j
�}	|j|�}
|j�J�|j|j�}tjd|�d}d	|
vrd
}tjd�d	|	vrd
}tjd�|rK|jj!|�r0tjd
�|jj#|�|ryd|j!dd�vrtjd�y|j$r�d|vr�d}
|j!d�r+t
|d�}|�tj|dd�|z
}
t'|
d�}
tjd|
�d��tjd�|j)|||||
�yt|j�t*vr*tjd�|j)|||d�yd|vr�t
|d�}|�J�tj|dd�}|
j!d�}|�2|dkDr-tjd�|}
|j)|||||
�yd|vrn|drht
|d�}|�tj|dd�|z
}
nd}
tjdj-|
��|j)|||||
�yyyy)zc
        Algorithm for caching requests.

        This assumes a requests Response object.
        zStatus code %s not in %sNrfrr�content-lengthz&Updating cache with response from "%s"Fr@TzResponse header has "no-store"zRequest header has "no-store"z0Purging existing cache entry to honor "no-store"�*�varyrCzResponse header has "Vary: *"rgrhiuzetag object cached for z secondszCaching due to etagzCaching permanent redirectrr=z'Caching b/c date exists and max-age > 0z4Caching b/c of expires header. expires in {} seconds)r'rirKrLrrPrrmrn�isdigitrF�lenrYr[r;r$rGrkr%ror�rj�format)r(r`r�r�r)r'�response_headersrtrf�cc_reqrpr;�no_storer�rhrxs                r�cache_responsezCacheController.cache_response=s���".�!L��1L�1L���?�?�"8�8��L�L�*�H�O�O�=S�
�
�5H����6
���%�%�%�&6�v�&>�?�J��)�)�)��?�?�:�b�q�>�2�D��D�
�� �$4�4� �!1�2�:�:�<��$�%5�6�7�3�t�9�D���)�)�'�/�/�:��
�
%�
%�&6�
7���{�{�&�&�&��N�N�7�;�;�/�	����=�y�I�������H��L�L�9�:�����H��L�L�8�9���
�
���y�1��L�L�K�L��J�J���i�(����"�&�&�v�r�2�2��L�L�8�9������*:� :��L��#�#�I�.�&�'7�	�'B�C���&�#+�?�?�7�2�A�;�#?�$�#F�L��|�Z�8�L��L�L�2�<�.��I�J��L�L�.�/��O�O�I�w��$��M�����
!�%@�
@��L�L�5�6��O�O�I�w��#�>�
�'�
'�%�&6�v�&>�?�J��)�)�)��?�?�:�b�q�>�2�D��f�f�Y�'�G��"�w��{����F�G�&��������� ���.�.�#�I�.�*�+;�I�+F�G�G��*�'/���w�r��{�'C�d�'J��'+���L�L�N�U�U�(���
�O�O�!�� ��$��/�/�'(rc�z�|j�J�|j|j�}|j|�}|s|Sdg}|jj	|jj�D��cic]\}}|j
�|vr||��c}}�d|_|j|||�|Scc}}w)z�On a 304 we will get a new set of headers that we want to
        update our cached value with, assuming we have one.

        This should only ever be called when we've sent an ETag and
        gotten a 304 as the response.
        r�r")	r[r;rdrP�update�itemsr/rir�)r(r`r�r;�cached_response�excluded_headers�k�vs        r�update_cached_responsez&CacheController.update_cached_response�s����{�{�&�&�&��N�N�7�;�;�/�	��/�/��8����O�-�-�����&�&�%�,�,�2�2�4�
��A�q��7�7�9�$4�4��1��
�	
�"%���	
���	�7�O�<����
s�4B7
)NTNN)r$zBaseCache | Noner%�boolr&zSerializer | Noner)�Collection[int] | None)r�str�returnr�)rPzMapping[str, str]r�zdict[str, int | None])r`r
r�zHTTPResponse | None)r`r
r�zHTTPResponse | Literal[False])r`r
r�zdict[str, str])NN)r;r�r`r
r�rr��bytes | Noner�z
int | Noner��None)
r`r
r�rr�r�r)r�r�r�)r`r
r�rr�r)rO�
__module__�__qualname__�__doc__r*�classmethodr9r;rYrdr{rr�r�r��rrr r 0s+��>�#'� �(,�/3�
P��
P��
P�&�	
P�
-�
P�����&�!��!�4�l�*l�\
�("�#'�
���!���	�
��!�
�
��D"�/3�G� �G��G��	G�
-�G�
�
G�R(�&�(�2>�(�	�(rr )rr�r�ztuple[str, str, str, str, str])"r��
__future__rrm�logging�rerl�email.utilsr�typingrrr�pip._vendor.requests.structuresr�pip._vendor.cachecontrol.cacher	r
�"pip._vendor.cachecontrol.serializerr�pip._vendor.requestsr
�pip._vendor.urllib3rr�	getLoggerrOrK�compilerrjrr r�rr�<module>r�sw��
�#���	��$�5�5�?�K�9���4�0�8�	��	�	�8�	$���b�j�j�M�N��(��C�~�~r