class_docstr: Display the progress bar itself.
class_docstr_tok: ["Display","the","progress","bar","itself","."]
code: def format(
      self,
      progress_bar: ProgressBar,
      progress: ProgressBarCounter[object],
      width: int,
  ) -> AnyFormattedText:
      if progress.done or progress.total or progress.stopped:
          sym_a, sym_b, sym_c = self.sym_a, self.sym_b, self.sym_c
  
          # Compute pb_a based on done, total, or stopped states.
          if progress.done:
              # 100% completed irrelevant of how much was actually marked as completed.
              percent = 1.0
          else:
              # Show percentage completed.
              percent = progress.percentage / 100
      else:
          # Total is unknown and bar is still running.
          sym_a, sym_b, sym_c = self.sym_c, self.unknown, self.sym_c
  
          # Compute percent based on the time.
          percent = time.time() * 20 % 100 / 100
  
      # Subtract left, sym_b, and right.
      width -= get_cwidth(self.start + sym_b + self.end)
  
      # Scale percent by width
      pb_a = int(percent * width)
      bar_a = sym_a * pb_a
      bar_b = sym_b
      bar_c = sym_c * (width - pb_a)
  
      return HTML(self.template).format(
          start=self.start,
          end=self.end,
          bar_a=bar_a,
          bar_b=bar_b,
          bar_c=bar_c,
      )
  
imports: from __future__ import annotations
  import datetime
  import time
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING
  from prompt_toolkit.formatted_text import HTML, AnyFormattedText, StyleAndTextTuples, to_formatted_text
  from prompt_toolkit.formatted_text.utils import fragment_list_width
  from prompt_toolkit.layout.dimension import AnyDimension, D
  from prompt_toolkit.layout.utils import explode_text_fragments
  from prompt_toolkit.utils import get_cwidth
label_desc: Use image node_id 2 for calling the Bar obj's underlying member method code with example usage: obj.format(progress_bar, progress, width) and returns: HTML