Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
odigos / etc / odigos-vmagent / instrumentations / python / urllib3 / util / __pycache__ / retry.cpython-311.pyc
Size: Mime:
§

(gHãó<—ddlmZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZddlmZejrdd	lmZdd
lmZddlmZeje¦«ZGd„d
ej ¦«Z!Gd„d¦«Z"e"d¦«e"_#dS)é)ÚannotationsN)Ú	takewhile)Ú
TracebackTypeé)ÚConnectTimeoutErrorÚ
InvalidHeaderÚ
MaxRetryErrorÚ
ProtocolErrorÚ
ProxyErrorÚReadTimeoutErrorÚ
ResponseErroré)Úreraise)ÚSelf)ÚConnectionPool)ÚBaseHTTPResponsecóB—eZdZUded<ded<ded<ded<ded<d	S)
ÚRequestHistoryú
str | NoneÚmethodÚurlúException | NoneÚerrorú
int | NoneÚstatusÚredirect_locationN)Ú__name__Ú
__module__Ú__qualname__Ú__annotations__©óú9/tmp/pip-target-r31m1qfr/lib/python/urllib3/util/retry.pyrr!sK€€€€€€ØÐÐÑØ€O€OOØÐÐÑØÐÐÑØ!Ð!Ð!Ñ!Ð!Ð!r"rcó<—eZdZUdZegd¢¦«Zegd¢¦«Zegd¢¦«ZdZde	d<dd	d	d	d	d	ed	d
eddd	dedfdRd'„Z
dSd+„Ze		dTdUd/„¦«Z
dVd0„ZdWd3„ZdXd7„ZdYd8„ZdZd9„Zd[d\d;„Zd]d>„Zd]d?„Zd^dA„Z	d_d`dF„ZdadG„Z						dbdcdP„ZdddQ„Zd	S)eÚRetryaŠRetry configuration.

    Each retry attempt will create a new Retry object with updated values, so
    they can be safely reused.

    Retries can be defined as a default for a pool:

    .. code-block:: python

        retries = Retry(connect=5, read=2, redirect=5)
        http = PoolManager(retries=retries)
        response = http.request("GET", "https://example.com/")

    Or per-request (which overrides the default for the pool):

    .. code-block:: python

        response = http.request("GET", "https://example.com/", retries=Retry(10))

    Retries can be disabled by passing ``False``:

    .. code-block:: python

        response = http.request("GET", "https://example.com/", retries=False)

    Errors will be wrapped in :class:`~urllib3.exceptions.MaxRetryError` unless
    retries are disabled, in which case the causing exception will be raised.

    :param int total:
        Total number of retries to allow. Takes precedence over other counts.

        Set to ``None`` to remove this constraint and fall back on other
        counts.

        Set to ``0`` to fail on the first retry.

        Set to ``False`` to disable and imply ``raise_on_redirect=False``.

    :param int connect:
        How many connection-related errors to retry on.

        These are errors raised before the request is sent to the remote server,
        which we assume has not triggered the server to process the request.

        Set to ``0`` to fail on the first retry of this type.

    :param int read:
        How many times to retry on read errors.

        These errors are raised after the request was sent to the server, so the
        request may have side-effects.

        Set to ``0`` to fail on the first retry of this type.

    :param int redirect:
        How many redirects to perform. Limit this to avoid infinite redirect
        loops.

        A redirect is a HTTP response with a status code 301, 302, 303, 307 or
        308.

        Set to ``0`` to fail on the first retry of this type.

        Set to ``False`` to disable and imply ``raise_on_redirect=False``.

    :param int status:
        How many times to retry on bad status codes.

        These are retries made on responses, where status code matches
        ``status_forcelist``.

        Set to ``0`` to fail on the first retry of this type.

    :param int other:
        How many times to retry on other errors.

        Other errors are errors that are not connect, read, redirect or status errors.
        These errors might be raised after the request was sent to the server, so the
        request might have side-effects.

        Set to ``0`` to fail on the first retry of this type.

        If ``total`` is not set, it's a good idea to set this to 0 to account
        for unexpected edge cases and avoid infinite retry loops.

    :param Collection allowed_methods:
        Set of uppercased HTTP method verbs that we should retry on.

        By default, we only retry on methods which are considered to be
        idempotent (multiple requests with the same parameters end with the
        same state). See :attr:`Retry.DEFAULT_ALLOWED_METHODS`.

        Set to a ``None`` value to retry on any verb.

    :param Collection status_forcelist:
        A set of integer HTTP status codes that we should force a retry on.
        A retry is initiated if the request method is in ``allowed_methods``
        and the response status code is in ``status_forcelist``.

        By default, this is disabled with ``None``.

    :param float backoff_factor:
        A backoff factor to apply between attempts after the second try
        (most errors are resolved immediately by a second try without a
        delay). urllib3 will sleep for::

            {backoff factor} * (2 ** ({number of previous retries}))

        seconds. If `backoff_jitter` is non-zero, this sleep is extended by::

            random.uniform(0, {backoff jitter})

        seconds. For example, if the backoff_factor is 0.1, then :func:`Retry.sleep` will
        sleep for [0.0s, 0.2s, 0.4s, 0.8s, ...] between retries. No backoff will ever
        be longer than `backoff_max`.

        By default, backoff is disabled (factor set to 0).

    :param bool raise_on_redirect: Whether, if the number of redirects is
        exhausted, to raise a MaxRetryError, or to return a response with a
        response code in the 3xx range.

    :param bool raise_on_status: Similar meaning to ``raise_on_redirect``:
        whether we should raise an exception, or return a response,
        if status falls in ``status_forcelist`` range and retries have
        been exhausted.

    :param tuple history: The history of the request encountered during
        each call to :meth:`~Retry.increment`. The list is in the order
        the requests occurred. Each list item is of class :class:`RequestHistory`.

    :param bool respect_retry_after_header:
        Whether to respect Retry-After header on status codes defined as
        :attr:`Retry.RETRY_AFTER_STATUS_CODES` or not.

    :param Collection remove_headers_on_redirect:
        Sequence of headers to remove from the request when a response
        indicating a redirect is returned before firing off the redirected
        request.
    )ÚHEADÚGETÚPUTÚDELETEÚOPTIONSÚTRACE)ii­i÷)ÚCookieÚ
AuthorizationzProxy-Authorizationéxztyping.ClassVar[Retry]ÚDEFAULTé
NrTçÚtotalúbool | int | NoneÚconnectrÚreadÚredirectrÚotherÚallowed_methodsútyping.Collection[str] | NoneÚstatus_forcelistútyping.Collection[int] | NoneÚbackoff_factorÚfloatÚbackoff_maxÚraise_on_redirectÚboolÚraise_on_statusÚhistoryú!tuple[RequestHistory, ...] | NoneÚrespect_retry_after_headerÚremove_headers_on_redirectútyping.Collection[str]Úbackoff_jitterÚreturnÚNonecóL—||_||_||_||_||_|dus|durd}d}||_|p
t
¦«|_||_|	|_	|
|_
||_||_|
pd|_
||_td„|D¦«¦«|_||_dS)NFrr!c3ó>K—|]}| ¦«V—ŒdS©N)Úlower)Ú.0Úhs  r#ú	<genexpr>z!Retry.__init__.<locals>.<genexpr>òs;èè€ð4
ð4
؈AGŠG‰IŒIð4
ð4
ð4
ð4
ð4
ð4
r")r2r4r5rr7r6Úsetr:r8r<r>r?rArBrDÚ	frozensetrErG)Úselfr2r4r5r6rr7r8r:r<r>r?rArBrDrErGs                 r#Ú__init__zRetry.__init__Êsրð*ˆŒ
؈Œ؈Œ	؈ŒØˆŒ
àuÐР¨  ØˆHØ %Ðà ˆŒ
Ø 0Ð 9µC±E´EˆÔØ.ˆÔØ,ˆÔØ&ˆÔØ!2ˆÔØ.ˆÔؐ} "ˆŒØ*DˆÔ'Ý*3ð4
ð4
Ø9ð4
ñ4
ô4
ñ+
ô+
ˆÔ'ð-ˆÔÐÐr"Úkwú
typing.Anyrcój—tdid|j“d|j“d|j“d|j“d|j“d|j“d|j“d|j“d	|j	“d
|j
“d|j“d|j“d
|j
“d|j“d|j“d|j“Ž}| |¦«t%|¦«di|¤ŽS)Nr2r4r5r6rr7r8r:r<r>r?rArBrErDrGr!)Údictr2r4r5r6rr7r8r:r<r>r?rArBrErDrGÚupdateÚtype)rSrUÚparamss   r#Únewz	Retry.new÷s4€Ýð
ð
ð
Ø”**ð
à”LLð
ð”ð
ð”]]ð	
ð
”;;ð
ð”**ð

ð!Ô0Ð0ð
ð"Ô2Ð2ð
ð Ô.Ð.ð
ðÔ(Ð(ð
ð#Ô4Ð4ð
ð!Ô0Ð0ð
ð”LLð
ð(,Ô'FÐ'Fð
ð(,Ô'FÐ'Fð
ð  Ô.Ð.ð!
ˆð&	
Š
bÑÔÐØtD‰zŒzÐ#Ð#˜FÐ#Ð#Ð#r"ÚretriesúRetry | bool | int | NoneÚdefaultcó—|€||n|j}t|t¦«r|St|¦«od}|||¬¦«}t d||¦«|S)z3Backwards-compatibility for the old retries format.N)r6z!Converted retries value: %r -> %r)r/Ú
isinstancer%r@ÚlogÚdebug)Úclsr]r6r_Únew_retriess     r#Úfrom_intzRetry.from_intsq€ðˆ?Ø!(Ð!4gg¸#¼+ˆGåguÑ%Ô%ð	؈N嘑>”>Ð* dˆØc˜'¨HÐ5Ñ5Ô5ˆÝ	Š	Ð5°wÀÑLÔLÐLØÐr"c
ó^—tttd„t|j¦«¦«¦«¦«}|dkrdS|jd|dz
zz}|jdkr|tj¦«|jzz
}ttdt|j|¦«¦«¦«S)zIFormula for computing the current backoff

        :rtype: float
        có—|jduSrL)r)Úxs r#ú<lambda>z(Retry.get_backoff_time.<locals>.<lambda>)s€ AÔ$7¸4Ð$?€r"rrrr1)ÚlenÚlistrÚreversedrBr<rGÚrandomr=ÚmaxÚminr>)rSÚconsecutive_errors_lenÚ
backoff_values   r#Úget_backoff_timezRetry.get_backoff_time!s±€õ"%ÝÝÐ?Ð?ÅÈ$Ì,ÑAWÔAWÑXÔXñ
ô
ñ"
ô"
Ðð
" QÒ&Ð&ؐ1àÔ+¨qÐ5KÈaÑ5OÑ/PÑQˆ
ØÔ #Ò%Ð%ØVœ]™_œ_¨tÔ/BÑBÑBˆMÝ•S˜C Ô 0°-Ñ@Ô@ÑAÔAÑBÔBÐBr"Úretry_afterÚstrcó@—tjd|¦«rt|¦«}nhtj |¦«}|€t
d|›¦«‚tj |¦«}|tj¦«z
}t|d¦«}|S)Nz^\s*[0-9]+\s*$zInvalid Retry-After header: r)
ÚreÚmatchÚintÚemailÚutilsÚparsedate_tzrÚ	mktime_tzÚtimero)rSrtÚsecondsÚretry_date_tupleÚ
retry_dates     r#Úparse_retry_afterzRetry.parse_retry_after4s“€õŒ8Ð% {Ñ3Ô3ð	/ݘ+Ñ&Ô&ˆGˆGå$œ{×7Ò7¸ÑDÔDÐØÐ'Ý#Ð$PÀ;Ð$PÐ$PÑQÔQÐQåœ×.Ò.Ð/?Ñ@Ô@ˆJØ ¥4¤9¡;¤;Ñ.ˆGåg˜q‘/”/ˆàˆr"Úresponserúfloat | Nonecóh—|j d¦«}|€dS| |¦«S)z(Get the value of Retry-After in seconds.zRetry-AfterN)ÚheadersÚgetr‚©rSrƒrts   r#Úget_retry_afterzRetry.get_retry_afterEs9€ðÔ&×*Ò*¨=Ñ9Ô9ˆàÐØ4à×%Ò% kÑ2Ô2Ð2r"có`—| |¦«}|rtj|¦«dSdS)NTF)r‰r~Úsleeprˆs   r#Úsleep_for_retryzRetry.sleep_for_retryOs7€Ø×*Ò*¨8Ñ4Ô4ˆØð	ÝŒJ{Ñ#Ô#Ð#ؐ4àˆur"cóf—| ¦«}|dkrdStj|¦«dS)Nr)rsr~r‹)rSÚbackoffs  r#Ú_sleep_backoffzRetry._sleep_backoffWs7€Ø×'Ò'Ñ)Ô)ˆØaŠ<ˆ<ØˆFÝŒ
7ÑÔÐÐÐr"úBaseHTTPResponse | Nonecór—|jr|r| |¦«}|rdS| ¦«dS)aBSleep between retry attempts.

        This method will respect a server's ``Retry-After`` response header
        and sleep the duration of the time requested. If that is not present, it
        will use an exponential backoff. By default, the backoff factor is 0 and
        this method will return immediately.
        N)rDrŒr)rSrƒÚslepts   r#r‹zRetry.sleep]sN€ðÔ*ð	¨xð	Ø×(Ò(¨Ñ2Ô2ˆEØð
