MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / ModuleProgressBar

Class ModuleProgressBar

codewiki/cli/utils/progress.py:176–221  ·  view source on GitHub ↗

Progress bar for module-by-module generation.

Source from the content-addressed store, hash-verified

174
175
176class ModuleProgressBar:
177 """Progress bar for module-by-module generation."""
178
179 def __init__(self, total_modules: int, verbose: bool = False):
180 """
181 Initialize module progress bar.
182
183 Args:
184 total_modules: Total number of modules to process
185 verbose: Enable verbose output
186 """
187 self.total_modules = total_modules
188 self.current_module = 0
189 self.verbose = verbose
190 self.bar = None
191
192 if not verbose:
193 self.bar = click.progressbar(
194 length=total_modules,
195 label="Generating modules",
196 show_eta=True,
197 show_percent=True,
198 )
199 self.bar.__enter__()
200
201 def update(self, module_name: str, cached: bool = False):
202 """
203 Update progress for a module.
204
205 Args:
206 module_name: Name of the module
207 cached: Whether the module was loaded from cache
208 """
209 self.current_module += 1
210
211 if self.verbose:
212 status = "✓ (cached)" if cached else "⟳ (generating)"
213 click.echo(f" [{self.current_module}/{self.total_modules}] {module_name}... {status}")
214 elif self.bar:
215 self.bar.update(1)
216
217 def finish(self):
218 """Finish progress bar."""
219 if self.bar:
220 self.bar.__exit__(None, None, None)
221 self.bar = None
222

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected