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",")","."]
code: def __init__(
      self,
      is_valid: bool,
      n_trials: int | None = None,
      timeout: float | None = None,
  ) -> None:
      if is_valid and n_trials is None and timeout is None:
          warnings.warn(
              "Progress bar won't be displayed because n_trials and timeout are None."
          )
  
      self._is_valid = is_valid and (n_trials or timeout) is not None
      self._n_trials = n_trials
      self._timeout = timeout
      self._last_elapsed_seconds = 0.0
  
      if self._is_valid:
          if self._n_trials is not None:
              self._progress_bar = tqdm(total=self._n_trials)
          elif self._timeout is not None:
              total = tqdm.format_interval(self._timeout)
              fmt = (
                  "{desc} {percentage:3.0f}%|{bar}| {elapsed}/" + total
              )
              self._progress_bar = tqdm(
                  total=self._timeout, bar_format=fmt
              )
          else:
              assert False
  
          global _tqdm_handler
  
          _tqdm_handler = _TqdmLoggingHandler()
          _tqdm_handler.setLevel(logging.INFO)
          _tqdm_handler.setFormatter(
              optuna_logging.create_default_formatter()
          )
          optuna_logging.disable_default_handler()
          optuna_logging._get_library_root_logger().addHandler(
              _tqdm_handler
          )
  
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 1 to create a new _ProgressBar object  with example: obj = _ProgressBar(is_valid, n_trials, timeout)