ؐà×ÒÑÔÐÐÐr"ÚerrÚ	Exceptioncód—t|t¦«r|j}t|t¦«S)zzErrors when we're fairly sure that the server did not receive the
        request, so it should be safe to retry.
        )rarÚoriginal_errorr©rSr“s  r#Ú_is_connection_errorzRetry._is_connection_errorms/€õc:Ñ&Ô&ð	%ØÔ$ˆCݘ#Õ2Ñ3Ô3Ð3r"có:—t|ttf¦«S)zErrors that occur after the request has been started, so we should
        assume that the server began processing it.
        )rarr
r—s  r#Ú_is_read_errorzRetry._is_read_errorus€õ˜#Õ 0µ-Ð@ÑAÔAÐAr"rcóN—|jr| ¦«|jvrdSdS)zyChecks if a given HTTP method should be retried upon, depending if
        it is included in the allowed_methods
        FT)r8Úupper)rSrs  r#Ú_is_method_retryablezRetry._is_method_retryable{s.€ðÔð	 F§L¢L¡N¤N¸$Ô:NÐ$NÐ$Nؐ5؈tr"FÚstatus_coderyÚhas_retry_aftercó —| |¦«sdS|jr||jvrdSt|jo|jo
|o||jv¦«S)awIs this method/status code retryable? (Based on allowlists and control
        variables such as the number of total retries to allow, whether to
        respect the Retry-After header, whether this header is present, and
        whether the returned status code is on the list of status codes to
        be retried upon on the presence of the aforementioned header)
        FT)rr:r@r2rDÚRETRY_AFTER_STATUS_CODES)rSrržrŸs    r#Úis_retryzRetry.is_retryƒsx€ð×(Ò(¨Ñ0Ô0ð	ؐ5àÔ ð	 [°DÔ4IÐ%IÐ%Iؐ4åØŒJð
