Skip to content

Commit f418f1b

Browse files
Making mypy happy
1 parent 0eceb13 commit f418f1b

25 files changed

+27
-26
lines changed

examples/idempotency/src/customize_persistence_layer.py

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+3-2
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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")

examples/idempotency/src/working_with_dataclass_deduced_output_serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from aws_lambda_powertools.utilities.idempotency.serialization.dataclass import DataclassSerializer
1010
from aws_lambda_powertools.utilities.typing import LambdaContext
1111

12-
table = os.getenv("IDEMPOTENCY_TABLE")
12+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1313
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1414
config = IdempotencyConfig(event_key_jmespath="order_id") # see Choosing a payload subset section
1515

examples/idempotency/src/working_with_dataclass_explicitly_output_serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from aws_lambda_powertools.utilities.idempotency.serialization.dataclass import DataclassSerializer
1010
from aws_lambda_powertools.utilities.typing import LambdaContext
1111

12-
table = os.getenv("IDEMPOTENCY_TABLE")
12+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1313
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1414
config = IdempotencyConfig(event_key_jmespath="order_id") # see Choosing a payload subset section
1515

examples/idempotency/src/working_with_exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from aws_lambda_powertools.utilities.idempotency.exceptions import IdempotencyPersistenceLayerError
1111
from aws_lambda_powertools.utilities.typing import LambdaContext
1212

13-
table = os.getenv("IDEMPOTENCY_TABLE")
13+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1414
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1515

1616
config = IdempotencyConfig()

examples/idempotency/src/working_with_idempotency_key_required.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
)
88
from aws_lambda_powertools.utilities.typing import LambdaContext
99

10-
table = os.getenv("IDEMPOTENCY_TABLE")
10+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1111
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1212
config = IdempotencyConfig(
1313
event_key_jmespath='["user.uid", "order_id"]',

examples/idempotency/src/working_with_idempotent_function_custom_output_serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from aws_lambda_powertools.utilities.idempotency.serialization.custom_dict import CustomDictSerializer
1010
from aws_lambda_powertools.utilities.typing import LambdaContext
1111

12-
table = os.getenv("IDEMPOTENCY_TABLE")
12+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1313
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1414
config = IdempotencyConfig(event_key_jmespath="order_id") # see Choosing a payload subset section
1515

examples/idempotency/src/working_with_idempotent_function_dataclass.py

+1-1
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
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1313
config = IdempotencyConfig(event_key_jmespath="order_id") # see Choosing a payload subset section
1414

examples/idempotency/src/working_with_idempotent_function_pydantic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from aws_lambda_powertools.utilities.parser import BaseModel
99
from aws_lambda_powertools.utilities.typing import LambdaContext
1010

11-
table = os.getenv("IDEMPOTENCY_TABLE")
11+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1212
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1313
config = IdempotencyConfig(event_key_jmespath="order_id") # see Choosing a payload subset section
1414

examples/idempotency/src/working_with_lambda_timeout.py

+1-1
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
config = IdempotencyConfig()

examples/idempotency/src/working_with_local_cache.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
)
88
from aws_lambda_powertools.utilities.typing import LambdaContext
99

10-
table = os.getenv("IDEMPOTENCY_TABLE")
10+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1111
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1212
config = IdempotencyConfig(
1313
event_key_jmespath="powertools_json(body)",

examples/idempotency/src/working_with_payload_subset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111
from aws_lambda_powertools.utilities.typing import LambdaContext
1212

13-
table = os.getenv("IDEMPOTENCY_TABLE")
13+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1414
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1515

1616
# Deserialize JSON string under the "body" key

examples/idempotency/src/working_with_pydantic_deduced_output_serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from aws_lambda_powertools.utilities.parser import BaseModel
1010
from aws_lambda_powertools.utilities.typing import LambdaContext
1111

12-
table = os.getenv("IDEMPOTENCY_TABLE")
12+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1313
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1414
config = IdempotencyConfig(event_key_jmespath="order_id") # see Choosing a payload subset section
1515

examples/idempotency/src/working_with_pydantic_explicitly_output_serializer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from aws_lambda_powertools.utilities.parser import BaseModel
1010
from aws_lambda_powertools.utilities.typing import LambdaContext
1111

12-
table = os.getenv("IDEMPOTENCY_TABLE")
12+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1313
dynamodb = DynamoDBPersistenceLayer(table_name=table)
1414
config = IdempotencyConfig(event_key_jmespath="order_id") # see Choosing a payload subset section
1515

examples/idempotency/src/working_with_record_expiration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
)
88
from aws_lambda_powertools.utilities.typing import LambdaContext
99

10-
table = os.getenv("IDEMPOTENCY_TABLE")
10+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1111
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1212
config = IdempotencyConfig(
1313
event_key_jmespath="body",

examples/idempotency/src/working_with_response_hook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def my_response_hook(response: Dict, idempotent_data: DataRecord) -> Dict:
3131
return response
3232

3333

34-
table = os.getenv("IDEMPOTENCY_TABLE")
34+
table = os.getenv("IDEMPOTENCY_TABLE", "")
3535
dynamodb = DynamoDBPersistenceLayer(table_name=table)
3636
config = IdempotencyConfig(response_hook=my_response_hook)
3737

examples/idempotency/src/working_with_validation_payload.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
logger = Logger()
1515

16-
table = os.getenv("IDEMPOTENCY_TABLE")
16+
table = os.getenv("IDEMPOTENCY_TABLE", "")
1717
persistence_layer = DynamoDBPersistenceLayer(table_name=table)
1818
config = IdempotencyConfig(
1919
event_key_jmespath='["user_id", "product_id"]',

0 commit comments

Comments
 (0)