a ˆljE7 ã @ s„ d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m Z ddlmZ e e¡Ze d¡Zd d „ ZG dd„ deƒZdS ) z7 The httplib2 algorithms ported for use with requests. é N)Úparsedate_tz)ÚCaseInsensitiveDicté )Ú DictCache)Ú Serializerz9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?c C s0 t | ¡ ¡ }|d |d |d |d |d fS )z‡Parses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) r é é é é )ÚURIÚmatchÚgroups)Úurir © r úG/usr/lib/python3.9/site-packages/pip/_vendor/cachecontrol/controller.pyÚ parse_uri s r c @ s\ e Zd ZdZddd„Zedd„ ƒZedd „ ƒZd d„ Zdd „ Z dd„ Z ddd„Zdd„ ZdS )ÚCacheControllerz9An interface to see if request should cached or not. NTc C s4 |d u rt ƒ n|| _|| _|p"tƒ | _|p,d| _d S )N)éÈ éË i, é- )r ÚcacheÚcache_etagsr Ú serializerÚcacheable_status_codes)Úselfr r r Ústatus_codesr r r Ú__init__" s zCacheController.__init__c C sh t |ƒ\}}}}}|r|s&td| ƒ‚| ¡ }| ¡ }|s>d}|rPd ||g¡pR|}|d | | }|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 ÚschemeZ authorityÚpathÚqueryÚfragmentZrequest_uriZ defrag_urir r r Ú_urlnorm* s zCacheController._urlnormc C s | |¡S ©N)r' )r" r r r r Ú cache_url> s zCacheController.cache_urlc C s" t dft dft dfddddddddt dfdœ}| d| dd¡¡}i }| d¡D ]Ì}| ¡ s^qP| d d ¡}|d ¡ }z|| \}} W n" ty¨ t d|¡ Y qPY n0 |r²| sºd ||<