MCPcopy
hub / github.com/mne-tools/mne-python / ProgressBar

Class ProgressBar

mne/utils/progressbar.py:22–192  ·  view source on GitHub ↗

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 proces

Source from the content-addressed store, hash-verified

20
21
22class ProgressBar:
23 """Generate a command-line progressbar.
24
25 Parameters
26 ----------
27 iterable : iterable | int | None
28 The iterable to use. Can also be an int for backward compatibility
29 (acts like ``max_value``).
30 initial_value : int
31 Initial value of process, useful when resuming process from a specific
32 value, defaults to 0.
33 mesg : str
34 Message to include at end of progress bar.
35 max_total_width : int | str
36 Maximum total message width. Can use "auto" (default) to try to set
37 a sane value based on the current terminal width.
38 max_value : int | None
39 The max value. If None, the length of ``iterable`` will be used.
40 which_tqdm : str | None
41 Which tqdm module to use. Can be "tqdm", "tqdm.notebook", or "off".
42 Defaults to ``None``, which uses the value of the MNE_TQDM environment
43 variable, or ``"tqdm.auto"`` if that is not set.
44 **kwargs : dict
45 Additional keyword arguments for tqdm.
46 """
47
48 def __init__(
49 self,
50 iterable=None,
51 initial_value=0,
52 mesg=None,
53 max_total_width="auto",
54 max_value=None,
55 *,
56 which_tqdm=None,
57 **kwargs,
58 ):
59 # The following mimics this, but with configurable module to use
60 # from ..externals.tqdm import auto
61 import tqdm
62
63 if which_tqdm is None:
64 which_tqdm = get_config("MNE_TQDM", "tqdm.auto")
65 _check_option(
66 "MNE_TQDM", which_tqdm[:5], ("tqdm", "tqdm.", "off"), extra="beginning"
67 )
68 logger.debug(f"Using ProgressBar with {which_tqdm}")
69 if which_tqdm not in ("tqdm", "off"):
70 try:
71 __import__(which_tqdm)
72 except Exception as exc:
73 raise ValueError(
74 f"Unknown tqdm backend {repr(which_tqdm)}, got: {exc}"
75 ) from None
76 tqdm = getattr(tqdm, which_tqdm.split(".", 1)[1])
77 tqdm = tqdm.tqdm
78 defaults = dict(
79 leave=True,

Callers 13

test_progressbarFunction · 0.90
parallel_progressFunction · 0.85
_morph_volsMethod · 0.85
_compute_chpi_amp_or_snrFunction · 0.85
compute_chpi_locsFunction · 0.85
filter_chpiFunction · 0.85
_compute_corrsFunction · 0.85

Calls

no outgoing calls

Tested by 3

test_progressbarFunction · 0.72