@@ -138,13 +138,18 @@ def _paginate_request(
138138 except KeyError :
139139 pagination_config = None
140140
141+ # If _expect_standard_dictionaries is true, input items are expected to be standard dictionaries,
142+ # and need to be converted to DDB-JSON before encryption.
141143 if self ._expect_standard_dictionaries :
142144 if "TableName" in client_kwargs :
143145 self ._resource_to_client_shape_converter .table_name = client_kwargs ["TableName" ]
144146 client_kwargs = input_item_to_ddb_transform_method (client_kwargs )
145147
148+ # Apply DBESDK transformations to the input
146149 transformed_request = input_transform_method (input_transform_shape (sdk_input = client_kwargs )).transformed_input
147150
151+ # If _expect_standard_dictionaries is true, the boto3 client expects items to be standard dictionaries,
152+ # and need to be converted from DDB-JSON to a standard dictionary before being passed to the boto3 client.
148153 if self ._expect_standard_dictionaries :
149154 transformed_request = input_item_to_dict_transform_method (transformed_request )
150155
@@ -154,18 +159,24 @@ def _paginate_request(
154159 sdk_page_response = self ._paginator .paginate (** transformed_request )
155160
156161 for page in sdk_page_response :
162+ # If _expect_standard_dictionaries is true, the boto3 client returns items as standard dictionaries,
163+ # and needs to convert the standard dictionary to DDB-JSON before passing the response to the DBESDK.
157164 if self ._expect_standard_dictionaries :
158165 page = output_item_to_ddb_transform_method (page )
159166
167+ # Apply DBESDK transformation to the boto3 output
160168 dbesdk_response = output_transform_method (
161169 output_transform_shape (
162170 original_input = client_kwargs ,
163171 sdk_output = page ,
164172 )
165173 ).transformed_output
166174
175+ # Copy any missing fields from the SDK output to the response (e.g. ConsumedCapacity)
167176 dbesdk_response = self ._copy_sdk_response_to_dbesdk_response (page , dbesdk_response )
168177
178+ # If _expect_standard_dictionaries is true, the boto3 client expects items to be standard dictionaries,
179+ # and need to be converted from DDB-JSON to a standard dictionary before returning the response.
169180 if self ._expect_standard_dictionaries :
170181 dbesdk_response = output_item_to_dict_transform_method (dbesdk_response )
171182
0 commit comments