class_docstr: Generate a command-line progressbar.
  
  Parameters
  ----------
  iterable : iterable | int | None
      The iterable to use. Can also be an int for backward compatibility
      (acts like ``max_value``).
  initial_value : int
      Initial value of process, useful when resuming process from a specific
      value, defaults to 0.
  mesg : str
      Message to include at end of progress bar.
  max_total_width : int | str
      Maximum total message width. Can use "auto" (default) to try to set
      a sane value based on the current terminal width.
  max_value : int | None
      The max value. If None, the length of ``iterable`` will be used.
  which_tqdm : str | None
      Which tqdm module to use. Can be "tqdm", "tqdm.notebook", or "off".
      Defaults to ``None``, which uses the value of the MNE_TQDM environment
      variable, or ``"tqdm.auto"`` if that is not set.
  **kwargs : dict
      Additional keyword arguments for tqdm.
class_docstr_tok: ["Generate","a","command-line","progressbar",".","Parameters","--","--","--","--","--","iterable",":","iterable","|","int","|","None","The","iterable","to","use",".","Can","also","be","an","int","for","backward","compatibility","(","acts","like","``","max_value","``",")",".","initial_value",":","int","Initial","value","of","process",",","useful","when","resuming","process","from","a","specific","value",",","defaults","to","0.","mesg",":","str","Message","to","include","at","end","of","progress","bar",".","max_total_width",":","int","|","str","Maximum","total","message","width",".","Can","use","``","auto","''","(","default",")","to","try","to","set","a","sane","value","based","on","the","current","terminal","width",".","max_value",":","int","|","None","The","max","value",".","If","None",",","the","length","of","``","iterable","``","will","be","used",".","which_tqdm",":","str","|","None","Which","tqdm","module","to","use",".","Can","be","``","tqdm","''",",","``","tqdm.notebook","''",",","or","``","off","''",".","Defaults","to","``","None","``",",","which","uses","the","value","of","the","MNE_TQDM","environment","variable",",","or","``","``","tqdm.auto","''","``","if","that","is","not","set",".","*","*","kwargs",":","dict","Additional","keyword","arguments","for","tqdm","."]
code: def __init__(
      self,
      iterable=None,
      initial_value=0,
      mesg=None,
      max_total_width="auto",
      max_value=None,
      *,
      which_tqdm=None,
      **kwargs,
  ):
      # The following mimics this, but with configurable module to use
      # from ..externals.tqdm import auto
      import tqdm
  
      if which_tqdm is None:
          which_tqdm = get_config("MNE_TQDM", "tqdm.auto")
      _check_option(
          "MNE_TQDM",
          which_tqdm[:5],
          ("tqdm", "tqdm.", "off"),
          extra="beginning",
      )
      logger.debug(f"Using ProgressBar with {which_tqdm}")
      if which_tqdm not in ("tqdm", "off"):
          try:
              __import__(which_tqdm)
          except Exception as exc:
              raise ValueError(
                  f"Unknown tqdm backend {repr(which_tqdm)}, got: {exc}"
              ) from None
          tqdm = getattr(tqdm, which_tqdm.split(".", 1)[1])
      tqdm = tqdm.tqdm
      defaults = dict(
          leave=True,
          mininterval=0.016,
          miniters=1,
          smoothing=0.05,
          bar_format="{percentage:3.0f}%|{bar}| {desc} : {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_fmt:>11}{postfix}]",  # noqa: E501
      )
      for key, val in defaults.items():
          if key not in kwargs:
              kwargs.update({key: val})
      if isinstance(iterable, Iterable):
          self.iterable = iterable
          if max_value is None:
              self.max_value = len(iterable)
          else:
              self.max_value = max_value
      else:  # ignore max_value then
          self.max_value = int(iterable)
          self.iterable = None
      if max_total_width == "auto":
          max_total_width = None  # tqdm's auto
      with tempfile.NamedTemporaryFile(
          "wb", prefix="tmp_mne_prog"
      ) as tf:
          self._mmap_fname = tf.name
      del tf  # should remove the file
      self._mmap = None
      disable = logger.level > logging.INFO or which_tqdm == "off"
      self._tqdm = tqdm(
          iterable=self.iterable,
          desc=mesg,
          total=self.max_value,
          initial=initial_value,
          ncols=max_total_width,
          disable=disable,
          **kwargs,
      )
  
imports: import logging
  import os
  import os.path
  import tempfile
  import time
  from collections.abc import Iterable
  from threading import Thread
  import numpy
  from ._logging import logger
  from .check import _check_option
  from .config import get_config
label_desc: Use image node_id 1 to create a new ProgressBar object  with example: obj = ProgressBar(iterable, initial_value, mesg, max_total_width, max_value)