Return a string-based progress bar given some parameters Parameters ---------- n : int or float Number of finished iterations. total : int or float The expected total number of iterations. If meaningless (None), only bas
(n, total, elapsed, ncols=None, prefix='',
ascii=False, # pylint: disable=redefined-builtin
unit='it', unit_scale=False, rate=None, bar_format=None, postfix=None,
unit_divisor=1000, initial=0, colour=None, **extra_kwargs)
| 461 | |
| 462 | @staticmethod |
| 463 | def format_meter(n, total, elapsed, ncols=None, prefix='', |
| 464 | ascii=False, # pylint: disable=redefined-builtin |
| 465 | unit='it', unit_scale=False, rate=None, bar_format=None, postfix=None, |
| 466 | unit_divisor=1000, initial=0, colour=None, **extra_kwargs): |
| 467 | """ |
| 468 | Return a string-based progress bar given some parameters |
| 469 | |
| 470 | Parameters |
| 471 | ---------- |
| 472 | n : int or float |
| 473 | Number of finished iterations. |
| 474 | total : int or float |
| 475 | The expected total number of iterations. If meaningless (None), |
| 476 | only basic progress statistics are displayed (no ETA). |
| 477 | elapsed : float |
| 478 | Number of seconds passed since start. |
| 479 | ncols : int, optional |
| 480 | The width of the entire output message. If specified, |
| 481 | dynamically resizes `{bar}` to stay within this bound |
| 482 | [default: None]. If `0`, will not print any bar (only stats). |
| 483 | The fallback is `{bar:10}`. |
| 484 | prefix : str, optional |
| 485 | Prefix message (included in total width) [default: '']. |
| 486 | Use as {desc} in bar_format string. |
| 487 | ascii : bool, optional or str, optional |
| 488 | If not set, use unicode (smooth blocks) to fill the meter |
| 489 | [default: False]. The fallback is to use ASCII characters |
| 490 | " 123456789#". |
| 491 | unit : str, optional |
| 492 | The iteration unit [default: 'it']. |
| 493 | unit_scale : bool or int or float, optional |
| 494 | If 1 or True, the number of iterations will be printed with an |
| 495 | appropriate SI metric prefix (k = 10^3, M = 10^6, etc.) |
| 496 | [default: False]. If any other non-zero number, will scale |
| 497 | `total` and `n`. |
| 498 | rate : float, optional |
| 499 | Manual override for iteration rate. |
| 500 | If [default: None], uses n/elapsed. |
| 501 | bar_format : str, optional |
| 502 | Specify a custom bar string formatting. May impact performance. |
| 503 | [default: '{l_bar}{bar}{r_bar}'], where |
| 504 | l_bar='{desc}: {percentage:3.0f}%|' and |
| 505 | r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' |
| 506 | '{rate_fmt}{postfix}]' |
| 507 | Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, |
| 508 | percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, |
| 509 | rate, rate_fmt, rate_noinv, rate_noinv_fmt, |
| 510 | rate_inv, rate_inv_fmt, postfix, unit_divisor, |
| 511 | remaining, remaining_s, eta. |
| 512 | Note that a trailing ": " is automatically removed after {desc} |
| 513 | if the latter is empty. |
| 514 | postfix : *, optional |
| 515 | Similar to `prefix`, but placed at the end |
| 516 | (e.g. for additional stats). |
| 517 | Note: postfix is usually a string (not a dict) for this method, |
| 518 | and will if possible be set to postfix = ', ' + postfix. |
| 519 | However other types are supported (#382). |
| 520 | unit_divisor : float, optional |