class_docstr: Progress Bar implementation for :func:`~optuna.study.Study.optimize` on the top of `tqdm`.
  
  Args:
      is_valid:
          Whether to show progress bars in :func:`~optuna.study.Study.optimize`.
      n_trials:
          The number of trials.
      timeout:
          Stop study after the given number of second(s).
class_docstr_tok: ["Progress","Bar","implementation","for",":","func",":","`","~optuna.study.Study.optimize","`","on","the","top","of","`","tqdm","`",".","Args",":","is_valid",":","Whether","to","show","progress","bars","in",":","func",":","`","~optuna.study.Study.optimize","`",".","n_trials",":","The","number","of","trials",".","timeout",":","Stop","study","after","the","given","number","of","second","(","s",")","."]
docstr: Update the progress bars if ``is_valid`` is :obj:`True`.
  
  Args:
      elapsed_seconds:
          The time past since :func:`~optuna.study.Study.optimize` started.
      study:
          The current study object.
docstr_tok: ["Update","the","progress","bars","if","``","is_valid","``","is",":","obj",":","`","True","`",".","Args",":","elapsed_seconds",":","The","time","past","since",":","func",":","`","~optuna.study.Study.optimize","`","started",".","study",":","The","current","study","object","."]
code: def update(self, elapsed_seconds: float, study: Study) -> None:
      """Update the progress bars if ``is_valid`` is :obj:`True`.
  
      Args:
          elapsed_seconds:
              The time past since :func:`~optuna.study.Study.optimize` started.
          study:
              The current study object.
      """
  
      if self._is_valid:
          if not study._is_multi_objective():
              # Not updating the progress bar when there are no complete trial.
              try:
                  msg = (
                      f"Best trial: {study.best_trial.number}. "
                      f"Best value: {study.best_value:.6g}"
                  )
  
                  self._progress_bar.set_description(msg)
              except ValueError:
                  pass
  
          if self._n_trials is not None:
              self._progress_bar.update(1)
              if self._timeout is not None:
                  self._progress_bar.set_postfix_str(
                      "{:.02f}/{} seconds".format(
                          elapsed_seconds, self._timeout
                      )
                  )
  
          elif self._timeout is not None:
              time_diff = elapsed_seconds - self._last_elapsed_seconds
              if elapsed_seconds > self._timeout:
                  # Clip elapsed time to avoid tqdm warnings.
                  time_diff -= elapsed_seconds - self._timeout
  
              self._progress_bar.update(time_diff)
              self._last_elapsed_seconds = elapsed_seconds
  
          else:
              assert False
  
file_path: optuna/optuna/progress_bar.py
imports: from __future__ import annotations
  import logging
  from typing import Any
  from typing import TYPE_CHECKING
  import warnings
  from tqdm.auto import tqdm
  from optuna import logging
label_desc: Use image node_id 2 for calling the _ProgressBar obj's underlying member method code with example usage: obj.update(elapsed_seconds, study) without return types