diff --git a/posthog/temporal/workflows/s3_batch_export.py b/posthog/temporal/workflows/s3_batch_export.py index cfd947ea14f21..13bbf183e5d06 100644 --- a/posthog/temporal/workflows/s3_batch_export.py +++ b/posthog/temporal/workflows/s3_batch_export.py @@ -85,6 +85,9 @@ class S3MultiPartUploadState(typing.NamedTuple): parts: list[dict[str, str | int]] +Part = dict[str, str | int] + + class S3MultiPartUpload: """An S3 multi-part upload.""" @@ -94,8 +97,8 @@ def __init__(self, s3_client, bucket_name: str, key: str, encryption: str | None self.key = key self.encryption = encryption self.kms_key_id = kms_key_id - self.upload_id = None - self.parts = [] + self.upload_id: str | None = None + self.parts: list[Part] = [] def to_state(self) -> S3MultiPartUploadState: """Produce state tuple that can be used to resume this S3MultiPartUpload.""" @@ -132,9 +135,10 @@ def start(self) -> str: Key=self.key, **optional_kwargs, ) - self.upload_id = multipart_response["UploadId"] + upload_id: str = multipart_response["UploadId"] + self.upload_id = upload_id - return self.upload_id + return upload_id def continue_from_state(self, state: S3MultiPartUploadState): """Continue this S3MultiPartUpload from a previous state."""