MCPcopy
hub / github.com/urllib3/urllib3 / from_int

Method from_int

src/urllib3/util/retry.py:291–307  ·  view source on GitHub ↗

Backwards-compatibility for the old retries format.

(
        cls,
        retries: Retry | bool | int | None,
        redirect: bool | int | None = True,
        default: Retry | bool | int | None = None,
    )

Source from the content-addressed store, hash-verified

289
290 @classmethod
291 def from_int(
292 cls,
293 retries: Retry | bool | int | None,
294 redirect: bool | int | None = True,
295 default: Retry | bool | int | None = None,
296 ) -> Retry:
297 """Backwards-compatibility for the old retries format."""
298 if retries is None:
299 retries = default if default is not None else cls.DEFAULT
300
301 if isinstance(retries, Retry):
302 return retries
303
304 redirect = bool(redirect) and None
305 new_retries = cls(retries, redirect=redirect)
306 log.debug("Converted retries value: %r -> %r", retries, new_retries)
307 return new_retries
308
309 def get_backoff_time(self) -> float:
310 """Formula for computing the current backoff

Callers 3

__init__Method · 0.80
urlopenMethod · 0.80
urlopenMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected