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

Method __init__

pager_lib/tqdm/notebook.py:202–245  ·  view source on GitHub ↗

Supports the usual `tqdm.tqdm` parameters as well as those listed below. Parameters ---------- display : Whether to call `display(self.container)` immediately [default: True].

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

200 self.container.children[-2].style.bar_color = bar_color
201
202 def __init__(self, *args, **kwargs):
203 """
204 Supports the usual `tqdm.tqdm` parameters as well as those listed below.
205
206 Parameters
207 ----------
208 display : Whether to call `display(self.container)` immediately
209 [default: True].
210 """
211 kwargs = kwargs.copy()
212 # Setup default output
213 file_kwarg = kwargs.get('file', sys.stderr)
214 if file_kwarg is sys.stderr or file_kwarg is None:
215 kwargs['file'] = sys.stdout # avoid the red block in IPython
216
217 # Initialize parent class + avoid printing by using gui=True
218 kwargs['gui'] = True
219 # convert disable = None to False
220 kwargs['disable'] = bool(kwargs.get('disable', False))
221 colour = kwargs.pop('colour', None)
222 display_here = kwargs.pop('display', True)
223 super().__init__(*args, **kwargs)
224 if self.disable or not kwargs['gui']:
225 self.disp = lambda *_, **__: None
226 return
227
228 # Get bar width
229 self.ncols = '100%' if self.dynamic_ncols else kwargs.get("ncols", None)
230
231 # Replace with IPython progress bar display (with correct total)
232 unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1
233 total = self.total * unit_scale if self.total else self.total
234 self.container = self.status_printer(self.fp, total, self.desc, self.ncols)
235 self.container.pbar = proxy(self)
236 self.displayed = False
237 if display_here and self.delay <= 0:
238 display(self.container)
239 self.displayed = True
240 self.disp = self.display
241 self.colour = colour
242
243 # Print initial bar state
244 if not self.disable:
245 self.display(check_delay=False)
246
247 def __iter__(self):
248 try:

Callers

nothing calls this directly

Calls 5

status_printerMethod · 0.95
displayMethod · 0.95
copyMethod · 0.80
popMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected