mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-10 23:38:08 -05:00
Add return type annotations to functions in runtime/utils directory (#8335)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user