| 661 | f'{n_fmt}{unit} [{elapsed_str}, {rate_fmt}{postfix}]') |
| 662 | |
| 663 | def __new__(cls, *_, **__): |
| 664 | instance = object.__new__(cls) |
| 665 | with cls.get_lock(): # also constructs lock if non-existent |
| 666 | cls._instances.add(instance) |
| 667 | # create monitoring thread |
| 668 | if cls.monitor_interval and (cls.monitor is None |
| 669 | or not cls.monitor.report()): |
| 670 | try: |
| 671 | cls.monitor = TMonitor(cls, cls.monitor_interval) |
| 672 | except Exception as e: # pragma: nocover |
| 673 | warn("tqdm:disabling monitor support" |
| 674 | " (monitor_interval = 0) due to:\n" + str(e), |
| 675 | TqdmMonitorWarning, stacklevel=2) |
| 676 | cls.monitor_interval = 0 |
| 677 | return instance |
| 678 | |
| 679 | @classmethod |
| 680 | def _get_free_pos(cls, instance=None): |