Skip to content

Commit

Permalink
fix: Satisfy the typing gods
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Sep 13, 2023
1 parent d30ce34 commit 1e16446
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions posthog/temporal/workflows/s3_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand All @@ -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."""
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 1e16446

Please sign in to comment.