ó
    Þ jN  ã                   óÄ  • S SK Jr  S SKrS SKrS SKrSSKJrJr  SSKJ	r	J
r
Jr  SSKJrJrJrJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  / SQr\R>                  " \ 5      r!Sr"Sr#\RH                  " S\#5      r%Sr&\RH                  " S\&5      r'S r(\RR                  " \(\%5      \RR                  " \(\%5      S.r*\	\
S.r+ " S S\5      r, " S S\,5      r-S r.g)é    )Úabsolute_importNé   )ÚHTTPHeaderDictÚRecentlyUsedContainer)ÚHTTPConnectionPoolÚHTTPSConnectionPoolÚport_by_scheme)ÚLocationValueErrorÚMaxRetryErrorÚProxySchemeUnknownÚProxySchemeUnsupportedÚURLSchemeUnknown)Úsix)Úurljoin)ÚRequestMethods)Úconnection_requires_http_tunnel)ÚRetry)Ú	parse_url)ÚPoolManagerÚProxyManagerÚproxy_from_url)	Úkey_fileÚ	cert_fileÚ	cert_reqsÚca_certsÚssl_versionÚca_cert_dirÚssl_contextÚkey_passwordÚserver_hostname)Ú
key_schemeÚkey_hostÚkey_portÚkey_timeoutÚkey_retriesÚ
key_strictÚ	key_blockÚkey_source_addressÚkey_key_fileÚkey_key_passwordÚkey_cert_fileÚkey_cert_reqsÚkey_ca_certsÚkey_ssl_versionÚkey_ca_cert_dirÚkey_ssl_contextÚkey_maxsizeÚkey_headersÚ
key__proxyÚkey__proxy_headersÚkey__proxy_configÚkey_socket_optionsÚkey__socks_optionsÚkey_assert_hostnameÚkey_assert_fingerprintÚkey_server_hostnameÚPoolKey)r   Úuse_forwarding_for_httpsÚProxyConfigc                 óà  • UR                  5       nUS   R                  5       US'   US   R                  5       US'   S H.  nX2;   d  M
  X#   c  M  [        X#   R                  5       5      X#'   M0     UR	                  S5      nUb  [        U5      US'   [        UR                  5       5       H  nUR                  U5      USU-   '   M     U R                   H  nXR;  d  M
  SX%'   M     U " S0 UD6$ )a»  
Create a pool key out of a request context dictionary.

According to RFC 3986, both the scheme and host are case-insensitive.
Therefore, this function normalizes both before constructing the pool
key for an HTTPS request. If you wish to change this behaviour, provide
alternate callables to ``key_fn_by_scheme``.

:param key_class:
    The class to use when constructing the key. This should be a namedtuple
    with the ``scheme`` and ``host`` keys at a minimum.
:type  key_class: namedtuple
:param request_context:
    A dictionary-like object that contain the context for a request.
:type  request_context: dict

:return: A namedtuple that can be used as a connection pool key.
:rtype:  PoolKey
ÚschemeÚhost)ÚheadersÚ_proxy_headersÚ_socks_optionsNÚsocket_optionsÚkey_© )
ÚcopyÚlowerÚ	frozensetÚitemsÚgetÚtupleÚlistÚkeysÚpopÚ_fields)Ú	key_classÚrequest_contextÚcontextÚkeyÚsocket_optsÚfields         ÚY/var/www/html/gaurav/venv/lib/python3.13/site-packages/pip/_vendor/urllib3/poolmanager.pyÚ_default_key_normalizerrX   O   só   € ð* ×"Ñ"Ó$€GØ Ñ)×/Ñ/Ó1€GˆHÑØ˜f‘o×+Ñ+Ó-€GˆF�Oó ?ˆØ�>˜g™lÓ6Ü$ W¡\×%7Ñ%7Ó%9Ó:ˆG‹Lñ ?ð —+‘+Ð.Ó/€KØÑÜ$)¨+Ó$6ˆÐ Ñ!ô �G—L‘L“NÖ#ˆØ '§¡¨CÓ 0ˆ�˜‘Óñ $ð ×"Ô"ˆØÕØ!ˆG‹Nñ #ñ Ñ�wÑÐó    ©ÚhttpÚhttpsc                   ó†   • \ rS rSrSrSrSrSS jrS rS r	SS jr
S rSS	 jrS
 rSS jrSS jrS rS rS rSS jrSrg)r   éŒ   aØ  
