(self, *args, **kwargs)
| 152 | |
| 153 | class tqdm_rich(std_tqdm): |
| 154 | def __init__(self, *args, **kwargs): |
| 155 | custom_progress = kwargs.pop("progress", None) |
| 156 | options = kwargs.pop("options", {}).copy() |
| 157 | super().__init__(*args, **kwargs) |
| 158 | if self.disable: |
| 159 | return |
| 160 | |
| 161 | d = self.format_dict |
| 162 | if custom_progress is None: |
| 163 | custom_progress = progress |
| 164 | custom_progress.columns = ( |
| 165 | TimeColumn(), |
| 166 | "[progress.description]{task.description}[progress.percentage]{task.percentage:>4.0f}%", |
| 167 | BarColumn(), |
| 168 | FractionColumn( |
| 169 | unit_scale=d["unit_scale"], |
| 170 | unit_divisor=d["unit_divisor"], |
| 171 | ), |
| 172 | TimeElapsedColumn(), |
| 173 | "<", |
| 174 | TimeRemainingColumn(), |
| 175 | RateColumn( |
| 176 | unit=d["unit"], |
| 177 | unit_scale=d["unit_scale"], |
| 178 | unit_divisor=d["unit_divisor"], |
| 179 | ), |
| 180 | ) |
| 181 | elif options: |
| 182 | for key, value in options.items(): |
| 183 | setattr(custom_progress, key, value) |
| 184 | |
| 185 | self._prog = custom_progress |
| 186 | self._prog.start() |
| 187 | self._task_id = self._prog.add_task(self.desc or "", **d) |
| 188 | |
| 189 | def close(self): |
| 190 | if self.disable: |
no test coverage detected