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

Class ProgressTracker

codewiki/cli/utils/progress.py:11–173  ·  view source on GitHub ↗

Progress tracker with stages and ETA estimation. Stages: 1. Dependency Analysis (40% of time) 2. Module Clustering (20% of time) 3. Documentation Generation (30% of time) 4. HTML Generation (5% of time, optional) 5. Finalization (5% of time)

Source from the content-addressed store, hash-verified

9
10class ProgressTracker:
11 """
12 Progress tracker with stages and ETA estimation.
13
14 Stages:
15 1. Dependency Analysis (40% of time)
16 2. Module Clustering (20% of time)
17 3. Documentation Generation (30% of time)
18 4. HTML Generation (5% of time, optional)
19 5. Finalization (5% of time)
20 """
21
22 # Stage weights (percentage of total time)
23 STAGE_WEIGHTS = {
24 1: 0.40, # Dependency Analysis
25 2: 0.20, # Module Clustering
26 3: 0.30, # Documentation Generation
27 4: 0.05, # HTML Generation (optional)
28 5: 0.05, # Finalization
29 }
30
31 STAGE_NAMES = {
32 1: "Dependency Analysis",
33 2: "Module Clustering",
34 3: "Documentation Generation",
35 4: "HTML Generation",
36 5: "Finalization",
37 }
38
39 def __init__(self, total_stages: int = 5, verbose: bool = False):
40 """
41 Initialize progress tracker.
42
43 Args:
44 total_stages: Number of stages
45 verbose: Enable verbose output
46 """
47 self.total_stages = total_stages
48 self.current_stage = 0
49 self.stage_progress = 0.0
50 self.start_time = time.time()
51 self.verbose = verbose
52 self.current_stage_start = self.start_time
53
54 def start_stage(self, stage: int, description: Optional[str] = None):
55 """
56 Start a new stage.
57
58 Args:
59 stage: Stage number (1-5)
60 description: Optional custom description
61 """
62 self.current_stage = stage
63 self.stage_progress = 0.0
64 self.current_stage_start = time.time()
65
66 stage_name = description or self.STAGE_NAMES.get(stage, f"Stage {stage}")
67
68 if self.verbose:

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected