Skip to content

Commit 4e69098

Browse files
rustyconoverclaude
andcommitted
Fix all mypy errors in http_server.py
- Import LogFormat/LogLevel from vgi.logging_config instead of vgi.worker - Add proper type annotations to _SigV4S3Storage methods (schema: Any, return types) to eliminate no-untyped-def suppressions - Move boto3/botocore type: ignore to import-untyped (correct error code) - Add explicit str annotation to fix no-any-return from presigned URL Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 62f9683 commit 4e69098

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

vgi/examples/http_server.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
import os
1717
import sys
1818
from datetime import UTC, datetime, timedelta
19+
from typing import TYPE_CHECKING, Any
1920

2021
from vgi.examples.worker import ExampleWorker
21-
from vgi.logging_config import configure_worker_logging
22-
from vgi.worker import LogFormat, LogLevel
22+
from vgi.logging_config import LogFormat, LogLevel, configure_worker_logging
23+
24+
if TYPE_CHECKING:
25+
from vgi_rpc.external import UploadUrl
2326

2427

2528
class _SigV4S3Storage:
@@ -41,10 +44,10 @@ def __init__(
4144
self.presign_expiry_seconds = presign_expiry_seconds
4245
self._client = None
4346

44-
def _get_client(self): # type: ignore[no-untyped-def]
47+
def _get_client(self) -> Any:
4548
if self._client is None:
46-
import boto3
47-
from botocore.config import Config
49+
import boto3 # type: ignore[import-untyped]
50+
from botocore.config import Config # type: ignore[import-untyped]
4851

4952
self._client = boto3.client(
5053
"s3",
@@ -54,7 +57,7 @@ def _get_client(self): # type: ignore[no-untyped-def]
5457
)
5558
return self._client
5659

57-
def upload(self, data: bytes, schema, *, content_encoding: str | None = None) -> str: # type: ignore[no-untyped-def]
60+
def upload(self, data: bytes, schema: Any, *, content_encoding: str | None = None) -> str:
5861
import uuid
5962

6063
client = self._get_client()
@@ -71,13 +74,14 @@ def upload(self, data: bytes, schema, *, content_encoding: str | None = None) ->
7174
put_kwargs["ContentEncoding"] = content_encoding
7275
client.put_object(**put_kwargs)
7376

74-
return client.generate_presigned_url(
77+
url: str = client.generate_presigned_url(
7578
"get_object",
7679
Params={"Bucket": self.bucket, "Key": key},
7780
ExpiresIn=self.presign_expiry_seconds,
7881
)
82+
return url
7983

80-
def generate_upload_url(self, schema): # type: ignore[no-untyped-def]
84+
def generate_upload_url(self, schema: Any) -> UploadUrl:
8185
import uuid
8286

8387
from vgi_rpc.external import UploadUrl

0 commit comments

Comments
 (0)