mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-07 22:14:03 -05:00
Fix mypy errors in storage directory (#7692)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user