?ØÔ/ð
?àð
?ð Ô =Ð=ñ	
ô
ð	
r"có—d„|j|j|j|j|j|jfD¦«}|sdSt
|¦«dkS)zAre we out of retries?có—g|]}|¯|‘ŒSr!r!)rNris  r#ú
<listcomp>z&Retry.is_exhausted.<locals>.<listcomp>›s0€ð
ð
ð
àðð
Ø
ð
ð
ð
r"Fr)r2r4r5r6rr7rp)rSÚretry_countss  r#Úis_exhaustedzRetry.is_exhausted™sd€ð
ð
ð”
Ø”Ø”	Ø”
ؔؔ
ð
ð
ñ
ô
ˆðð	ؐ5å<Ñ Ô  1Ò$Ð$r"rrrrÚ_poolúConnectionPool | NoneÚ_stacktraceúTracebackType | Nonec	ó0—|jdur |rtt|¦«||¦«‚|j}||dz}|j}|j}	|j}
|j}|j}d}
d}d}|r?| |¦«r*|durtt|¦«||¦«‚||dz}né|rV| 	|¦«rA|	dus|| 
|¦«stt|¦«||¦«‚|	|	dz}	n‘|r||dz}n‡|r=| ¦«r)|
|
dz}
d}
| ¦«}|r|}|j}nHtj
}
|r:|jr3||dz}tj |j¬¦«}
|j}|jt#|||||¦«fz}| |||	|
|||¬¦«}| ¦«r#|pt|
¦«}t)|||¦«|‚t* d||¦«|S)	a¤Return a new Retry object with incremented retry counters.

        :param response: A response object, or None, if the server did not
            return a response.
        :type response: :class:`~urllib3.response.BaseHTTPResponse`
        :param Exception error: An error encountered during the request, or
            None if the response was received successfully.

        :return: A new ``Retry`` object.
        FNrÚunknownztoo many redirects)rž)r2r4r5r6rr7rBz$Incremented Retry for (url='%s'): %r)r2rrZr4r5r6rr7r˜ršrÚget_redirect_locationr
