refactor(types): auto -> None sweep across entire codebase
Applied 236 return type annotations to functions with no return values across 100+ files (core modules, tests, scripts, simulations). Added Phase 4 to python_style_refactor track for remaining 597 items (untyped params, vars, and functions with return values). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import psutil
|
||||
import threading
|
||||
|
||||
class PerformanceMonitor:
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self._start_time = None
|
||||
self._last_frame_time = 0.0
|
||||
self._fps = 0.0
|
||||
@@ -32,7 +32,7 @@ class PerformanceMonitor:
|
||||
self._cpu_thread = threading.Thread(target=self._monitor_cpu, daemon=True)
|
||||
self._cpu_thread.start()
|
||||
|
||||
def _monitor_cpu(self):
|
||||
def _monitor_cpu(self) -> None:
|
||||
while not self._stop_event.is_set():
|
||||
# psutil.cpu_percent with interval=1.0 is blocking for 1 second.
|
||||
# To be responsive to stop_event, we use a smaller interval or no interval
|
||||
@@ -49,21 +49,21 @@ class PerformanceMonitor:
|
||||
break
|
||||
time.sleep(0.1)
|
||||
|
||||
def start_frame(self):
|
||||
def start_frame(self) -> None:
|
||||
self._start_time = time.time()
|
||||
|
||||
def record_input_event(self):
|
||||
def record_input_event(self) -> None:
|
||||
self._last_input_time = time.time()
|
||||
|
||||
def start_component(self, name: str):
|
||||
def start_component(self, name: str) -> None:
|
||||
self._comp_start[name] = time.time()
|
||||
|
||||
def end_component(self, name: str):
|
||||
def end_component(self, name: str) -> None:
|
||||
if name in self._comp_start:
|
||||
elapsed = (time.time() - self._comp_start[name]) * 1000.0
|
||||
self._component_timings[name] = elapsed
|
||||
|
||||
def end_frame(self):
|
||||
def end_frame(self) -> None:
|
||||
if self._start_time is None:
|
||||
return
|
||||
end_time = time.time()
|
||||
@@ -80,7 +80,7 @@ class PerformanceMonitor:
|
||||
self._frame_count = 0
|
||||
self._fps_last_time = end_time
|
||||
|
||||
def _check_alerts(self):
|
||||
def _check_alerts(self) -> None:
|
||||
if not self.alert_callback:
|
||||
return
|
||||
now = time.time()
|
||||
@@ -114,6 +114,6 @@ class PerformanceMonitor:
|
||||
metrics[f'time_{name}_ms'] = elapsed
|
||||
return metrics
|
||||
|
||||
def stop(self):
|
||||
def stop(self) -> None:
|
||||
self._stop_event.set()
|
||||
self._cpu_thread.join(timeout=2.0)
|
||||
|
||||
Reference in New Issue
Block a user