HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/pip/_vendor/cachecontrol/__pycache__/controller.cpython-311.pyc
�

�mi�J�� �dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZmZddlmZerdd	l
mZdd
lmZddlmZddlmZeje��Zejd
��ZdZ dd�Z!Gd�d��Z"dS)z7
The httplib2 algorithms ported for use with requests.
�)�annotationsN)�parsedate_tz)�
TYPE_CHECKING�
Collection�Mapping)�CaseInsensitiveDict)�	DictCache�SeparateBodyBaseCache)�
Serializer)�Literal)�PreparedRequest)�HTTPResponse)�	BaseCachez9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)�-�4�uri�str�return�tuple[str, str, str, str, str]c��t�|��}|�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)
    N�����)�URI�match�groups)rrrs   �ED:\Python311\Lib\site-packages\pip/_vendor/cachecontrol/controller.py�	parse_urir 'sQ��

�I�I�c�N�N�E�����
�\�\�^�^�F��1�I�v�a�y�&��)�V�A�Y��q�	�B�B�c��eZdZdZ				d+d,d�Zed-d���Zed-d���Zd.d�Zd/d�Z	d0d�Z
d1d�Z		d2d3d&�Z		d2d4d)�Z
d5d*�ZdS)6�CacheControllerz4An interface to see if request should cached or not.NT�cache�BaseCache | None�cache_etags�bool�
serializer�Serializer | None�status_codes�Collection[int] | Nonec�~�|�t��n||_||_|p
t��|_|pd|_dS)N)����i,rr)r	r$r&rr(�cacheable_status_codes)�selfr$r&r(r*s     r�__init__zCacheController.__init__5sD��%*�<�Y�[�[�[�u��
�&���$�4�
�����&2�&O�6O��#�#�#r!rrrc��t|��\}}}}}|r|std|z���|���}|���}|sd}|rd�||g��p|}|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._urlnormAs���6?�s�^�^�2���D�%���	N�Y�	N��F��L�M�M�M��������O�O�%�%�	��	��D��7����$��� 7� 7�?�4���e�^�i�/�+�=�
��r!c�,�|�|��S)N)r@)r8rs  r�	cache_urlzCacheController.cache_urlUs���|�|�C� � � r!�headers�Mapping[str, str]�dict[str, int | None]c
��tdftdftdfddddddddtdfd�}|�d|�dd����}i}|�d��D�]
}|���s�|�d	d
��}|d���}	||\}}	n+#t$rt
�d|��Y�|wxYw|r|	sd||<|r�	||d
�����||<��#t$r |	rt
�d
|��Y��t$r%t
�d||j	��Y��	wxYw��|S)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__)
r0rC�known_directives�
cc_headers�retval�cc_directive�parts�	directive�typ�requireds
          r�parse_cache_controlz#CacheController.parse_cache_controlYs����T�{��u���t��%�%�)�+�,�#�$� -��d��
�
�� �[�[��'�+�+�o�r�2R�2R�S�S�
�(*��&�,�,�S�1�1�	�	�L��%�%�'�'�
�� �&�&�s�A�.�.�E��a����(�(�I�
� 0�� ;�
��X�X���
�
�
����K�Y�W�W�W���
�����
)�h�
)�$(��y�!��
�
�(+��E�!�H�N�N�,<�,<�(=�(=�F�9�%�%��!���������N�%������"�����L�L�U�!������������
� �
s*�6C�%C*�)C*�9&D � 'E7�	*E7�6E7�requestr
�HTTPResponse | Nonec��d|jvrdS|j}|�J�|j�|��}|�t�d��dSt
|jt��r|j�|��}nd}|j	�
|||��}|�t�d��|S)zO
        Load a cached response, or return None if it's not available.
        �RangeNzNo cache entry availablez1Cache entry deserialization failed, entry ignored)rC�urlr$rQrUrV�
isinstancer
�get_bodyr(�loads�warning)r0rcrB�
cache_data�	body_file�results      r�_load_from_cachez CacheController._load_from_cache�s����g�o�%�	��4��K�	��$�$�$��Z�^�^�I�.�.�
��	��L�L�3�4�4�4��4��d�j�"7�8�8�	��
�+�+�I�6�6�I�I��I���&�&�w�
�I�F�F���	P��N�N�N�O�O�O��
r!�HTTPResponse | Literal[False]c���|j�J�|�|j��}t�d|��|�|j��}d|vrt�d��dSd|vr(|ddkrt�d��dS|�|��}|sdSt|j��tvrd	}t�|��|St|j��}|rd
|vrTd|vr4t�d��|j�|��t�d
��dStj
��}t|d
��}|�J�tj|dd���}	t#d||	z
��}
t�d|
��|�|��}d}|�d��}
|
�|
}t�d|��ned|vrat|d��}|�Jtj|dd���|	z
}t#d|��}t�d|��|�d��}
|
�|
}t�d|��|�d��}|� |
|z
}
t�d|
��||
kr8t�d��t�d||
��|Sd|vr4t�d��|j�|��dS)ze
        Return a cached response if it exists in the cache, otherwise
        return False.
        NzLooking up "%s" in the cacherIz-Request header has "no-cache", cache bypassedFrGrz1Request 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: %irHz'Adjusted current age from min-fresh: %iz2The response is "fresh", returning cached responsez%i > %iz4The cached response is "stale" with no etag, purging)rgrBrUrVrbrCrorP�status�PERMANENT_REDIRECT_STATUSESrr$�delete�timer�calendar�timegm�maxrQ)r0rcrB�cc�resp�msgrC�now�
time_tuplerr�current_age�resp_cc�freshness_lifetime�max_agert�expire_time�	min_freshs                 r�cached_requestzCacheController.cached_request�s���
�{�&�&�&��N�N�7�;�/�/�	����3�Y�?�?�?�
�
%�
%�g�o�
6�
6�����	��L�L�H�I�I�I��5���?�	�r�)�}��1�	��L�L�L�M�M�M��5��$�$�W�-�-���	��5��t�{���:�:�	�7�
�
�L�L������K�,?���,M�,M���	�&��/�	��W�$�
-����G�H�H�H��
�!�!�)�,�,�,��L�L�<�=�=�=��5��i�k�k��!�'�&�/�2�2�
��%�%�%���z�"�1�"�~�.�.���!�S�4�Z�(�(�����4�k�B�B�B��*�*�7�3�3�����+�+�i�(�(���
	X�!(���L�L�>�@R�S�S�S�S��'�
!�	X�"�7�9�#5�6�6�G��
X�&�o�g�b�q�b�k�:�:�T�A��%(��K�%8�%8�"����B�DV�W�W�W��&�&��#�#���	�!(���L�L�=�?Q�
�
�
��F�F�;�'�'�	��	Q��9�$�K��L�L�B�K�P�P�P���+�	��L�L�M�N�N�N��L�L��$6��D�D�D��K��� �	)��L�L�O�P�P�P��J���i�(�(�(��ur!�dict[str, str]c��|�|��}i}|r2t|j��}d|vr|d|d<d|vr|d|d<|S)Nrs�ETagz
If-None-Matchz
last-modifiedz
Last-ModifiedzIf-Modified-Since)rorrC)r0rcr}�new_headersrCs     r�conditional_headersz#CacheController.conditional_headerssq���$�$�W�-�-�����	L�0C�D�L�0Q�0Q�G��� �
?�/6�v���O�,��'�)�
L�3:�?�3K��/�0��r!rB�responser�body�bytes | None�expires_time�
int | None�Nonec�X�t|jt��rX|j�||j�||d��|���|�|j�||��dSdS|j�||j�|||��|���dS)z.
        Store the data in the cache.
        r!)rtN)rhr$r
�setr(�dumps�set_body)r0rBrcr�r�r�s      r�
_cache_setzCacheController._cache_set&s����d�j�"7�8�8�	�
�J�N�N����%�%�g�x��=�=�$�
�
�
�
��
5��
�#�#�I�t�4�4�4�4�4�
5�
5�
�J�N�N����%�%�g�x��>�>�$�
�
�
�
�
�
r!�response_or_ref�2HTTPResponse | weakref.ReferenceType[HTTPResponse]c��t|tj��r|��}|�dSn|}|p|j}|j|vr#t
�d|j|��dSt|j��}d|vr6t|d��}|�J�tj|dd���}	nd}	|�Fd|vrB|d���r(t|d��t|��krdS|�|j��}
|�|��}|j�J�|�|j��}t
�d|��d}
d	|vrd
}
t
�d��d	|
vrd
}
t
�d��|
rN|j�|��r4t
�d
��|j�|��|
rdSd|�dd��vrt
�d��dS|jr�d|vr�d}|�d��r6t|d��}|�tj|dd���|	z
}t-|d��}t
�d|�d���t
�d��|�|||||��dSt|j��t0vr4t
�d��|�|||d��dSd|v�rt|d��}|�J�tj|dd���}	|�d��}|�=|dkr7t
�d��|}|�|||||��dSd|vr�|dr�t|d��}|� tj|dd���|	z
}nd}t
�d�|����|�|||||��dSdSdSdS)zc
        Algorithm for caching requests.

        This assumes a requests Response object.
        NzStatus code %s not in %srrrr�content-lengthz&Updating cache with response from "%s"FrJTzResponse header has "no-store"zRequest header has "no-store"z0Purging existing cache entry to honor "no-store"�*�varyrMzResponse header has "Vary: *"rsrtiuzetag object cached for z secondszCaching due to etagzCaching permanent redirectr!rGz'Caching b/c date exists and max-age > 0z4Caching b/c of expires header. expires in {} seconds)rh�weakref�
ReferenceTyper/rurUrVrrCrryrz�isdigitrP�lenrbrgrBr$rQrwr&r{r�rv�format)r0rcr�r�r*r�r/�response_headersr�rr�cc_reqr|rB�no_storer�rtr�s                 r�cache_responsezCacheController.cache_responseDs&���o�w�'<�=�=�	'�&��(�(�H��
���	
�'�H�".�!L��1L���?�"8�8�	��L�L�*�H�O�=S�
�
�
�
�F�5H���6
�6
���%�%�	�%�&6�v�&>�?�?�J��)�)�)��?�:�b�q�b�>�2�2�D�D��D�
�	� �$4�4�	�!�!1�2�:�:�<�<�	��$�%5�6�7�7�3�t�9�9�D�		�
�F��)�)�'�/�:�:��
�
%�
%�&6�
7�
7���{�&�&�&��N�N�7�;�/�/�	����=�y�I�I�I������	;��H��L�L�9�:�:�:����	:��H��L�L�8�9�9�9��	)��
���y�1�1�	)��L�L�K�L�L�L��J���i�(�(�(��	��F��"�&�&�v�r�2�2�2�	��L�L�8�9�9�9��F���<	��*:� :�<	��L��#�#�I�.�.�
G�&�'7�	�'B�C�C���G�#+�?�7�2�A�2�;�#?�#?�$�#F�L��|�Z�8�8�L��L�L�I�<�I�I�I�J�J�J��L�L�.�/�/�/��O�O�I�w��$��M�M�M�M�M����
!�
!�%@�
@�-	��L�L�5�6�6�6��O�O�I�w��#�>�>�>�>�>�
�'�
'�&	�%�&6�v�&>�?�?�J��)�)�)��?�:�b�q�b�>�2�2�D��f�f�Y�'�'�G�� 
�w��{� 
����F�G�G�G�&��������� �������.�.�
�#�I�.��*�+;�I�+F�G�G�G��,�'/��w�r��r�{�'C�'C�d�'J���'+���L�L�N�U�U�(������
�O�O�!�� ��$������A&	�&	�&
�
��r!c�<��|j�J�|�|j��}|�|��}|s|Sdg�|j��fd�|j���D����d|_|�|||��|S)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.
        Nr�c�H��i|]\}}|����v�||��S�)r6)�.0�k�v�excluded_headerss   �r�
<dictcomp>z:CacheController.update_cached_response.<locals>.<dictcomp>�sC���
�
�
��A�q��7�7�9�9�$4�4�
��1�
�
�
r!r-)rgrBrorC�update�itemsrur�)r0rcr�rB�cached_responser�s     @r�update_cached_responsez&CacheController.update_cached_response�s�����{�&�&�&��N�N�7�;�/�/�	��/�/��8�8���	��O�-�-����&�&�
�
�
�
�$�,�2�2�4�4�
�
�
�	
�	
�	
�"%���	
���	�7�O�<�<�<��r!)NTNN)r$r%r&r'r(r)r*r+)rrrr)rCrDrrE)rcr
rrd)rcr
rrp)rcr
rr�)NN)rBrrcr
r�rr�r�r�r�rr�)
rcr
r�r�r�r�r*r+rr�)rcr
r�rrr)rY�
__module__�__qualname__�__doc__r1�classmethodr@rBrbror�r�r�r�r�r�r!rr#r#2s9������>�>�#'� �(,�/3�
P�
P�
P�
P�
P������[��&�!�!�!��[�!�4�4�4�4�l����4l�l�l�l�\
�
�
�
�("�#'�
�����D"�/3�Q�Q�Q�Q�Q�f(�(�(�(�(�(r!r#)rrrr)#r��
__future__rry�logging�rerxr��email.utilsr�typingrrr�pip._vendor.requests.structuresr�pip._vendor.cachecontrol.cacher	r
�"pip._vendor.cachecontrol.serializerr�pip._vendor.requestsr
�pip._vendor.urllib3rr�	getLoggerrYrU�compilerrvr r#r�r!r�<module>r�s���
��#�"�"�"�"�"���������	�	�	�	���������$�$�$�$�$�$�5�5�5�5�5�5�5�5�5�5�?�?�?�?�?�?�K�K�K�K�K�K�K�K�9�9�9�9�9�9��9�������4�4�4�4�4�4�0�0�0�0�0�0�8�8�8�8�8�8�	��	�8�	$�	$���b�j�M�N�N��(��C�C�C�C�M�M�M�M�M�M�M�M�M�Mr!