
    F2j*                       d dl mZ d dlZd dlZd dlmZ ej        r6ddlmZ ddl	m
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ eej        Zn G d de          Z G d de          Z  G d de!          Z" G d de           Z# G d de#          Z$ G d de           Z G d de           Z% G d de           Z& G d d e           Z'e'Z( G d! d"e$          Z) G d# d$e$          Z* G d% d&e           Z+ G d' d(e           Z, G d) d*e,e$          Z- G d+ d,e,          Z. G d- d.e.e           Z/ G d/ d0e/          Z0 G d1 d2e#          Z1 G d3 d4e#          Z2 G d5 d6e#          Z3 G d7 d8e4e           Z5 G d9 d:e5          Z6 G d; d<e5          Z7 G d= d>e           Z8 G d? d@e"          Z9 G dA dBe9          Z: G dC dDe9          Z; G dE dFe9          Z< G dG dHe9          Z= G dI dJe"          Z> G dK dLe'e4          Z? G dM dNe           Z@ G dO dPe'          ZA G dQ dRe'          ZB G dS dTe           ZC G dU dVeDe7          ZE G dW dXe4          ZF G dY dZe           ZG G d[ d\e           ZH G d] d^e           ZI G d_ d`e           ZJ G da dbe           ZK G dc ddeK          ZL G de dfeK          ZMdS )g    )annotationsN)MessageDefect   )AsyncHTTPConnection)AsyncConnectionPool)AsyncHTTPResponse)_TYPE_REDUCE_RESULT)ResponsePromise)HTTPConnection)ConnectionPool)HTTPResponse)Retry)
stdlib_sslc                      e Zd ZdS )BaseSSLErrorN)__name__
__module____qualname__     Z/home/thesage/.hermes/hermes-agent/venv/lib/python3.11/site-packages/urllib3/exceptions.pyr   r      s        r   r   c                      e Zd ZdZdS )	HTTPErrorz#Base exception used by this module.Nr   r   r   __doc__r   r   r   r   r       s        ----r   r   c                      e Zd ZdZdS )HTTPWarningz!Base warning used by this module.Nr   r   r   r   r   r   $   s        ++++r   r   c                  ,     e Zd ZdZd fdZdd
Z xZS )	PoolErrorz/Base exception for errors caused within a pool.pool$ConnectionPool | AsyncConnectionPoolmessagestrreturnNonec                b    || _         t                                          | d|            d S Nz: )r    super__init__)selfr    r"   	__class__s      r   r)   zPoolError.__init__+   s8     	D--G--.....r   r	   c                    | j         dfS N)NNr+   r*   s    r   
__reduce__zPoolError.__reduce__1       ~|++r   )r    r!   r"   r#   r$   r%   r$   r	   r   r   r   r   r)   r0   __classcell__r.   s   @r   r   r   (   sW        99/ / / / / /, , , , , , , ,r   r   c                  ,     e Zd ZdZd fd	ZddZ xZS )RequestErrorz8Base exception for PoolErrors that have associated URLs.r    r!   urlr#   r"   r$   r%   c                Z    || _         t                                          ||           d S N)r7   r(   r)   )r*   r    r7   r"   r+   s       r   r)   zRequestError.__init__9   s,     w'''''r   r	   c                $    | j         d | j        d ffS r9   )r+   r7   r/   s    r   r0   zRequestError.__reduce__?   s    ~dh555r   )r    r!   r7   r#   r"   r#   r$   r%   r2   r3   r.   s   @r   r6   r6   6   sW        BB( ( ( ( ( (6 6 6 6 6 6 6 6r   r6   c                      e Zd ZdZdS )SSLErrorz9Raised when SSL certificate fails in an HTTPS connection.Nr   r   r   r   r<   r<   D           CCCCr   r<   c                  0     e Zd ZU dZded<   d
 fd	Z xZS )
