Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
RetryCallState Class Reference

Public Member Functions

None __init__ (self, BaseRetrying retry_object, t.Optional[WrappedFn] fn, t.Any args, t.Any kwargs)
 
t.Optional[float] seconds_since_start (self)
 
None prepare_for_next_attempt (self)
 
None set_result (self, t.Any val)
 
None set_exception (self, t.Tuple[t.Type[BaseException], BaseException, "types.TracebackType| None"] exc_info)
 
str __repr__ (self)
 

Data Fields

 start_time
 
 retry_object
 
 fn
 
 args
 
 kwargs
 
 outcome
 
 outcome_timestamp
 
 next_action
 

Detailed Description

State related to a single call wrapped with Retrying.

Definition at line 425 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ (   self,
BaseRetrying  retry_object,
t.Optional[WrappedFn fn,
t.Any  args,
t.Any  kwargs 
)

Definition at line 428 of file __init__.py.

434 ) -> None:
435 #: Retry call start timestamp
436 self.start_time = time.monotonic()
437 #: Retry manager object
438 self.retry_object = retry_object
439 #: Function wrapped by this retry call
440 self.fn = fn
441 #: Arguments of the function wrapped by this retry call
442 self.args = args
443 #: Keyword arguments of the function wrapped by this retry call
444 self.kwargs = kwargs
445
446 #: The number of the current attempt
447 self.attempt_number: int = 1
448 #: Last outcome (result or exception) produced by the function
449 self.outcome: t.Optional[Future] = None
450 #: Timestamp of the last outcome
451 self.outcome_timestamp: t.Optional[float] = None
452 #: Time spent sleeping in retries
453 self.idle_for: float = 0.0
454 #: Next action as decided by the retry manager
455 self.next_action: t.Optional[RetryAction] = None
456
for i

References i.

Referenced by Protocol.__init_subclass__().

Here is the caller graph for this function:

Member Function Documentation

◆ __repr__()

str __repr__ (   self)

Definition at line 483 of file __init__.py.

483 def __repr__(self) -> str:
484 if self.outcome is None:
485 result = "none yet"
486 elif self.outcome.failed:
487 exception = self.outcome.exception()
488 result = f"failed ({exception.__class__.__name__} {exception})"
489 else:
490 result = f"returned {self.outcome.result()}"
491
492 slept = float(round(self.idle_for, 2))
493 clsname = self.__class__.__name__
494 return f"<{clsname} {id(self)}: attempt #{self.attempt_number}; slept for {slept}; last result: {result}>"
495
496
497@t.overload

References FormatControl.__class__, _InstallRequirementBackedCandidate.__class__, AlreadyInstalledCandidate.__class__, ExtrasCandidate.__class__, OrderedDict.__class__, InfinityType.__class__, NegativeInfinityType.__class__, _IndividualSpecifier.__class__, Distribution.__class__, ParseExpression.__class__, ParamSpec.__class__, _ConcatenateGenericAlias.__class__, _UnpackAlias.__class__, TypeVarTuple.__class__, PoolError.__class__, RequestError.__class__, i, and RetryCallState.outcome.

◆ prepare_for_next_attempt()

None prepare_for_next_attempt (   self)

Definition at line 463 of file __init__.py.

463 def prepare_for_next_attempt(self) -> None:
464 self.outcome = None
465 self.outcome_timestamp = None
466 self.attempt_number += 1
467 self.next_action = None
468

◆ seconds_since_start()

t.Optional[float] seconds_since_start (   self)

Definition at line 458 of file __init__.py.

458 def seconds_since_start(self) -> t.Optional[float]:
459 if self.outcome_timestamp is None:
460 return None
461 return self.outcome_timestamp - self.start_time
462

References RetryCallState.outcome_timestamp, Task.start_time, Spinner.start_time, and RetryCallState.start_time.

◆ set_exception()

None set_exception (   self,
t.Tuple[t.Type[BaseException], BaseException, "types.TracebackType| None"]   exc_info 
)

Definition at line 475 of file __init__.py.

477 ) -> None:
478 ts = time.monotonic()
479 fut = Future(self.attempt_number)
480 fut.set_exception(exc_info[1])
481 self.outcome, self.outcome_timestamp = fut, ts
482

References Future.attempt_number, i, RetryCallState.outcome, and RetryCallState.outcome_timestamp.

◆ set_result()

None set_result (   self,
t.Any  val 
)

Definition at line 469 of file __init__.py.

469 def set_result(self, val: t.Any) -> None:
470 ts = time.monotonic()
471 fut = Future(self.attempt_number)
472 fut.set_result(val)
473 self.outcome, self.outcome_timestamp = fut, ts
474

References Future.attempt_number, i, RetryCallState.outcome, and RetryCallState.outcome_timestamp.

Field Documentation

◆ args

◆ fn

fn

Definition at line 440 of file __init__.py.

◆ kwargs

kwargs

Definition at line 444 of file __init__.py.

Referenced by EditablePartial.__call__(), and EditablePartial.name().

◆ next_action

next_action

Definition at line 467 of file __init__.py.

◆ outcome

◆ outcome_timestamp

outcome_timestamp

◆ retry_object

retry_object

Definition at line 438 of file __init__.py.

◆ start_time


The documentation for this class was generated from the following file: