3 ”Reh;ã@sÚdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z m Z m Z ddlmZddlmZmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd l m!Z!dd l"m#Z#m$Z$ddl%m&Z&ddl'm(Z(m)Z)m*Z*ddl+m,Z,ddl-m.Z.e,�rXddl/m0Z0m1Z1m2Z2m3Z3m4Z4ddl5m6Z6e3e7e7e2e4e8e7ffZ9ej:e;ƒZd3Z?d!d"„Z@d#d$„ZAGd%d&„d&eƒZBGd'd(„d(eƒZCGd)d*„d*eƒZDGd+d,„d,e jEƒZFdS)4zhPipSession and supporting code, containing all pip-specific network request configuration and behavior. éN)ÚrequestsÚsixÚurllib3)ÚCacheControlAdapter)Ú BaseAdapterÚ HTTPAdapter)ÚResponse)ÚCaseInsensitiveDict)Úparse)ÚInsecureRequestWarning)Ú __version__)ÚMultiDomainBasicAuth)Ú SafeFileCache)Úhas_tlsÚ ipaddress)Úlibc_ver)Úbuild_url_from_netlocÚget_installed_versionÚ parse_netloc)ÚMYPY_CHECK_RUNNING)Ú url_to_path)ÚIteratorÚListÚOptionalÚTupleÚUnion)ÚLinkÚignore)ÚcategoryÚhttpsÚ*Ú localhostú 127.0.0.0/8ú::1/128ÚfileÚsshÚ BUILD_BUILDIDÚBUILD_IDÚCIÚ PIP_IS_CIcCstdd„tDƒƒS)z? Return whether it looks like pip is running under CI. css|]}|tjkVqdS)N)ÚosÚenviron)Ú.0Úname©r.úŒ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/network/session.pyú `sz looks_like_ci..)ÚanyÚCI_ENVIRONMENT_VARIABLESr.r.r.r/Ú looks_like_ciXsr3cCsLdtdœtjƒdtjƒidœ}|dddkr@tjƒ|dd<n’|dddkr�tjjd krltjd d …}ntj}d jd d„|Dƒƒ|dd<nB|dddkr²tjƒ|dd<n |dddkrÒtjƒ|dd<tjjdƒ�rHddl m }t t dd„t dddg|jƒƒƒƒ}t t dd„t ddgtƒƒƒƒ}|�r:||d<|�rH||d<tjjdƒ�rztjƒd�rzdtjƒddœ|d<tjƒ�r˜tjƒ|jdiƒd<tjƒ�r¶tjƒ|jdiƒd<tjƒ�rÌtjƒ|d<tƒ�rædd l}|j|d <td!ƒ}|d k �r||d"<tƒ�r d#nd |d$<tjjd%ƒ}|d k �r2||d&<d'j|tj|d,d#d*�d+�S)-z6 Return a string representing the user agent. Úpip)r-Úversionr-)Ú installerÚpythonÚimplementationr8ÚCPythonr5ÚPyPyÚfinalNéÚ.cSsg|] }t|ƒ‘qSr.)Ústr)r,Úxr.r.r/ú wszuser_agent..ÚJythonÚ IronPythonÚlinuxr)ÚdistrocSs|dS)Nér.)r?r.r.r/Úƒszuser_agent..ÚidcSs|dS)NrEr.)r?r.r.r/rF‡sÚlibÚlibcrDÚdarwinÚmacOSÚsystemÚreleaseÚcpuÚopenssl_versionÚ setuptoolsÚsetuptools_versionTÚciÚPIP_USER_AGENT_USER_DATAÚ user_dataz9{data[installer][name]}/{data[installer][version]} {json}ú,ú:)Ú separatorsÚ sort_keys)ÚdataÚjson)rUrV) r ÚplatformÚpython_versionÚpython_implementationÚsysÚpypy_version_infoÚ releaselevelÚjoinÚ startswithÚ pip._vendorrDÚdictÚfilterÚzipÚlinux_distributionrÚmac_verrLÚ setdefaultrMÚmachinerÚ_sslÚOPENSSL_VERSIONrr3r*r+ÚgetÚformatrZÚdumps)rYr_rDÚ distro_infosrIÚsslrQrTr.r.r/Ú user_agentcs`          rrc@seZdZddd„Zdd„ZdS)ÚLocalFSAdapterNc Cs®t|jƒ}tƒ}d|_|j|_ytj|ƒ} Wn.tk rZ} zd|_| |_WYdd} ~ XnPXtj j | j dd�} t j |ƒdp~d} t| | j| dœƒ|_t|dƒ|_|jj|_|S) NéÈi”T)Úusegmtrz text/plain)z Content-TypezContent-Lengthz Last-ModifiedÚrb)rÚurlrÚ status_coder*ÚstatÚOSErrorÚrawÚemailÚutilsÚ formatdateÚst_mtimeÚ mimetypesÚ guess_typer Úst_sizeÚheadersÚopenÚclose) ÚselfÚrequestÚstreamÚtimeoutÚverifyÚcertÚproxiesÚpathnameÚrespÚstatsÚexcÚmodifiedÚ content_typer.r.r/Úsendµs$    zLocalFSAdapter.sendcCsdS)Nr.)r†r.r.r/r…ÐszLocalFSAdapter.close)NNNNN)Ú__name__Ú __module__Ú __qualname__r“r…r.r.r.r/rs³s rscseZdZ‡fdd„Z‡ZS)ÚInsecureHTTPAdaptercstt|ƒj||d|d�dS)NF)ÚconnrwrŠr‹)Úsuperr—Ú cert_verify)r†r˜rwrŠr‹)Ú __class__r.r/ršÖs zInsecureHTTPAdapter.cert_verify)r”r•r–ršÚ __classcell__r.r.)r›r/r—Ôsr—cseZdZ‡fdd„Z‡ZS)ÚInsecureCacheControlAdaptercstt|ƒj||d|d�dS)NF)r˜rwrŠr‹)r™r�rš)r†r˜rwrŠr‹)r›r.r/ršÞs z'InsecureCacheControlAdapter.cert_verify)r”r•r–ršrœr.r.)r›r/r�Üsr�csFeZdZdZ‡fdd„Zd dd„Zdd„Zd d „Z‡fd d „Z‡Z S)Ú PipSessionNc s|jddƒ}|jddƒ}|jdgƒ}|jddƒ}tt|ƒj||Žg|_tƒ|jd<t|d�|_t j |d d d d gd d�}t |d�}|rªt t |ƒ|d�}tt |ƒ|d�|_nt|d�}||_|jd|ƒ|jd|ƒ|jdtƒƒx|D]} |j| dd�qæWdS)zj :param trusted_hosts: Domains not to emit warnings for when not using HTTPS. ÚretriesrÚcacheNÚ trusted_hostsÚ index_urlsz User-Agent)r¢iôi÷iigÐ?)ÚtotalÚstatus_forcelistÚbackoff_factor)Ú max_retries)r r¦zhttps://zhttp://zfile://T)Úsuppress_logging)Úpopr™ržÚ__init__Úpip_trusted_originsrrrƒr ÚauthrÚRetryr—rrr�Ú_trusted_host_adapterrÚmountrsÚadd_trusted_host) r†ÚargsÚkwargsrŸr r¡r¢Úinsecure_adapterÚsecure_adapterÚhost)r›r.r/r©ès6             zPipSession.__init__FcCs„|s.dj|ƒ}|dk r$|dj|ƒ7}tj|ƒt|ƒ}||jkrL|jj|ƒ|jt|ƒd|jƒ|ds€|jt|ƒd|jƒdS)zÒ :param host: It is okay to provide a host that has previously been added. :param source: An optional source string, for logging where the host string came from. zadding trusted host: {!r}Nz (from {})ú/rErV) rnÚloggerÚinforrªÚappendr®rr­)r†r´Úsourcer§ÚmsgÚ host_portr.r.r/r¯4s      zPipSession.add_trusted_hostccsDxtD] }|VqWx*|jD] \}}d||dkr4dn|fVqWdS)Nr )ÚSECURE_ORIGINSrª)r†Ú secure_originr´Úportr.r.r/Úiter_secure_originsQs  zPipSession.iter_secure_originsc Csþtjt|ƒƒ}|j|j|j}}}|jddƒd}x¶|jƒD]ª}|\}}} ||kr^|dkr^q>y0tj |dkrpdnt j |ƒƒ} tj t j |ƒƒ} Wn2t k rÀ|r¼|jƒ|jƒkr¼|dkr¼w>Yn X| | krÌq>|| kræ| dkræ| dk ræq>dSWtjd||ƒdS)Nú+rEr TzõThe repository located at %s is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host %s'.Féÿÿÿÿ)Ú urllib_parseÚurlparser>ÚschemeÚhostnamer¾Úrsplitr¿rÚ ip_addressrÚ ensure_textÚ ip_networkÚ ValueErrorÚlowerr¶Úwarning) r†ÚlocationÚparsedÚorigin_protocolÚ origin_hostÚ origin_portr½Úsecure_protocolÚ secure_hostÚ secure_portÚaddrÚnetworkr.r.r/Úis_secure_originXs<   zPipSession.is_secure_origincs(|jd|jƒtt|ƒj||f|ž|ŽS)Nr‰)rir‰r™ržr‡)r†Úmethodrwr°r±)r›r.r/r‡ szPipSession.request)NF) r”r•r–r‰r©r¯r¿r×r‡rœr.r.)r›r/ržäs  L Hrž)rr r )r r!r )r r"r )r r#r )r$r N)r%r r )r&r'r(r))GÚ__doc__Ú email.utilsr|rZÚloggingr€r*r[r^ÚwarningsrcrrrZpip._vendor.cachecontrolrZpip._vendor.requests.adaptersrrZpip._vendor.requests.modelsrZpip._vendor.requests.structuresr Zpip._vendor.six.moves.urllibr rÂZpip._vendor.urllib3.exceptionsr r4r Úpip._internal.network.authr Úpip._internal.network.cacherÚpip._internal.utils.compatrrÚpip._internal.utils.glibcrÚpip._internal.utils.miscrrrÚpip._internal.utils.typingrÚpip._internal.utils.urlsrÚtypingrrrrrÚpip._internal.models.linkrr>ÚintZ SecureOriginÚ getLoggerr”r¶Úfilterwarningsr¼r2r3rrrsr—r�ÚSessionržr.r.r.r/ÚsZ               P!