class_docstr: Helper class to retry a function until it succeeds.
  
  Typical use case is to retry random sampling until a non-duplicate / valid sample is found.
  
  Parameters
  ----------
  retries
      Number of retries.
  exception_types
      Exception types to catch.
  raise_last
      Whether to raise the last exception if all retries failed.
class_docstr_tok: ["Helper","class","to","retry","a","function","until","it","succeeds",".","Typical","use","case","is","to","retry","random","sampling","until","a","non-duplicate","\/","valid","sample","is","found",".","Parameters","--","--","--","--","--","retries","Number","of","retries",".","exception_types","Exception","types","to","catch",".","raise_last","Whether","to","raise","the","last","exception","if","all","retries","failed","."]
code: def __init__(
      self,
      retries: int = 500,
      exception_types: tuple[Type[Exception]] = (
          SampleValidationError,
      ),
      raise_last: bool = False,
  ):
      self.retries = retries
      self.exception_types = exception_types
      self.raise_last = raise_last
  
file_path: nni/nni/nas/strategy/utils.py
imports: from __future__ import annotations
  import logging
  from typing import Any, Type, TypeVar, Callable
  from nni.mutable import SampleValidationError
label_desc: Use image node_id 1 to create a new RetrySamplingHelper object  with example: obj = RetrySamplingHelper(retries, exception_types, raise_last)