diff --git a/openhands/storage/conversation/conversation_store.py b/openhands/storage/conversation/conversation_store.py index 8c55920efa62..efe95b1b6983 100644 --- a/openhands/storage/conversation/conversation_store.py +++ b/openhands/storage/conversation/conversation_store.py @@ -15,7 +15,7 @@ class ConversationStore(ABC): """ @abstractmethod - async def save_metadata(self, metadata: ConversationMetadata): + async def save_metadata(self, metadata: ConversationMetadata) -> None: """Store conversation metadata""" @abstractmethod diff --git a/openhands/storage/conversation/file_conversation_store.py b/openhands/storage/conversation/file_conversation_store.py index 79e04921078e..0f7d1f9fa961 100644 --- a/openhands/storage/conversation/file_conversation_store.py +++ b/openhands/storage/conversation/file_conversation_store.py @@ -29,7 +29,7 @@ class FileConversationStore(ConversationStore): file_store: FileStore - async def save_metadata(self, metadata: ConversationMetadata): + async def save_metadata(self, metadata: ConversationMetadata) -> None: json_str = conversation_metadata_type_adapter.dump_json(metadata) path = self.get_conversation_metadata_filename(metadata.conversation_id) await call_sync_from_async(self.file_store.write, path, json_str) diff --git a/openhands/storage/google_cloud.py b/openhands/storage/google_cloud.py index 19465c0442ce..24466e81ef8a 100644 --- a/openhands/storage/google_cloud.py +++ b/openhands/storage/google_cloud.py @@ -29,7 +29,7 @@ def read(self, path: str) -> str: blob = self.bucket.blob(path) try: with blob.open('r') as f: - return f.read() + return str(f.read()) except NotFound as err: raise FileNotFoundError(err) diff --git a/openhands/storage/local.py b/openhands/storage/local.py index 38815bce1f0d..711a364cf5d1 100644 --- a/openhands/storage/local.py +++ b/openhands/storage/local.py @@ -17,7 +17,7 @@ def get_full_path(self, path: str) -> str: path = path[1:] return os.path.join(self.root, path) - def write(self, path: str, contents: str | bytes): + def write(self, path: str, contents: str | bytes) -> None: full_path = self.get_full_path(path) os.makedirs(os.path.dirname(full_path), exist_ok=True) mode = 'w' if isinstance(contents, str) else 'wb' diff --git a/openhands/storage/s3.py b/openhands/storage/s3.py index cb723355155d..4fb59b920d6c 100644 --- a/openhands/storage/s3.py +++ b/openhands/storage/s3.py @@ -46,7 +46,7 @@ def read(self, path: str) -> str: try: response = self.client.get_object(Bucket=self.bucket, Key=path) with response['Body'] as stream: - return stream.read().decode('utf-8') + return str(stream.read().decode('utf-8')) except botocore.exceptions.ClientError as e: # Catch all S3-related errors if e.response['Error']['Code'] == 'NoSuchBucket': diff --git a/openhands/storage/settings/file_settings_store.py b/openhands/storage/settings/file_settings_store.py index d3cc08677078..3c5cf9584891 100644 --- a/openhands/storage/settings/file_settings_store.py +++ b/openhands/storage/settings/file_settings_store.py @@ -25,7 +25,7 @@ async def load(self) -> Settings | None: except FileNotFoundError: return None - async def store(self, settings: Settings): + async def store(self, settings: Settings) -> None: json_str = settings.model_dump_json(context={'expose_secrets': True}) await call_sync_from_async(self.file_store.write, self.path, json_str) diff --git a/openhands/storage/settings/settings_store.py b/openhands/storage/settings/settings_store.py index cd64ae8e1ea5..c9fdd093ccb9 100644 --- a/openhands/storage/settings/settings_store.py +++ b/openhands/storage/settings/settings_store.py @@ -16,7 +16,7 @@ async def load(self) -> Settings | None: """Load session init data""" @abstractmethod - async def store(self, settings: Settings): + async def store(self, settings: Settings) -> None: """Store session init data""" @classmethod