@@ -136,27 +136,6 @@ def is_missing_idempotency_key(data) -> bool:
136136 elif isinstance (data , (int , float , bool )):
137137 return False
138138 return not data
139-
140- def _get_idempotency_key_or_return_none (self , data : dict [str , Any ]) -> str | None :
141- """
142- Get hashed idempotency key or return None early if key is None.
143- If the idempotency key is None, no data will be saved in the Persistence Layer.
144- See: https://github.com/aws-powertools/powertools-lambda-python/issues/2465
145-
146- Parameters
147- ----------
148- data: dict[str, Any]
149- Payload
150-
151- Returns
152- -------
153- str | None
154- Hashed idempotency key or None
155- """
156- idempotency_key = self ._get_hashed_idempotency_key (data = data )
157- if idempotency_key is None :
158- return None
159- return idempotency_key
160139
161140 def _get_hashed_payload (self , data : dict [str , Any ]) -> str :
162141 """
@@ -288,8 +267,10 @@ def save_success(self, data: dict[str, Any], result: dict) -> None:
288267 result: dict
289268 The response from function
290269 """
291- idempotency_key = self ._get_idempotency_key_or_return_none (data = data )
270+ idempotency_key = self ._get_hashed_idempotency_key (data = data )
292271 if idempotency_key is None :
272+ # If the idempotency key is None, no data will be saved in the Persistence Layer.
273+ # See: https://github.com/aws-powertools/powertools-lambda-python/issues/2465
293274 return None
294275
295276 response_data = json .dumps (result , cls = Encoder , sort_keys = True )
@@ -321,8 +302,10 @@ def save_inprogress(self, data: dict[str, Any], remaining_time_in_millis: int |
321302 If expiry of in-progress invocations is enabled, this will contain the remaining time available in millis
322303 """
323304
324- idempotency_key = self ._get_idempotency_key_or_return_none (data = data )
305+ idempotency_key = self ._get_hashed_idempotency_key (data = data )
325306 if idempotency_key is None :
307+ # If the idempotency key is None, no data will be saved in the Persistence Layer.
308+ # See: https://github.com/aws-powertools/powertools-lambda-python/issues/2465
326309 return None
327310
328311 data_record = DataRecord (
@@ -366,8 +349,10 @@ def delete_record(self, data: dict[str, Any], exception: Exception):
366349 The exception raised by the function
367350 """
368351
369- idempotency_key = self ._get_idempotency_key_or_return_none (data = data )
352+ idempotency_key = self ._get_hashed_idempotency_key (data = data )
370353 if idempotency_key is None :
354+ # If the idempotency key is None, no data will be saved in the Persistence Layer.
355+ # See: https://github.com/aws-powertools/powertools-lambda-python/issues/2465
371356 return None
372357
373358 data_record = DataRecord (idempotency_key = idempotency_key )
@@ -402,8 +387,10 @@ def get_record(self, data: dict[str, Any]) -> DataRecord | None:
402387 Payload doesn't match the stored record for the given idempotency key
403388 """
404389
405- idempotency_key = self ._get_idempotency_key_or_return_none (data = data )
390+ idempotency_key = self ._get_hashed_idempotency_key (data = data )
406391 if idempotency_key is None :
392+ # If the idempotency key is None, no data will be saved in the Persistence Layer.
393+ # See: https://github.com/aws-powertools/powertools-lambda-python/issues/2465
407394 return None
408395
409396 cached_record = self ._retrieve_from_cache (idempotency_key = idempotency_key )
0 commit comments