U ʗRe H@s~UdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlmZmZmZmZmZmZmZmZmZmZddlmZmZddlmZ ddl!m"Z"m#Z#ddl!m$Z%ddl&m'Z'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0dd l1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mZ>m?Z?ddl@mAZAerddlBmCZCddlDmEZEeFeGZHeeIeIeeeJeIffZKejLde.dddddddgZMeeKeNd<d ZOePd!d"d#ZQeId!d$d%ZRGd&d'd'e#ZSGd(d)d)ZTGd*d+d+eTe%Z$Gd,d-d-eTe ZGd.d/d/e$ZUGd0d1d1eZVGd2d3d3ejWZXdS)4zhPipSession and supporting code, containing all pip-specific network request configuration and behavior. N) TYPE_CHECKINGAnyDict GeneratorListMappingOptionalSequenceTupleUnion)requestsurllib3)CacheControlAdapter)DEFAULT_POOLBLOCK BaseAdapter) HTTPAdapter)PreparedRequestResponse)CaseInsensitiveDict)ConnectionPool)InsecureRequestWarning) __version__)get_default_environment)Link)MultiDomainBasicAuth) SafeFileCache)has_tls)libc_ver)build_url_from_netloc parse_netloc) url_to_path) SSLContext) PoolManagerignore)category)https*r&)r& localhostr&)r&z 127.0.0.0/8r&)r&z::1/128r&)filer&N)sshr&r&SECURE_ORIGINS) BUILD_BUILDIDBUILD_IDCI PIP_IS_CIreturncCstddtDS)z? Return whether it looks like pip is running under CI. css|]}|tjkVqdSN)osenviron).0namer6/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/network/session.py jsz looks_like_ci..)anyCI_ENVIRONMENT_VARIABLESr6r6r6r7 looks_like_cicsr;c Csdtdtdtid}|dddkr@t|dd<n|dddkrtj}|jd krl|d d }d d d|D|dd<nB|dddkrt|dd<n |dddkrt|dd<tjdrTddl m }| | | f}ttddtdddg|}ttddtddgt}|rF||d<|rT||d<tjdrtdrdtdd|d<trt|did<trt|did<trt|d<trdd l}|j|d <td!}|d k rt|j |d"<td#d k rzztj d#d$gtj!d%d&}Wnt"k rVYn$X|d'rz|#d(d)$|d*<t%rd+nd |d,<t&j'(d-} | d k r| |d.<d/j)|t*j+|d0d+d1d2S)3z6 Return a string representing the user agent. pip)r5versionr5) installerpythonimplementationr@CPythonr=PyPyfinalN.cSsg|] }t|qSr6)str)r4xr6r6r7 szuser_agent..Jython IronPythonlinuxr)distrocSs|dSNr6rGr6r6r7zuser_agent..idcSs|dSrMr6rOr6r6r7rPrQliblibcrLdarwinmacOSsystemreleasecpuopenssl_version setuptoolssetuptools_versionrustcz --versiong?)stderrtimeoutsrustc  rN rustc_versionTciPIP_USER_AGENT_USER_DATA user_dataz9{data[installer][name]}/{data[installer][version]} {json}),:) separators sort_keys)datajson),rplatformpython_versionpython_implementationsyspypy_version_info releaseleveljoin startswith pip._vendorrLr5r=codenamedictfilterziprmac_verrW setdefaultrXmachiner_sslOPENSSL_VERSIONrget_distributionrFshutilwhich subprocess check_outputSTDOUT Exceptionsplitdecoder;r2r3getformatrjdumps) rirorLlinux_distribution distro_infosrTsslsetuptools_dist rustc_outputrdr6r6r7 user_agentms               rc @sreZdZd eeeeeeeeffeee feee ee e ffee e e fe dddZ dddd Z dS) LocalFSAdapterFNT)requeststreamr_verifycertproxiesr0c Cst|j}t}d|_|j|_zt|} WnRtk r~} z4d|_t| j|_ t |j d|  d|_ W5d} ~ XYnPXtjj| jdd} t|dpd} t| | j| d |_t|d |_ |j j|_|S) Niz: utf8T)usegmtrz text/plain)z Content-TypezContent-Lengthz Last-Modifiedrb)r urlr status_coder2statOSErrortype__name__reasonioBytesIOencoderawemailutils formatdatest_mtime mimetypes guess_typerst_sizeheadersopenclose) selfrrr_rrrpathnamerespstatsexcmodified content_typer6r6r7sends*  0  zLocalFSAdapter.sendr/cCsdSr1r6)rr6r6r7rszLocalFSAdapter.close)FNTNN)r __module__ __qualname__rboolrr floatr rFrrrrr6r6r6r7rs  'rcsReZdZdZddededdfddZefeee edd fd d Z Z S) _SSLContextAdapterMixina#Mixin to add the ``ssl_context`` constructor argument to HTTP adapters. The additional argument is forwarded directly to the pool manager. This allows us to dynamically decide what SSL store to use at runtime, which is used to implement the optional ``truststore`` backend. N) ssl_contextr!)rkwargsr0c s||_tjf|dSr1) _ssl_contextsuper__init__)rrr __class__r6r7rsz _SSLContextAdapterMixin.__init__r") connectionsmaxsizeblock pool_kwargsr0c s2|jdk r|d|jtjf|||d|S)Nr)rrr)rryrinit_poolmanager)rrrrrrr6r7rs z(_SSLContextAdapterMixin.init_poolmanager) rrr__doc__rrrrintrr __classcell__r6r6rr7rs  rc@s eZdZdS)rNrrrr6r6r6r7r src@s eZdZdS)rNrr6r6r6r7r$src sFeZdZeeeeefeeeeeeffddfdd Z Z S)InsecureHTTPAdapterNconnrrrr0cstj||d|ddSNF)rrrrr cert_verifyrrrrrrr6r7r)szInsecureHTTPAdapter.cert_verify rrrrrFr rrr rrr6r6rr7r(s  rc sFeZdZeeeeefeeeeeeffddfdd Z Z S)InsecureCacheControlAdapterNrcstj||d|ddSrrrrr6r7r4sz'InsecureCacheControlAdapter.cert_verifyrr6r6rr7r3s  rc seZdZUdZeeed<ddddddeeeee eee eededdfdd Z e edd d d Z deeee ddddZeeddfdddZee dddZeeeeedfdd ZZS) PipSessionNr_rr6)retriescache trusted_hosts index_urlsrr!)argsrrrrrrr0c stj||g|_t|jd<t|d|_tj|ddddgdd}t |d }|rxt t |||d } t t ||d |_ nt||d } ||_ |d | |d||dt|D]} |j| ddqdS)zj :param trusted_hosts: Domains not to emit warnings for when not using HTTPS. z User-Agent)riiiig?)totalstatus_forcelistbackoff_factor) max_retries)rrr)rr)rrzhttps://zhttp://zfile://T)suppress_loggingN)rrpip_trusted_originsrrrauthr Retryrrrr_trusted_host_adapterrmountradd_trusted_host) rrrrrrrrinsecure_adaptersecure_adapterhostrr6r7rBs6        zPipSession.__init__)new_index_urlsr0cCs ||j_dS)zn :param new_index_urls: New index urls to update the authentication handler with. N)rr)rrr6r6r7update_index_urlsszPipSession.update_index_urlsF)rsourcerr0cCs|s0d|}|dk r&|d|d7}t|t|}||jkrN|j||t|ddd|j|t|d|j|ds|t|ddd |j|t|d |jdS) 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: Nz (from )http)scheme/rNrf)loggerinforrappendrrr)rrrrmsg host_portr6r6r7rs&     zPipSession.add_trusted_hostr/ccs6tEdH|jD] \}}d||dkr(dn|fVqdS)Nr&)r*r)rrportr6r6r7iter_secure_originss zPipSession.iter_secure_origins)locationr0c Cstjt|}|j|j|j}}}|ddd}|D]}|\}}} ||kr^|dkr^q>zt |pjd} t |} Wn4t k r|r| | kr|dkrYq>Yn X| | krq>|| kr| dkr| dk rq>dStd||dS) N+rNr&TzThe 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)urllibparseurlparserFrhostnamerrsplitr ipaddress ip_address ip_network ValueErrorlowerrwarning) rrparsedorigin_protocol origin_host origin_port secure_originsecure_protocol secure_host secure_portaddrnetworkr6r6r7is_secure_originsJ     zPipSession.is_secure_origin)methodrrrr0cs2|d|j|d|jtj||f||S)Nr_r)ryr_rrr)rrrrrrr6r7rszPipSession.request)NF)rrrr_rr__annotations__rrFr rrrrrr SecureOriginrrrrrrr6r6rr7r>s8  O Cr)Yr email.utilsrrrrjloggingrr2rkr~rrn urllib.parserwarningstypingrrrrrrrr r r rsr r pip._vendor.cachecontrolr_BaseCacheControlAdapterZpip._vendor.requests.adaptersrrr_BaseHTTPAdapterZpip._vendor.requests.modelsrrZpip._vendor.requests.structuresrZ"pip._vendor.urllib3.connectionpoolrZpip._vendor.urllib3.exceptionsrr<rpip._internal.metadatarpip._internal.models.linkrpip._internal.network.authrpip._internal.network.cacherpip._internal.utils.compatrpip._internal.utils.glibcrpip._internal.utils.miscrrpip._internal.utils.urlsr rr!Zpip._vendor.urllib3.poolmanagerr" getLoggerrrrFrrfilterwarningsr*rr:rr;rrrrrSessionrr6r6r6r7sl0                   e,"