Wrapper around Tqdm which can be updated in threads. Usage: ``` with utils.async_tqdm(...) as pbar: # pbar can then be modified inside a thread # pbar.update_total(3) # pbar.update() ``` Args: *args: args of tqdm **kwargs: kwargs of tqdm Yields: pbar: Async pb
(*args, **kwargs)
| 148 | |
| 149 | @contextlib.contextmanager |
| 150 | def _async_tqdm(*args, **kwargs): |
| 151 | """Wrapper around Tqdm which can be updated in threads. |
| 152 | |
| 153 | Usage: |
| 154 | |
| 155 | ``` |
| 156 | with utils.async_tqdm(...) as pbar: |
| 157 | # pbar can then be modified inside a thread |
| 158 | # pbar.update_total(3) |
| 159 | # pbar.update() |
| 160 | ``` |
| 161 | |
| 162 | Args: |
| 163 | *args: args of tqdm |
| 164 | **kwargs: kwargs of tqdm |
| 165 | |
| 166 | Yields: |
| 167 | pbar: Async pbar which can be shared between threads. |
| 168 | """ |
| 169 | with tqdm_lib.tqdm(*args, **kwargs) as pbar: |
| 170 | pbar = _TqdmPbarAsync(pbar) |
| 171 | yield pbar |
| 172 | pbar.clear() # pop pbar from the active list of pbar |
| 173 | |
| 174 | |
| 175 | class _TqdmPbarAsync(EmptyTqdm): |
no test coverage detected