3 ReE7 @ s d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m Z ddlmZ ej eZejdZd d ZG dd deZdS ) z7 The httplib2 algorithms ported for use with requests. N)parsedate_tz)CaseInsensitiveDict ) DictCache) Serializerz9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?c C s0 t j| j }|d |d |d |d |d fS )zParses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) r )URImatchgroups)urir r /builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/cachecontrol/controller.py parse_uri s r c @ s\ e Zd ZdZdddZedd Zedd Zd d Zdd Z dd Z dddZdd ZdS )CacheControllerz9An interface to see if request should cached or not. NTc C s4 |d krt n|| _|| _|p"t | _|p,d| _d S )N , - )r r r r )r cachecache_etagsr serializercacheable_status_codes)selfr r r status_codesr r r __init__" s zCacheController.__init__c C sl t |\}}}}}| s| r*td| |j }|j }|sBd}|rTdj||gpV|}|d | | }|S )z4Normalize the URL to create a safe key for the cachez(Only absolute URIs are allowed. uri = %s/?z://)r Exceptionlowerjoin) clsr scheme authoritypathqueryfragmentrequest_uri defrag_urir r r _urlnorm* s zCacheController._urlnormc C s | j |S )N)r+ )r# r r r r cache_url> s zCacheController.cache_urlc C s2 t dft dft dfddddddddt dfd}|jd|jdd}i }x|jdD ]}|j s`qR|jdd }|d j }y|| \}} W n" tk r tjd| wRY nX | s| rd ||<