Allows for arbitrary requests while transparently keeping track of
necessary connection pools for you.

:param num_pools:
    Number of connection pools to cache before discarding the least
    recently used pool.

:param headers:
    Headers to include with all requests, unless other headers are given
    explicitly.

:param \**connection_pool_kw:
    Additional parameters are used to create fresh
    :class:`urllib3.connectionpool.ConnectionPool` instances.

Example::

    >>> manager = PoolManager(num_pools=2)
    >>> r = manager.request('GET', 'http://google.com/')
    >>> r = manager.request('GET', 'http://google.com/mail')
    >>> r = manager.request('GET', 'http://yahoo.com/')
    >>> len(manager.pools)
    2

Nc                 ó¤   • [         R                  " X5        X0l        [        U5      U l        [
        U l        [        R                  5       U l        g ©N)r   Ú__init__Úconnection_pool_kwr   ÚpoolsÚpool_classes_by_schemeÚkey_fn_by_schemerG   )ÚselfÚ	num_poolsrA   rb   s       rW   ra   ÚPoolManager.__init__«   s=   € Ü×Ò Ô.Ø"4ÔÜ*¨9Ó5ˆŒ
ô '=ˆÔ#Ü 0× 5Ñ 5Ó 7ˆÕrY   c                 ó   • U $ r`   rF   ©rf   s    rW   Ú	__enter__ÚPoolManager.__enter__µ   s   € ØˆrY   c                 ó$   • U R                  5         g)NF)Úclear)rf   Úexc_typeÚexc_valÚexc_tbs       rW   Ú__exit__ÚPoolManager.__exit__¸   s   € Ø�
‰
ŒàrY   c                 óì   • U R                   U   nUc  U R                  R                  5       nS H  nUR                  US5        M     US:X  a  [         H  nUR                  US5        M     U" X#40 UD6$ )a–  
Create a new :class:`urllib3.connectionpool.ConnectionPool` based on host, port, scheme, and
any additional pool keyword arguments.

If ``request_context`` is provided, it is provided as keyword arguments
to the pool class used. This method is used to actually create the
connection pools handed out by :meth:`connection_from_url` and
companion methods. It is intended to be overridden for customization.
N)r?   r@   Úportr[   )rd   rb   rG   rO   ÚSSL_KEYWORDS)rf   r?   r@   ru   rR   Úpool_clsrT   Úkws           rW   Ú	_new_poolÚPoolManager._new_pool½   s€   € ð ×.Ñ.¨vÑ6ˆØÑ"Ø"×5Ñ5×:Ñ:Ó<ˆOó .ˆCØ×Ñ  TÖ*ñ .ð �VÓß"�Ø×#Ñ# B¨Ö-ñ #ñ ˜Ñ6 oÑ6Ð6rY   c                 ó8   • U R                   R                  5         g)z”
Empty our store of pools and direct them all to close.

This will not affect in-flight connections, but they will not be
re-used after completion.
N)rc   rn   rj   s    rW   rn   ÚPoolManager.clearØ   s   € ð 	�
‰
×ÑÕrY   c                 óô   • U(       d  [        S5      eU R                  U5      nU=(       d    SUS'   U(       d(  [        R                  " US   R	                  5       S5      nX%S'   XS'   U R                  U5      $ )al  
Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme.

If ``port`` isn't given, it will be derived from the ``scheme`` using
``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is
provided, it is merged with the instance's ``connection_pool_kw``
variable and used to create the new connection pool, if one is
needed.
zNo host specified.r[   r?   éP   ru   r@   )r
   Ú_merge_pool_kwargsr	   rK   rH   Úconnection_from_context)rf   r@   ru   r?   Úpool_kwargsrR   s         rW   Úconnection_from_hostÚ PoolManager.connection_from_hostá   sv   € ö Ü$Ð%9Ó:Ð:à×1Ñ1°+Ó>ˆØ$*×$4¨fˆ˜Ñ!ÞÜ!×%Ò% o°hÑ&?×&EÑ&EÓ&GÈÓLˆDØ"&˜ÑØ"&˜Ñà×+Ñ+¨OÓ<Ð<rY   c                 ó°   • US   R                  5       nU R                  R                  U5      nU(       d  [        U5      eU" U5      nU R	                  XAS9$ )zÙ
Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context.

``request_context`` must at least contain the ``scheme`` key and its
value must be a key in ``key_fn_by_scheme`` instance variable.
r?   ©rR   )rH   re   rK   r   Úconnection_from_pool_key)rf   rR   r?   Úpool_key_constructorÚpool_keys        rW   r€   Ú#PoolManager.connection_from_contextø   sZ   € ð ! Ñ*×0Ñ0Ó2ˆØ#×4Ñ4×8Ñ8¸Ó@ÐÞ#Ü" 6Ó*Ð*Ù'¨Ó8ˆà×,Ñ,¨XÐ,ÐWÐWrY   c                 ó  • U R                   R                     U R                   R                  U5      nU(       a  UsSSS5        $ US   nUS   nUS   nU R                  XEXbS9nX0R                   U'   SSS5        U$ ! , (       d  f       W$ = f)zê
Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key.

``pool_key`` should be a namedtuple that only contains immutable
objects. At a minimum it must have the ``scheme``, ``host``, and
``port`` fields.
Nr?   r@   ru   r…   )rc   ÚlockrK   ry   )rf   rˆ   rR   Úpoolr?   r@   ru   s          rW   r†   Ú$PoolManager.connection_from_pool_key  s‰   € ð �Z‰Z�_‹_ð —:‘:—>‘> (Ó+ˆDÞØ÷ ‰_ð % XÑ.ˆFØ" 6Ñ*ˆDØ" 6Ñ*ˆDØ—>‘> &°�>ÐVˆDØ#'�J‰J�xÑ ÷ ð ˆ÷ Œ_ð ˆús   —$A<Á-A<Á<
Bc                 óx   • [        U5      nU R                  UR                  UR                  UR                  US9$ )a–  
Similar to :func:`urllib3.connectionpool.connection_from_url`.

If ``pool_kwargs`` is not provided and a new pool needs to be
constructed, ``self.connection_pool_kw`` is used to initialize
the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs``
is provided, it is used instead. Note that if a new pool does not
need to be created for the request, the provided ``pool_kwargs`` are
not used.
)ru   r?   r�   )r   r‚   r@   ru   r?   )rf   Úurlr�   Úus       rW   Úconnection_from_urlÚPoolManager.connection_from_url  s:   € ô �c‹NˆØ×(Ñ(Ø�F‰F˜Ÿ™¨¯©¸kð )ð 
ð 	
rY   c                 ó´   • U R                   R                  5       nU(       a%  UR                  5        H  u  p4Uc   X#	 M  XBU'   M     U$ ! [         a     M$  f = f)zï
Merge a dictionary of override values for self.connection_pool_kw.

This does not modify self.connection_pool_kw and returns a new dict.
Any keys in the override dictionary with a value of ``None`` are
removed from the merged dictionary.
)rb   rG   rJ   ÚKeyError)rf   ÚoverrideÚbase_pool_kwargsrT   Úvalues        rW   r   ÚPoolManager._merge_pool_kwargs/  se   € ð  ×2Ñ2×7Ñ7Ó9ÐÞØ&Ÿn™nÖ.‘
�Ø‘=ðØ,Ò1ð -2 SÓ)ñ /ð  Ðøô	 $ó Úðús   »A	Á	
AÁAc                 ó~   • U R                   c  g[        U R                   U R                  UR                  5      (       + $ )z“
Indicates if the proxy requires the complete destination URL in the
request.  Normally this is only needed when not using an HTTP CONNECT
tunnel.
F)Úproxyr   Úproxy_configr?   )rf   Ú
parsed_urls     rW   Ú!_proxy_requires_url_absolute_formÚ-PoolManager._proxy_requires_url_absolute_formC  s:   € ð �:‰:ÑØä2Ø�J‰J˜×)Ñ)¨:×+<Ñ+<ó
ô 
ð 	
rY   c                 óÚ   • U R                   b  US:w  a  gU R                   R                  S:w  a  g[        R                  (       a'  U R                  R
                  (       d  [        S5      egg)zu
Validates that were not attempting to do TLS in TLS connections on
Python2 or with unsupported SSL implementations.
Nr\   zfContacting HTTPS destinations through HTTPS proxies 'via CONNECT tunnels' is not supported in Python 2)rš   r?   r   ÚPY2r›   r<   r   )rf   Ú
url_schemes     rW   Ú$_validate_proxy_scheme_url_selectionÚ0PoolManager._validate_proxy_scheme_url_selectionP  s]   € ð
 �:‰:Ñ ¨wÓ!6Øà�:‰:×Ñ Ó'Øä�7�7˜4×,Ñ,×E×EÜ(ðEóð ð Fˆ7rY   c                 óè  • [        U5      nU R                  UR                  5        U R                  UR                  UR
                  UR                  S9nSUS'   SUS'   SU;  a  U R                  R                  5       US'   U R                  U5      (       a  UR                  " X40 UD6nOUR                  " XR                  40 UD6nU=(       a    UR                  5       nU(       d  U$ [        X(5      nUR                  S:X  a&  SnSUS	'   [        US   5      R                  5       US'   UR!                  S
5      n	[#        U	[$        5      (       d  [$        R&                  " X“S9n	U	R(                  (       av  UR+                  U5      (       d`  [-        [.        R0                  " US   5      5      n
U
 H8  nUR3                  5       U	R(                  ;   d  M#  US   R5                  US5        M:      U	R7                  XXvS9n	X”S
'   X4S'   [>        RA                  SX(5        UR=                  5         U R                  " X40 UD6$ ! [8         a'    U	R:                  (       a  UR=                  5         e Us $ f = f)a  
Same as :meth:`urllib3.HTTPConnectionPool.urlopen`
with custom cross-host redirect logic and only sends the request-uri
portion of the ``url``.

The given ``url`` parameter must be absolute, such that an appropriate
:class:`urllib3.connectionpool.ConnectionPool` can be chosen for it.
)ru   r?   FÚassert_same_hostÚredirectrA   i/  ÚGETNÚbodyÚretries)r¦   )ÚresponseÚ_poolzRedirecting %s -> %s)!r   r¢   r?   r‚   r@   ru   rA   rG   r�   ÚurlopenÚrequest_uriÚget_redirect_locationr   Ústatusr   Ú_prepare_for_method_changerK   Ú
isinstancer   Úfrom_intÚremove_headers_on_redirectÚis_same_hostrM   r   ÚiterkeysrH   rO   Ú	incrementr   Úraise_on_redirectÚ
drain_connÚlogÚinfo)rf   Úmethodr�   r¦   rx   r�   Úconnrª   Úredirect_locationr©   rA   Úheaders               rW   r¬   ÚPoolManager.urlopena  s(  € ô �c‹NˆØ×1Ñ1°!·(±(Ô;à×(Ñ(¨¯©°a·f±fÀQÇXÁXÐ(ÐNˆà!&ˆÐÑØˆˆ:‰à˜BÓØ ŸL™L×-Ñ-Ó/ˆBˆy‰Mà×1Ñ1°!×4Ñ4Ø—|’| FÑ6°2Ñ6‰Hà—|’| F¯M©MÑ@¸RÑ@ˆHà$×I¨×)GÑ)GÓ)IÐÞ ØˆOô $ CÓ;Ðà�?‰?˜cÓ!àˆFàˆBˆv‰JÜ*¨2¨i©=Ó9×TÑTÓVˆBˆy‰Mà—&‘&˜Ó#ˆÜ˜'¤5×)Ñ)Ü—n’n WÑ@ˆGð
 ×-×-°d×6GÑ6GØ÷7
ñ 7
ô œ3Ÿ<š<¨¨9©Ó6Ó7ˆGÛ!�Ø—<‘<“> W×%GÑ%GÕGØ�y‘M×%Ñ% f¨dÖ3ñ "ð	Ø×'Ñ'¨¸hÐ'ÐSˆGð  ˆ9‰Ø!ˆ:‰ä�‰Ð'¨Ô@à×ÑÔØ�|Š|˜FÑ<¸Ñ<Ð<øô ó 	Ø×(×(Ø×#Ñ#Ô%ØØŠOð		ús   Ç/I  É .I1É0I1)rb   re   rd   rc   )é
   Nr`   ©Nr[   N©T)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rš   r›   ra   rk   rr   ry   rn   r‚   r€   r†   r‘   r   r�   r¢   r¬   Ú__static_attributes__rF   rY   rW   r   r   Œ   sV   † ñð6 €EØ€Lô8òòô
7ò6ô=ò.Xôô0
ò  ò(
ò÷"D=rY   r   c                   ód   ^ • \ rS rSrSr     SU 4S jjrS	U 4S jjrS
S jrSU 4S jjrSr	U =r
$ )r   i¨  aÂ  
Behaves just like :class:`PoolManager`, but sends all requests through
the defined proxy, using the CONNECT method for HTTPS URLs.

:param proxy_url:
    The URL of the proxy to be used.

:param proxy_headers:
    A dictionary containing headers that will be sent to the proxy. In case
    of HTTP they are being sent with each request, while in the
    HTTPS/CONNECT case they are sent only once. Could be used for proxy
    authentication.

:param proxy_ssl_context:
    The proxy SSL context is used to establish the TLS connection to the
    proxy when using HTTPS proxies.

:param use_forwarding_for_https:
    (Defaults to False) If set to True will forward requests to the HTTPS
    proxy to be made on behalf of the client instead of creating a TLS
    tunnel via the CONNECT method. **Enabling this flag means that request
    and response headers and content will be visible from the HTTPS proxy**
    whereas tunneling keeps request and response headers and content
    private.  IP address, target hostname, SNI, and port are always visible
    to an HTTPS proxy even when this flag is disabled.

Example:
    >>> proxy = urllib3.ProxyManager('http://localhost:3128/')
    >>> r1 = proxy.request('GET', 'http://google.com/')
    >>> r2 = proxy.request('GET', 'http://httpbin.org/')
    >>> len(proxy.pools)
    1
    >>> r3 = proxy.request('GET', 'https://httpbin.org/')
    >>> r4 = proxy.request('GET', 'https://twitter.com/')
    >>> len(proxy.pools)
    3

c                 ó:  >• [        U[        5      (       a&  SUR                  UR                  UR                  4-  n[        U5      nUR                  S;  a  [        UR                  5      eUR                  (       d0  [        R                  " UR                  S5      n	UR                  U	S9nX€l
        U=(       d    0 U l        XPl        [        XV5      U l        U R                  US'   U R                  US'   U R                  US'   [        [         U ]F  " X#40 UD6  g )Nz
%s://%s:%irZ   r~   )ru   Ú_proxyrB   Ú_proxy_config)r±   r   r?   r@   ru   r   r   r	   rK   Ú_replacerš   Úproxy_headersÚproxy_ssl_contextr=   r›   Úsuperr   ra   )rf   Ú	proxy_urlrg   rA   rÎ   rÏ   r<   rb   rš   ru   Ú	__class__s             €rW   ra   ÚProxyManager.__init__Ð  sû   ø€ ô �iÔ!3×4Ñ4Ø$Ø× Ñ Ø—‘Ø—‘ð(ñ ˆIô
 ˜)Ó$ˆà�<‰<Ð0Ó0Ü$ U§\¡\Ó2Ð2à�z�zÜ!×%Ò% e§l¡l°BÓ7ˆDØ—N‘N¨�NÐ-ˆEàŒ
Ø*×0¨bˆÔØ!2ÔÜ'Ð(9ÓTˆÔà'+§z¡zÐ˜8Ñ$Ø/3×/AÑ/AÐÐ+Ñ,Ø.2×.?Ñ.?Ð˜?Ñ+äŒl˜DÒ*¨9ÑTÐASÓTrY   c                 óÔ   >• US:X  a  [         [        U ]  XX4S9$ [         [        U ]  U R                  R                  U R                  R
                  U R                  R                  US9$ )Nr\   )r�   )rÐ   r   r‚   rš   r@   ru   r?   )rf   r@   ru   r?   r�   rÒ   s        €rW   r‚   Ú!ProxyManager.connection_from_hostõ  sh   ø€ Ø�WÓÜœ tÑAØ˜Fð Bð ð ô ”\ 4Ñ=Ø�J‰J�O‰O˜TŸZ™ZŸ_™_¨d¯j©j×.?Ñ.?È[ð >ð 
ð 	
rY   c                 ó~   • SS0n[        U5      R                  nU(       a  XCS'   U(       a  UR                  U5        U$ )zx
Sets headers needed by proxies: specifically, the Accept and Host
headers. Only sets headers not provided by the user.
ÚAcceptz*/*ÚHost)r   ÚnetlocÚupdate)rf   r�   rA   Úheaders_rÙ   s        rW   Ú_set_proxy_headersÚProxyManager._set_proxy_headersÿ  s<   € ð
 ˜eÐ$ˆä˜3“×&Ñ&ˆÞØ%�VÑæØ�O‰O˜GÔ$ØˆrY   c                 ó  >• [        U5      n[        U R                  U R                  UR                  5      (       d0  UR                  SU R                  5      nU R                  X&5      US'   [        [        U ]*  " X4SU0UD6$ )z@Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute.rA   r¦   )r   r   rš   r›   r?   rK   rA   rÜ   rÐ   r   r¬   )rf   r»   r�   r¦   rx   r�   rA   rÒ   s          €rW   r¬   ÚProxyManager.urlopen  sp   ø€ ä�c‹NˆÜ.¨t¯z©z¸4×;LÑ;LÈaÏhÉh×WÑWð —f‘f˜Y¨¯©Ó5ˆGØ ×3Ñ3°CÓAˆBˆy‰Mä”\ 4Ò0°ÑVÀxÐVÐSUÑVÐVrY   )rš   r›   rÎ   rÏ   )rÀ   NNNFrÁ   r`   rÂ   )rÃ   rÄ   rÅ   rÆ   rÇ   ra   r‚   rÜ   r¬   rÈ   Ú__classcell__)rÒ   s   @rW   r   r   ¨  s7   ø† ñ%ðT ØØØØ!&÷#U÷J
ô÷
Wõ 
WrY   r   c                 ó   • [        SSU 0UD6$ )NrÑ   rF   )r   )r�   rx   s     rW   r   r     s   € ÜÑ, #Ð,¨Ñ,Ð,rY   )/Ú
__future__r   ÚcollectionsÚ	functoolsÚloggingÚ_collectionsr   r   Úconnectionpoolr   r   r	   Ú
exceptionsr
   r   r   r   r   Úpackagesr   Úpackages.six.moves.urllib.parser   Úrequestr   Ú
util.proxyr   Ú
util.retryr   Úutil.urlr   Ú__all__Ú	getLoggerrÃ   r¹   rv   Ú_key_fieldsÚ
namedtupler;   Ú_proxy_config_fieldsr=   rX   Úpartialre   rd   r   r   r   rF   rY   rW   Ú<module>rõ      sï   ðÝ &ã Û Û ç ?ß SÑ S÷õ õ Ý 4Ý #Ý 7Ý Ý â
;€ð ×Ò˜Ó!€ð
€ð€ð> ×
 Ò
  ¨KÓ
8€àBÐ Ø×$Ò$ ]Ð4HÓI€ò. ðl ×ÒÐ5°wÓ?Ø×ÒÐ6¸Ó@ñÐ ð
 #5Ð?RÑSÐ ôY=�.ô Y=ôxpW�;ô pWóf-rY   