Ú
GENERIC_ERRORÚSPECIFIC_ERRORÚformatrBrr\r§r	rbrc)rSrrrƒrr¨rªr2r4r5r6Ústatus_countr7ÚcauserrÚresponse_redirect_locationrBÚ	new_retryÚreasons                    r#Ú	incrementzRetry.increment¬s—€ð&Œ:˜ÐР5Ðå$˜u™+œ+ u¨kÑ:Ô:Ð:à”
ˆØÐØQ‰JˆEà”,ˆØŒyˆØ”=ˆØ”{ˆØ”
ˆØˆØˆØ Ðàð%	)T×.Ò.¨uÑ5Ô5ð%	)à˜%ÐÐݝd 5™kœk¨5°+Ñ>Ô>Ð>ØÐ$ؘ1‘øà
ð	)t×*Ò*¨5Ñ1Ô1ð	)àuˆ}ˆ}  °d×6OÒ6OÐPVÑ6WÔ6W Ýd 5™kœk¨5°+Ñ>Ô>Ð>ØÐ!ؘ‘	øà
ð	)àРؘ‘
øà
ð	)˜(×8Ò8Ñ:Ô:ð	)àÐ#ؘA‘
Ø(ˆEØ)1×)GÒ)GÑ)IÔ)IÐ&Ø)ð
?Ø$>Ð!Ø”_ˆFˆFõ
"Ô/ˆEØð
)˜HœOð
)ØÐ+Ø  AÑ%LÝ%Ô4×;Ò;ÈÌÐ;ÑXÔXØ!œà”,Ý˜6 3¨¨vÐ7HÑIÔIð"
ñ
ˆð—H’HØØØØØØØðñ
ô
ˆ	ð×!Ò!Ñ#Ô#ð	@ØÐ2m¨EÑ2Ô2ˆFÝ  s¨FÑ3Ô3¸Ð?å	Š	Ð8¸#¸yÑIÔIÐIàÐr"có€—t|¦«j›d|j›d|j›d|j›d|j›d|j›dS)Nz(total=z
, connect=z, read=z, redirect=z	, status=ú))rZrr2r4r5r6r)rSs r#Ú__repr__zRetry.__repr__
sx€åD‰zŒzÔ"ð
Qð
Q¨4¬:ð
Qð
QÀÄð
Qð
QØ”Ið
Qð
QØ*.¬-ð
Qð
QØBFÄ+ð
Qð
Qð
Qð	
r")"r2r3r4rr5rr6r3rrr7rr8r9r:r;r<r=r>r=r?r@rAr@rBrCrDr@rErFrGr=rHrI)rUrVrHr)TN)r]r^r6r3r_r^rHr%)rHr=)rtrurHr=)rƒrrHr„)rƒrrHr@)rHrIrL)rƒrrHrI)r“r”rHr@)rrurHr@)F)rruržryrŸr@rHr@)rHr@)NNNNNN)rrrrrƒrrrr¨r©rªr«rHr)rHru)rrrÚ__doc__rRÚDEFAULT_ALLOWED_METHODSr¡Ú"DEFAULT_REMOVE_HEADERS_ON_REDIRECTÚDEFAULT_BACKOFF_MAXr rTr\Úclassmethodrfrsr‚r‰rŒrr‹r˜ršrr¢r§r·rºr!r"r#r%r%)sT€€€€€€ðKðKð\(˜iØ<Ð<Ð<ñôÐð
 )˜y¨¨¨Ñ9Ô9Ðð*3¨Ø:Ð:Ð:ñ*ô*Ð&ð
