Fix mypy errors in storage directory (#7692)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Graham Neubig
2025-04-03 15:01:43 -04:00
committed by GitHub
parent 292217b8b4
commit a899f80ee9
3 changed files with 7 additions and 7 deletions

View File

@@ -6,11 +6,11 @@ from openhands.utils.import_utils import get_impl
class ConversationValidator: class ConversationValidator:
"""Storage for conversation metadata. May or may not support multiple users depending on the environment.""" """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 return None, None
def create_conversation_validator(): def create_conversation_validator() -> ConversationValidator:
conversation_validator_cls = os.environ.get( conversation_validator_cls = os.environ.get(
'OPENHANDS_CONVERSATION_VALIDATOR_CLS', 'OPENHANDS_CONVERSATION_VALIDATOR_CLS',
'openhands.storage.conversation.conversation_validator.ConversationValidator', 'openhands.storage.conversation.conversation_validator.ConversationValidator',

View File

@@ -1,10 +1,10 @@
import os import os
from google.api_core.exceptions import NotFound from google.api_core.exceptions import NotFound
from google.cloud import storage # type: ignore from google.cloud import storage
from google.cloud.storage.blob import Blob # type: ignore from google.cloud.storage.blob import Blob
from google.cloud.storage.bucket import Bucket # type: ignore from google.cloud.storage.bucket import Bucket
from google.cloud.storage.client import Client # type: ignore from google.cloud.storage.client import Client
from openhands.storage.files import FileStore from openhands.storage.files import FileStore

View File

@@ -60,7 +60,7 @@ class S3FileStore(FileStore):
response: GetObjectOutputDict = self.client.get_object( response: GetObjectOutputDict = self.client.get_object(
Bucket=self.bucket, Key=path Bucket=self.bucket, Key=path
) )
with response['Body'] as stream: # type: ignore with response['Body'] as stream:
return str(stream.read().decode('utf-8')) return str(stream.read().decode('utf-8'))
except botocore.exceptions.ClientError as e: except botocore.exceptions.ClientError as e:
# Catch all S3-related errors # Catch all S3-related errors