class_docstr: A progress bar made with rich.
  
  Example:
      .. highlight:: python
      .. code-block:: python
  
          with ProgressBar(100, 'loop') as p_bar:
              for i in range(100):
                  do_busy()
                  p_bar.update()
class_docstr_tok: ["A","progress","bar","made","with","rich",".","Example",":","..","highlight",":",":","python","..","code-block",":",":","python","with","ProgressBar","(","100",",","'loop","'",")","as","p_bar",":","for","i","in","range","(","100",")",":","do_busy","(",")","p_bar.update","(",")"]
docstr: Init a custom progress bar based on rich. This is the default progress bar of jina if you want to  customize
  it you should probably just use a rich `Progress` and add your custom column and task
  
  :param description: description of your task ex : 'Working...'
  :param total_length: the number of steps
  :param message_on_done: The message that you want to print at the end of your task. It can either be a string to
  be formatted with task (ex '{task.completed}') task or a function which take task as input (ex : lambda task : f'{task.completed}'
  :param columns: If you want to customize the column of the progress bar. Note that you should probably directly use
  rich Progress object than overwriting these columns parameters.
  :param total_length: disable the progress bar
  
  
  
  .. # noqa: DAR202
  .. # noqa: DAR101
  .. # noqa: DAR003
docstr_tok: ["Init","a","custom","progress","bar","based","on","rich",".","This","is","the","default","progress","bar","of","jina","if","you","want","to","customize","it","you","should","probably","just","use","a","rich","`","Progress","`","and","add","your","custom","column","and","task",":","param","description",":","description","of","your","task","ex",":","'Working","...","'",":","param","total_length",":","the","number","of","steps",":","param","message_on_done",":","The","message","that","you","want","to","print","at","the","end","of","your","task",".","It","can","either","be","a","string","to","be","formatted","with","task","(","ex","'","{","task.completed","}","'",")","task","or","a","function","which","take","task","as","input","(","ex",":","lambda","task",":","f","'","{","task.completed","}","'",":","param","columns",":","If","you","want","to","customize","the","column","of","the","progress","bar",".","Note","that","you","should","probably","directly","use","rich","Progress","object","than","overwriting","these","columns","parameters",".",":","param","total_length",":","disable","the","progress","bar","..","#","noqa",":","DAR202","..","#","noqa",":","DAR101","..","#","noqa",":","DAR003"]
code: def __init__(
      self,
      description: str = "Working...",
      total_length: Optional[float] = None,
      message_on_done: Optional[Union[str, Callable[..., str]]] = None,
      columns: Optional[Union[str, ProgressColumn]] = None,
      disable: bool = False,
      console: Optional[Console] = None,
      **kwargs,
  ):
      """Init a custom progress bar based on rich. This is the default progress bar of jina if you want to  customize
      it you should probably just use a rich `Progress` and add your custom column and task
  
      :param description: description of your task ex : 'Working...'
      :param total_length: the number of steps
      :param message_on_done: The message that you want to print at the end of your task. It can either be a string to
      be formatted with task (ex '{task.completed}') task or a function which take task as input (ex : lambda task : f'{task.completed}'
      :param columns: If you want to customize the column of the progress bar. Note that you should probably directly use
      rich Progress object than overwriting these columns parameters.
      :param total_length: disable the progress bar
  
  
  
      .. # noqa: DAR202
      .. # noqa: DAR101
      .. # noqa: DAR003
  
      """
  
      def _default_message_on_done(task):
          return f"{task.completed} steps done in {get_readable_time(seconds=task.finished_time)}"
  
      columns = columns or [
          SpinnerColumn(),
          _OnDoneColumn(f"DONE", description, "progress.description"),
          BarColumn(complete_style="green", finished_style="yellow"),
          TimeElapsedColumn(),
          "[progress.percentage]{task.percentage:>3.0f}%",
          TextColumn("ETA:", style="progress.remaining"),
          TimeRemainingColumn(),
          _OnDoneColumn(
              message_on_done
              if message_on_done
              else _default_message_on_done
          ),
      ]
  
      if not console:
          console = get_rich_console()
  
      super().__init__(
          *columns, console=console, disable=disable, **kwargs
      )
  
      self.task_id = self.add_task(
          "Working...", total=total_length if total_length else 100.0
      )
  
imports: import time
  import typing
  from functools import wraps
  from typing import Optional, Union, Callable
  from jina.constants import __windows__
  from jina.helper import get_readable_size, get_readable_time, colored, get_rich_console
  from rich.progress import Progress, Task, BarColumn, TimeRemainingColumn, SpinnerColumn, TimeElapsedColumn, TextColumn, ProgressColumn, TaskID
  from rich.text import Text
  from rich.table import Column
  from rich.console import Console
label_desc: Use image node_id 1 to create a new ProgressBar object from inherited base classes: Progress with example: obj = ProgressBar(description, total_length, message_on_done, columns, disable, console)