Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Add return type annotations to functions in runtime/utils directory (#8335)

Graham Neubigf2af1807e33a
diff --git a/openhands/runtime/utils/edit.py b/openhands/runtime/utils/edit.py
index 8a189f948e..bdd11bc5fa 100644
--- a/openhands/runtime/utils/edit.py
+++ b/openhands/runtime/utils/edit.py
@@ -4,7 +4,7 @@ import tempfile
from abc import ABC, abstractmethod
from typing import Any
-from openhands_aci.utils.diff import get_diff # type: ignore
+from openhands_aci.utils.diff import get_diff
from openhands.core.config import AppConfig
from openhands.core.logger import openhands_logger as logger
diff --git a/openhands/runtime/utils/windows_bash.py b/openhands/runtime/utils/windows_bash.py
index 30a360dfff..aae6fa6b47 100644
--- a/openhands/runtime/utils/windows_bash.py
+++ b/openhands/runtime/utils/windows_bash.py
@@ -149,7 +149,7 @@ class WindowsPowershellSession:
self.close() # Ensure cleanup if init fails partially
raise RuntimeError(f'Failed to initialize PowerShell runspace: {e}')
- def _set_initial_cwd(self):
+ def _set_initial_cwd(self) -> None:
"""Sets the initial working directory in the runspace."""
ps = None
try:
@@ -174,7 +174,7 @@ class WindowsPowershellSession:
if ps:
ps.Dispose()
- def _confirm_cwd(self):
+ def _confirm_cwd(self) -> None:
"""Confirms the actual CWD in the runspace and updates self._cwd."""
ps_confirm = None
try:
@@ -1350,7 +1350,7 @@ class WindowsPowershellSession:
content=final_output, command=command, metadata=metadata
)
- def close(self):
+ def close(self) -> None:
"""Closes the PowerShell runspace and releases resources, stopping any active job."""
if self._closed:
return
@@ -1408,6 +1408,6 @@ class WindowsPowershellSession:
self._initialized = False
self._closed = True
- def __del__(self):
+ def __del__(self) -> None:
"""Destructor ensures the runspace is closed."""
self.close()