Skip to content

Commit ba6aa66

Browse files
committed
mypy fixes
1 parent 4e691b1 commit ba6aa66

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

aws_lambda_powertools/utilities/data_classes/kinesis_firehose_event.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
import base64
22
import json
3-
from typing import Iterator
3+
from typing import Iterator, Optional
44

55
from aws_lambda_powertools.utilities.data_classes.common import DictWrapper
66

77

88
class KinesisFirehoseRecordMetadata(DictWrapper):
99
@property
10-
def shard_id(self) -> str:
10+
def shard_id(self) -> Optional[str]:
1111
"""Kinesis stream shard ID; present only when Kinesis Stream is source"""
1212
return self.get("shardId")
1313

1414
@property
15-
def partition_key(self) -> str:
15+
def partition_key(self) -> Optional[str]
1616
"""Kinesis stream partition key; present only when Kinesis Stream is source"""
1717
return self.get("partitionKey")
1818

1919
@property
20-
def approximate_arrival_timestamp(self) -> str:
20+
def approximate_arrival_timestamp(self) -> Optional[str]
2121
"""Kinesis stream approximate arrival ISO timestamp; present only when Kinesis Stream is source"""
2222
return self.get("approximateArrivalTimestamp")
2323

2424
@property
25-
def sequence_number(self) -> str:
25+
def sequence_number(self) -> Optional[str]
2626
"""Kinesis stream sequence number; present only when Kinesis Stream is source"""
2727
return self.get("sequenceNumber")
2828

2929
@property
30-
def subsequence_number(self) -> str:
30+
def subsequence_number(self) -> Optional[str]
3131
"""Kinesis stream sub-sequence number; present only when Kinesis Stream is source
3232
3333
Note: this will only be present for Kinesis streams using record aggregation
@@ -50,9 +50,9 @@ def record_id(self) -> str:
5050
def data(self) -> str:
5151
"""The data blob, base64-encoded"""
5252
return self["data"]
53-
53+
5454
@property
55-
def metadata(self) -> KinesisFirehoseRecordMetadata:
55+
def metadata(self) -> Optional[KinesisFirehoseRecordMetadata]:
5656
"""Optional: metadata associated with this record; present only when Kinesis Stream is source"""
5757
return KinesisFirehoseRecordMetadata(self.get('kinesisRecordMetadata', {}))
5858

@@ -93,7 +93,7 @@ def delivery_stream_arn(self) -> str:
9393
return self["deliveryStreamArn"]
9494

9595
@property
96-
def source_kinesis_stream_arn(self) -> str:
96+
def source_kinesis_stream_arn(self) -> Optional[str]:
9797
"""ARN of the Kinesis Stream; present only when Kinesis Stream is source"""
9898
return self.get("sourceKinesisStreamArn")
9999

docs/utilities/data_classes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ function to access the data either as json or plain text, depending on the origi
918918
# or swap for below if data was delivered as text
919919
# data = kinesis_firehose_record.data_as_text
920920
921-
modified_record = do_sometime(data)
921+
modified_record = do_sometime_with(data)
922922

923923
firehose_record_output = {
924924
"recordId": rec.record_id,

0 commit comments

Comments
 (0)