Print an in-place progress bar aligned to the step column layout.
(label: str)
| 1635 | |
| 1636 | |
| 1637 | def _progress(label: str) -> None: |
| 1638 | """Print an in-place progress bar aligned to the step column layout.""" |
| 1639 | global _STEP, _PROGRESS_LINE_ACTIVE |
| 1640 | _STEP += 1 |
| 1641 | if VERBOSE: |
| 1642 | return |
| 1643 | width = 20 |
| 1644 | filled = int(width * _STEP / _TOTAL) |
| 1645 | bar = "=" * filled + "-" * (width - filled) |
| 1646 | pad = " " * (_COL - len(_LABEL)) |
| 1647 | end = "\n" if _STEP >= _TOTAL else "" |
| 1648 | try: |
| 1649 | sys.stdout.write(f"\r {_dim(_LABEL)}{pad}[{bar}] {_STEP:2}/{_TOTAL} {label:<20}{end}") |
| 1650 | sys.stdout.flush() |
| 1651 | _PROGRESS_LINE_ACTIVE = end == "" |
| 1652 | except OSError: |
| 1653 | pass |
| 1654 | |
| 1655 | |
| 1656 | def run( |
no test coverage detected
searching dependent graphs…