ProxyErrorz,Raised when the connection to a proxy fails.	Exceptionoriginal_errorr"   r#   errorr$   r%   c                Z    t                                          ||           || _        d S r9   )r(   r)   rA   )r*   r"   rB   r+   s      r   r)   zProxyError.__init__N   s+    %(((#r   )r"   r#   rB   r@   r$   r%   )r   r   r   r   __annotations__r)   r4   r.   s   @r   r?   r?   H   sS         66 $ $ $ $ $ $ $ $ $ $r   r?   c                      e Zd ZdZdS )DecodeErrorz;Raised when automatic decoding based on Content-Type fails.Nr   r   r   r   rF   rF   S           EEEEr   rF   c                      e Zd ZdZdS )ProtocolErrorz>Raised when something unexpected happens mid-request/response.Nr   r   r   r   rI   rI   W   s        HHHHr   rI   c                  (     e Zd ZdZ	 dd fdZ xZS )MaxRetryErrora  Raised when the maximum number of retries is exceeded.

    :param pool: The connection pool
    :type pool: :class:`~urllib3.connectionpool.HTTPConnectionPool`
    :param str url: The requested Url
    :param reason: The underlying error
    :type reason: :class:`Exception`

    Nr    r!   r7   r#   reasonException | Noner$   r%   c                n    || _         d| d|d}t                                          |||           d S )NzMax retries exceeded with url: z (Caused by ))rL   r(   r)   )r*   r    r7   rL   r"   r+   s        r   r)   zMaxRetryError.__init__m   sF     PCPPVPPPsG,,,,,r   r9   )r    r!   r7   r#   rL   rM   r$   r%   r   r   r   r   r)   r4   r.   s   @r   rK   rK   b   sQ          $(	
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
-r   rK   c                  (     e Zd ZdZ	 dd fdZ xZS )HostChangedErrorz?Raised when an existing pool gets a request for a foreign host.   r    r!   r7   r#   retriesRetry | intr$   r%   c                f    d| }t                                          |||           || _        d S )Nz'Tried to open a foreign host with url: )r(   r)   rT   )r*   r    r7   rT   r"   r+   s        r   r)   zHostChangedError.__init__}   s:     BCAAsG,,,r   )rS   )r    r!   r7   r#   rT   rU   r$   r%   rP   r.   s   @r   rR   rR   z   sM        II  !	          r   rR   c                      e Zd ZdZdS )TimeoutStateErrorz1Raised when passing an invalid state to a timeoutNr   r   r   r   rX   rX      s        ;;;;r   rX   c                      e Zd ZdZdS )TimeoutErrorzRaised when a socket timeout error occurs.

    Catching this error will catch both :exc:`ReadTimeoutErrors
    <ReadTimeoutError>` and :exc:`ConnectTimeoutErrors <ConnectTimeoutError>`.
    Nr   r   r   r   rZ   rZ      s           r   rZ   c                      e Zd ZdZdS )ReadTimeoutErrorzFRaised when a socket timeout occurs while receiving data from a serverNr   r   r   r   r\   r\      s        PPPPr   r\   c                      e Zd ZdZdS )ConnectTimeoutErrorz@Raised when a socket timeout occurs while connecting to a serverNr   r   r   r   r^   r^      s        JJJJr   r^   c                  ,     e Zd ZdZd fdZdd
Z xZS )NewConnectionErrorzHRaised when we fail to establish a new connection. Usually ECONNREFUSED.connKHTTPConnection | AsyncHTTPConnection | ConnectionPool | AsyncConnectionPoolr"   r#   r$   r%   c                b    || _         t                                          | d|            d S r'   )ra   r(   r)   )r*   ra   r"   r+   s      r   r)   zNewConnectionError.__init__   s8     	D--G--.....r   r	   c                    | j         dfS r-   r.   r/   s    r   r0   zNewConnectionError.__reduce__   r1   r   )ra   rb   r"   r#   r$   r%   r2   r3   r.   s   @r   r`   r`      sW        RR	/ 	/ 	/ 	/ 	/ 	/, , , , , , , ,r   r`   c                  ,     e Zd ZdZd fdZddZ xZS )NameResolutionErrorz'Raised when host name resolution fails.hostr#   ra   rb   rL   socket.gaierrorc                ^    d| d| d}t                                          ||           d S )NzFailed to resolve 'z' (rO   r(   r)   )r*   rg   ra   rL   r"   r+   s        r   r)   zNameResolutionError.__init__   s=     ;:::::w'''''r   r$   r	   c                    | j         dfS )N)NNNr.   r/   s    r   r0   zNameResolutionError.__reduce__   s    ~111r   )rg   r#   ra   rb   rL   rh   r2   r3   r.   s   @r   rf   rf      sW        11
( 
( 
( 
( 
( 
(2 2 2 2 2 2 2 2r   rf   c                      e Zd ZdZdS )EmptyPoolErrorzCRaised when a pool runs out of connections and no more are allowed.Nr   r   r   r   rm   rm              MMMMr   rm   c                      e Zd ZdZdS )FullPoolErrorzGRaised when we try to add a connection to a full pool in blocking mode.Nr   r   r   r   rp   rp      s        QQQQr   rp   c                      e Zd ZdZdS )ClosedPoolErrorzCRaised when a request enters a pool after the pool has been closed.Nr   r   r   r   rr   rr      rn   r   rr   c                      e Zd ZdZdS )LocationValueErrorz<Raised when there is something wrong with a given URL input.Nr   r   r   r   rt   rt      s        FFFFr   rt   c                  $     e Zd ZdZd fdZ xZS )LocationParseErrorz=Raised when get_host or similar fails to parse the URL input.locationr#   r$   r%   c                b    d| }t                                          |           || _        d S )NzFailed to parse: )r(   r)   rw   )r*   rw   r"   r+   s      r   r)   zLocationParseError.__init__   s3    0h00!!! r   )rw   r#   r$   r%   rP   r.   s   @r   rv   rv      sC        GG! ! ! ! ! ! ! ! ! !r   rv   c                  $     e Zd ZdZd fdZ xZS )URLSchemeUnknownz2Raised when a URL input has an unsupported scheme.schemer#   c                b    d| }t                                          |           || _        d S )NzNot supported URL scheme )r(   r)   r{   r*   r{   r"   r+   s      r   r)   zURLSchemeUnknown.__init__   s3    6f66!!!r   )r{   r#   rP   r.   s   @r   rz   rz      sC        <<         r   rz   c                      e Zd ZdZdZdZdS )ResponseErrorzDUsed as a container for an error reason supplied in a MaxRetryError.ztoo many error responsesz&too many {status_code} error responsesN)r   r   r   r   GENERIC_ERRORSPECIFIC_ERRORr   r   r   r   r      s        NN.M=NNNr   r   c                      e Zd ZdZdS )SecurityWarningz0Warned when performing security reducing actionsNr   r   r   r   r   r              ::::r   r   c                      e Zd ZdZdS )InsecureRequestWarningz/Warned when making an unverified HTTPS request.Nr   r   r   r   r   r      s        9999r   r   c                      e Zd ZdZdS )NotOpenSSLWarningz)Warned when using unsupported SSL libraryNr   r   r   r   r   r      s        3333r   r   c                      e Zd ZdZdS )SystemTimeWarningz0Warned when system time is suspected to be wrongNr   r   r   r   r   r      r   r   r   c                      e Zd ZdZdS )InsecurePlatformWarningzIWarned when certain TLS/SSL configuration is not available on a platform.Nr   r   r   r   r   r      s        SSSSr   r   c                      e Zd ZdZdS )DependencyWarningzc
    Warned when an attempt is made to import a module with missing optional
    dependencies.
    Nr   r   r   r   r   r                r   r   c                      e Zd ZdZdS )ResponseNotChunkedz;Response needs to be chunked in order to read it as chunks.Nr   r   r   r   r   r     rG   r   r   c                      e Zd ZdZdS )BodyNotHttplibCompatiblez
    Body should be :class:`http.client.HTTPResponse` like
    (have an fp attribute which returns raw chunks) for read_chunked().
    Nr   r   r   r   r   r     r   r   r   c                  2    e Zd ZdZddd	ZddZej        ZdS )IncompleteReadz
    Response length doesn't match expected Content-Length

    Subclass of :class:`http.client.IncompleteRead` to allow int value
    for ``partial`` to avoid creating large objects on streamed reads.
    Npartialintexpected
int | Noner$   r%   c                "    || _         || _        d S r9   )r   r   )r*   r   r   s      r   r)   zIncompleteRead.__init__  s     r   r#   c                L    | j         d| j         d| j          dS d| j         dS )NzIncompleteRead(z bytes read, z more expected)z bytes read))r   r   r/   s    r   __repr__zIncompleteRead.__repr__"  s:    =$^T\^^^^^^;;;;;r   r9   )r   r   r   r   r$   r%   r$   r#   )r   r   r   r   r)   r   object__str__r   r   r   r   r     sN         ! ! ! ! !< < < <
 nGGGr   r   c                  "    e Zd ZdZddZdd
ZdS )InvalidChunkLengthz+Invalid chunk length in a chunked response.response HTTPResponse | AsyncHTTPResponselengthbytesr$   r%   c                l    |                                 | _        |j        | _        || _        || _        d S r9   )tellr   length_remainingr   r   r   )r*   r   r   s      r   r)   zInvalidChunkLength.__init__-  s/     %MMOO$,$= r   r#   c                $    d| j         | j        fz  S )Nz0InvalidChunkLength(got length %r, %i bytes read))r   r   r/   s    r   r   zInvalidChunkLength.__repr__5  s    AKLE
 
 	
r   N)r   r   r   r   r$   r%   r   )r   r   r   r   r)   r   r   r   r   r   r   *  sB        55   
 
 
 
 
 
r   r   c                      e Zd ZdZdS )InvalidHeaderz(The header provided was somehow invalid.Nr   r   r   r   r   r   <  s        2222r   r   c                  $     e Zd ZdZd fdZ xZS )ProxySchemeUnknownz1ProxyManager does not support the supplied schemer{   
str | Noner$   r%   c                p    |dk    rd }|d}nd| d}t                                          |           d S )N	localhostz>Proxy URL had no scheme, should start with http:// or https://z!Proxy URL had unsupported scheme z , should use http:// or https://rj   r}   s      r   r)   zProxySchemeUnknown.__init__E  sO     [  F>VGGb&bbbG!!!!!r   )r{   r   r$   r%   rP   r.   s   @r   r   r   @  sC        ;;	" 	" 	" 	" 	" 	" 	" 	" 	" 	"r   r   c                      e Zd ZdZdS )ProxySchemeUnsupportedz=Fetching HTTPS resources through HTTPS proxies is unsupportedNr   r   r   r   r   r   Q  s        GGGGr   r   c                  $     e Zd ZdZd	 fdZ xZS )
HeaderParsingErrorzNRaised by assert_header_parsing, but we convert it to a log.warning statement.defectslist[MessageDefect]unparsed_databytes | str | Noner$   r%   c                \    |pd d|}t                                          |           d S )NUnknownz, unparsed data: rj   )r*   r   r   r"   r+   s       r   r)   zHeaderParsingError.__init__X  s;     )	MMMMM!!!!!r   )r   r   r   r   r$   r%   rP   r.   s   @r   r   r   U  sC        XX" " " " " " " " " "r   r   c                      e Zd ZdZdS )UnrewindableBodyErrorz9urllib3 encountered an error when trying to rewind a bodyNr   r   r   r   r   r   _  r=   r   r   c                      e Zd ZdZddZdS )	EarlyResponsez;urllib3 received a response prior to sending the whole bodypromiser
   r$   r%   c                    || _         d S r9   )r   )r*   r   s     r   r)   zEarlyResponse.__init__f  s    r   N)r   r
   r$   r%   )r   r   r   r   r)   r   r   r   r   r   c  s.        EE     r   r   c                      e Zd ZdZdS )ResponseNotReadyzKept for BCNr   r   r   r   r   r   j  s        r   r   c                      e Zd ZdZdS )RecoverableErrorzRThis error is never leaked in the upper stack, it serves only an internal purpose.Nr   r   r   r   r   r   n          \\\\r   r   c                      e Zd ZdZdS )MustDowngradeErrorzRAn error occurred with a protocol and can be circumvented using an older protocol.Nr   r   r   r   r   r   r  r   r   r   c                      e Zd ZdZdS )MustRedialErrorz3Unused legacy exception. Remove it in a next major.Nr   r   r   r   r   r   v  s        ====r   r   )N
__future__r   sockettypingemail.errorsr   TYPE_CHECKING_async.connectionr   _async.connectionpoolr   _async.responser   _typingr	   backendr
   
connectionr   connectionpoolr   r   r   
util.retryr   contrib.anytlsr   _stdlib_sslr<   r   BaseExceptionr@   r   Warningr   r   r6   r?   rF   rI   ConnectionErrorrK   rR   rX   rZ   r\   r^   r`   rf   rm   rp   rr   
ValueErrorrt   rv   rz   r   r   r   r   r   r   r   r   r   r   r   r   AssertionErrorr   r   r   r   r   r   r   r   r   r   r   r   <module>r      s   " " " " " "   & & & & & &	 	"666666::::::222222,,,,,,((((((******......&&&&&&!!!!!! 6 5 5 5 5 5'LL    }   . . . . .	 . . ., , , , ,' , , ,, , , , ,	 , , ,6 6 6 6 69 6 6 6D D D D Dy D D D$ $ $ $ $ $ $ $F F F F F) F F FI I I I II I I I
  - - - - -L - - -0    |   < < < < <	 < < <    9   Q Q Q Q Q|\ Q Q QK K K K K, K K K, , , , ,,i , , ,&2 2 2 2 2, 2 2 2(N N N N NY N N NR R R R RI R R RN N N N Ni N N NG G G G GY G G G! ! ! ! !+ ! ! !    )   > > > > >I > > >; ; ; ; ;k ; ; ;: : : : :_ : : :4 4 4 4 4 4 4 4; ; ; ; ; ; ; ;T T T T To T T T       F F F F F
 F F F    y       ]   (
 
 
 
 
 
 
 
$3 3 3 3 3I 3 3 3" " " " ")9 " " ""H H H H HZ H H H" " " " " " " "D D D D DI D D D    I       y   ] ] ] ] ]y ] ] ]] ] ] ] ]) ] ] ]> > > > >& > > > > >r   