Ðð$Ð#Ð#Ñ#ð$&Ø"ØØ&*Ø!Ø Ø9PØ:>Ø !Ø0Ø"&Ø $Ø59Ø+/ð
/Ø #ð'+-ð+-ð+-ð+-ð+-ðZ$ð$ð$ð$ð.ð'+Ø-1ð	ðððñ„[ðð$CðCðCðCð&ðððð"3ð3ð3ð3ðððððððððððððð 4ð4ð4ð4ðBðBðBðBðððððFKð
ð
ð
ð
ð
ð,%ð%ð%ð%ð*"ØØ,0Ø"&Ø'+Ø,0ð_ð_ð_ð_ð_ðB
ð
ð
ð
ð
ð
r"r%é)$Ú
__future__rrzÚloggingrnrwr~ÚtypingÚ	itertoolsrÚtypesrÚ
exceptionsrrr	r
rrr
ÚutilrÚ
TYPE_CHECKINGÚtyping_extensionsrÚconnectionpoolrrƒrÚ	getLoggerrrbÚ
NamedTuplerr%r/r!r"r#ú<module>rÍs¥ðØ"Ð"Ð"Ð"Ð"Ð"à€€€Ø€€€Ø
€
€
€
Ø	€	€	€	Ø€€€Ø
€
€
€
ØÐÐÐÐÐØÐÐÐÐÐðððððððððððððððððððÐÐÐÐÐà	Ôð,Ø&Ð&Ð&Ð&Ð&Ð&à/Ð/Ð/Ð/Ð/Ð/Ø+Ð+Ð+Ð+Ð+Ð+à€gÔ˜Ñ!Ô!€ð"ð"ð"ð"ð"VÔ&ñ"ô"ð"ðh
ðh
ðh
ðh
ðh
ñh
ôh
ðh
ðXa‘”€„
€
€
r"