Skip to content

Commit d5008ed

Browse files
committed
Reassign to boto3_session instead of inlined expression
1 parent a0878d8 commit d5008ed

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def __init__(
9191
>>> return {"StatusCode": 200}
9292
"""
9393
if boto3_client is None:
94-
boto3_client = (boto3_session or boto3.session.Session()).client("dynamodb", config=boto_config)
94+
boto3_session = boto3_session or boto3.session.Session()
95+
boto3_client = boto3_session.client("dynamodb", config=boto_config)
9596
self.client = boto3_client
9697

9798
user_agent.register_feature_to_client(client=self.client, feature="idempotency")

aws_lambda_powertools/utilities/parameters/appconfig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def __init__(
7979
Initialize the App Config client
8080
"""
8181
if boto3_client is None:
82-
boto3_client = (boto3_session or boto3.session.Session()).client("appconfigdata", config=config)
82+
boto3_session = boto3_session or boto3.session.Session()
83+
boto3_client = boto3_session.client("appconfigdata", config=config)
8384
self.client = boto3_client
8485

8586
self.application = resolve_env_var_choice(

aws_lambda_powertools/utilities/parameters/secrets.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def __init__(
8585
Initialize the Secrets Manager client
8686
"""
8787
if boto3_client is None:
88-
boto3_client = (boto3_session or boto3.session.Session()).client("secretsmanager", config=config)
88+
boto3_session = boto3_session or boto3.session.Session()
89+
boto3_client = boto3_session.client("secretsmanager", config=config)
8990
self.client = boto3_client
9091

9192
super().__init__(client=self.client)

aws_lambda_powertools/utilities/parameters/ssm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ def __init__(
115115
Initialize the SSM Parameter Store client
116116
"""
117117
if boto3_client is None:
118-
boto3_client = (boto3_session or boto3.session.Session()).client("ssm", config=config)
118+
boto3_session = boto3_session or boto3.session.Session()
119+
boto3_client = boto3_session.client("ssm", config=config)
119120
self.client = boto3_client
120121

121122
super().__init__(client=self.client)

examples/idempotency/src/bring_your_own_persistent_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def __init__(
2727
boto_config: Optional[Config] = None,
2828
boto3_session: Optional[boto3.session.Session] = None,
2929
):
30-
self._ddb_resource = (boto3_session or boto3.session.Session()).resource("dynamodb", config=boto_config)
30+
boto3_session = boto3_session or boto3.session.Session()
31+
self._ddb_resource = boto3_session.resource("dynamodb", config=boto_config)
3132
self.table_name = table_name
3233
self.table = self._ddb_resource.Table(self.table_name)
3334
self.key_attr = key_attr

0 commit comments

Comments
 (0)