Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix mypy errors in storage directory (#7692)

Graham Neubiga899f80ee9df
diff --git a/openhands/storage/conversation/conversation_validator.py b/openhands/storage/conversation/conversation_validator.py
index 57180465a6..b44690dd70 100644
--- a/openhands/storage/conversation/conversation_validator.py
+++ b/openhands/storage/conversation/conversation_validator.py
@@ -6,11 +6,11 @@ from openhands.utils.import_utils import get_impl
class ConversationValidator:
"""Storage for conversation metadata. May or may not support multiple users depending on the environment."""
- async def validate(self, conversation_id: str, cookies_str: str):
+ async def validate(self, conversation_id: str, cookies_str: str) -> tuple[None, None]:
return None, None
-def create_conversation_validator():
+def create_conversation_validator() -> ConversationValidator:
conversation_validator_cls = os.environ.get(
'OPENHANDS_CONVERSATION_VALIDATOR_CLS',
'openhands.storage.conversation.conversation_validator.ConversationValidator',
diff --git a/openhands/storage/google_cloud.py b/openhands/storage/google_cloud.py
index cebaa0689d..eee3fa6985 100644
--- a/openhands/storage/google_cloud.py
+++ b/openhands/storage/google_cloud.py
@@ -1,10 +1,10 @@
import os
from google.api_core.exceptions import NotFound
-from google.cloud import storage # type: ignore
-from google.cloud.storage.blob import Blob # type: ignore
-from google.cloud.storage.bucket import Bucket # type: ignore
-from google.cloud.storage.client import Client # type: ignore
+from google.cloud import storage
+from google.cloud.storage.blob import Blob
+from google.cloud.storage.bucket import Bucket
+from google.cloud.storage.client import Client
from openhands.storage.files import FileStore
diff --git a/openhands/storage/s3.py b/openhands/storage/s3.py
index 0a42ee26bd..c520f96c42 100644
--- a/openhands/storage/s3.py
+++ b/openhands/storage/s3.py
@@ -60,7 +60,7 @@ class S3FileStore(FileStore):
response: GetObjectOutputDict = self.client.get_object(
Bucket=self.bucket, Key=path
)
- with response['Body'] as stream: # type: ignore
+ with response['Body'] as stream:
return str(stream.read().decode('utf-8'))
except botocore.exceptions.ClientError as e:
# Catch all S3-related errors