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:
2026-02-28 11:16:56 -05:00
parent 07f4e36016
commit 60396f03f8
98 changed files with 311 additions and 240 deletions

View File

@@ -8,7 +8,7 @@ from log_registry import LogRegistry
class TestLogRegistry(unittest.TestCase):
def setUp(self):
def setUp(self) -> None:
"""Set up a temporary directory and registry file for each test."""
self.temp_dir = tempfile.TemporaryDirectory()
self.registry_path = os.path.join(self.temp_dir.name, "registry.toml")
@@ -19,11 +19,11 @@ class TestLogRegistry(unittest.TestCase):
# Instantiate LogRegistry. This will load from the empty file.
self.registry = LogRegistry(self.registry_path)
def tearDown(self):
def tearDown(self) -> None:
"""Clean up the temporary directory and its contents after each test."""
self.temp_dir.cleanup()
def test_instantiation(self):
def test_instantiation(self) -> None:
"""Test LogRegistry instantiation with a file path."""
self.assertIsInstance(self.registry, LogRegistry)
self.assertEqual(self.registry.registry_path, self.registry_path)
@@ -31,7 +31,7 @@ class TestLogRegistry(unittest.TestCase):
self.assertTrue(os.path.exists(self.registry_path))
# We will verify content in other tests that explicitly save and reload.
def test_register_session(self):
def test_register_session(self) -> None:
"""Test registering a new session."""
session_id = "session-123"
path = "/path/to/session/123"
@@ -53,7 +53,7 @@ class TestLogRegistry(unittest.TestCase):
reloaded_start_time = datetime.fromisoformat(reloaded_session_data['start_time'])
self.assertAlmostEqual(reloaded_start_time, start_time, delta=timedelta(seconds=1))
def test_update_session_metadata(self):
def test_update_session_metadata(self) -> None:
"""Test updating session metadata."""
session_id = "session-456"
path = "/path/to/session/456"
@@ -84,7 +84,7 @@ class TestLogRegistry(unittest.TestCase):
self.assertTrue(reloaded_session_data.get('metadata', {}).get('whitelisted', False))
self.assertTrue(reloaded_session_data.get('whitelisted', False)) # Check main flag too
def test_is_session_whitelisted(self):
def test_is_session_whitelisted(self) -> None:
"""Test checking if a session is whitelisted."""
session_id_whitelisted = "session-789-whitelisted"
path_w = "/path/to/session/789"
@@ -102,7 +102,7 @@ class TestLogRegistry(unittest.TestCase):
# Test for a non-existent session, should be treated as not whitelisted
self.assertFalse(self.registry.is_session_whitelisted("non-existent-session"))
def test_get_old_non_whitelisted_sessions(self):
def test_get_old_non_whitelisted_sessions(self) -> None:
"""Test retrieving old, non-whitelisted sessions."""
now = datetime.utcnow()
# Define a cutoff time that is 7 days ago