class_docstr: Thin wrapper around tqdm to handle soft imports.
class_docstr_tok: ["Thin","wrapper","around","tqdm","to","handle","soft","imports","."]
code: def __init__(
      self,
      name: str,
      total: int,
      position: int = 0,
      enabled: Optional[bool] = None,
  ):
      self._desc = name
      self._progress = 0
      if enabled is None:
          from ray.data import DataContext
  
          enabled = DataContext.get_current().enable_progress_bars
      if not enabled:
          self._bar = None
      elif tqdm:
          ctx = ray.data.context.DataContext.get_current()
          if ctx.use_ray_tqdm:
              self._bar = tqdm_ray.tqdm(total=total, position=position)
          else:
              self._bar = tqdm.tqdm(total=total, position=position)
          self._bar.set_description(self._desc)
      else:
          global needs_warning
          if needs_warning:
              print(
                  "[dataset]: Run `pip install tqdm` to enable progress reporting."
              )
              needs_warning = False
          self._bar = None
  
file_path: ray/python/ray/data/_internal/progress_bar.py
imports: import threading
  from typing import Any, List, Optional
  import ray
  from ray.experimental import tqdm_ray
  from ray.types import ObjectRef
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 1 to create a new ProgressBar object  with example: obj = ProgressBar(name, total, position, enabled)