Skip to content

Commit 97211e6

Browse files
leandrodamascenaheitorlessa
authored andcommitted
Making mypy happy
1 parent ea1792e commit 97211e6

25 files changed

+27
-26
lines changed

examples/idempotency/src/customize_persistence_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77
from aws_lambda_powertools.utilities.typing import LambdaContext
88

9-
table = os.getenv("IDEMPOTENCY_TABLE")
9+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1010
persistence_layer = DynamoDBPersistenceLayer(
1111
table_name=table,
1212
key_attr="idempotency_key",

examples/idempotency/src/customize_persistence_layer_redis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
from aws_lambda_powertools.utilities.typing import LambdaContext
1010

11-
redis_endpoint = os.getenv("REDIS_CLUSTER_ENDPOINT")
11+
redis_endpoint = os.getenv("REDIS_CLUSTER_ENDPOINT", "localhost")
1212
persistence_layer = RedisCachePersistenceLayer(
1313
host=redis_endpoint,
1414
port=6379,

examples/idempotency/src/getting_started_with_idempotency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
from aws_lambda_powertools.utilities.typing import LambdaContext
1010

11-
table = os.getenv("IDEMPOTENCY_TABLE")
11+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1212
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1313

1414

examples/idempotency/src/getting_started_with_idempotency_redis_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
)
1313
from aws_lambda_powertools.utilities.typing import LambdaContext
1414

15-
redis_endpoint = os.getenv("REDIS_CLUSTER_ENDPOINT")
15+
redis_endpoint = os.getenv("REDIS_CLUSTER_ENDPOINT", "localhost")
1616
client = Redis(
1717
host=redis_endpoint,
1818
port=6379,

examples/idempotency/src/getting_started_with_idempotency_redis_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111
from aws_lambda_powertools.utilities.typing import LambdaContext
1212

13-
redis_endpoint = os.getenv("REDIS_CLUSTER_ENDPOINT")
13+
redis_endpoint = os.getenv("REDIS_CLUSTER_ENDPOINT", "localhost")
1414
persistence_layer = RedisCachePersistenceLayer(host=redis_endpoint, port=6379)
1515

1616

examples/idempotency/src/integrate_idempotency_with_batch_processor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from typing import Any, Dict
23

34
from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType, process_partial_response
45
from aws_lambda_powertools.utilities.data_classes.sqs_event import SQSRecord
@@ -11,7 +12,7 @@
1112

1213
processor = BatchProcessor(event_type=EventType.SQS)
1314

14-
table = os.getenv("IDEMPOTENCY_TABLE")
15+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1516
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1617
config = IdempotencyConfig(event_key_jmespath="messageId")
1718

@@ -21,7 +22,7 @@ def record_handler(record: SQSRecord):
2122
return {"message": record.body}
2223

2324

24-
def lambda_handler(event: SQSRecord, context: LambdaContext):
25+
def lambda_handler(event: Dict[str, Any], context: LambdaContext):
2526
config.register_lambda_context(context) # see Lambda timeouts section
2627

2728
return process_partial_response(

examples/idempotency/src/integrate_idempotency_with_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from aws_lambda_powertools.utilities.typing import LambdaContext
99
from aws_lambda_powertools.utilities.validation import envelopes, validator
1010

11-
table = os.getenv("IDEMPOTENCY_TABLE")
11+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1212
config = IdempotencyConfig(event_key_jmespath='["message", "username"]')
1313
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1414

examples/idempotency/src/working_with_composite_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77
from aws_lambda_powertools.utilities.typing import LambdaContext
88

9-
table = os.getenv("IDEMPOTENCY_TABLE")
9+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1010
persistence_layer = DynamoDBPersistenceLayer(table_name=table, sort_key_attr="sort_key")
1111

1212

examples/idempotency/src/working_with_custom_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See: https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore-config
1313
boto_config = Config()
1414

15-
table = os.getenv("IDEMPOTENCY_TABLE")
15+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1616
persistence_layer = DynamoDBPersistenceLayer(table_name=table, boto_config=boto_config)
1717

1818
config = IdempotencyConfig(event_key_jmespath="body")

examples/idempotency/src/working_with_custom_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html#module-boto3.session
1313
boto3_session = boto3.session.Session()
1414

15-
table = os.getenv("IDEMPOTENCY_TABLE")
15+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1616
persistence_layer = DynamoDBPersistenceLayer(table_name=table, boto3_session=boto3_session)
1717

1818
config = IdempotencyConfig(event_key_jmespath="body")

0 commit comments

Comments
 (0)