MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / __init__

Method __init__

pager_lib/tqdm/rich.py:75–114  ·  view source on GitHub ↗

This class accepts the following parameters *in addition* to the parameters accepted by `tqdm`. Parameters ---------- progress : tuple, optional arguments for `rich.progress.Progress()`. options : dict, optional keyword argu

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

73 """Experimental rich.progress GUI version of tqdm!"""
74 # TODO: @classmethod: write()?
75 def __init__(self, *args, **kwargs):
76 """
77 This class accepts the following parameters *in addition* to
78 the parameters accepted by `tqdm`.
79
80 Parameters
81 ----------
82 progress : tuple, optional
83 arguments for `rich.progress.Progress()`.
84 options : dict, optional
85 keyword arguments for `rich.progress.Progress()`.
86 """
87 kwargs = kwargs.copy()
88 kwargs['gui'] = True
89 # convert disable = None to False
90 kwargs['disable'] = bool(kwargs.get('disable', False))
91 progress = kwargs.pop('progress', None)
92 options = kwargs.pop('options', {}).copy()
93 super().__init__(*args, **kwargs)
94
95 if self.disable:
96 return
97
98 warn("rich is experimental/alpha", TqdmExperimentalWarning, stacklevel=2)
99 d = self.format_dict
100 if progress is None:
101 progress = (
102 "[progress.description]{task.description}"
103 "[progress.percentage]{task.percentage:>4.0f}%",
104 BarColumn(bar_width=None),
105 FractionColumn(
106 unit_scale=d['unit_scale'], unit_divisor=d['unit_divisor']),
107 "[", TimeElapsedColumn(), "<", TimeRemainingColumn(),
108 ",", RateColumn(unit=d['unit'], unit_scale=d['unit_scale'],
109 unit_divisor=d['unit_divisor']), "]"
110 )
111 options.setdefault('transient', not self.leave)
112 self._prog = Progress(*progress, **options)
113 self._prog.__enter__()
114 self._task_id = self._prog.add_task(self.desc or "", **d)
115
116 def close(self):
117 if self.disable:

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 6

FractionColumnClass · 0.85
RateColumnClass · 0.85
copyMethod · 0.80
popMethod · 0.80
getMethod · 0.45
__enter__Method · 0.45

Tested by

no test coverage detected