@@ -214,7 +214,7 @@ def read(self, b=-1):
214
214
if b is None or b < 0 :
215
215
b = - 1
216
216
217
- _LOGGER .debug ("Stream read called, requesting %s bytes" , b )
217
+ _LOGGER .debug ("Stream read called, requesting %d bytes" , b )
218
218
output = io .BytesIO ()
219
219
220
220
if not self ._message_prepped :
@@ -234,7 +234,7 @@ def read(self, b=-1):
234
234
self .output_buffer = b""
235
235
236
236
self .bytes_read += output .tell ()
237
- _LOGGER .debug ("Returning %s bytes of %s bytes requested" , output .tell (), b )
237
+ _LOGGER .debug ("Returning %d bytes of %d bytes requested" , output .tell (), b )
238
238
return output .getvalue ()
239
239
240
240
def tell (self ):
@@ -538,7 +538,7 @@ def _read_bytes_to_framed_body(self, b):
538
538
:returns: Bytes read from source stream, encrypted, and serialized
539
539
:rtype: bytes
540
540
"""
541
- _LOGGER .debug ("collecting %s bytes" , b )
541
+ _LOGGER .debug ("collecting %d bytes" , b )
542
542
_b = b
543
543
544
544
if b > 0 :
@@ -565,10 +565,11 @@ def _read_bytes_to_framed_body(self, b):
565
565
# If finalizing on this pass, wait until final frame is written
566
566
or (finalize and not final_frame_written )
567
567
):
568
- is_final_frame = finalize and len (plaintext ) < self .config .frame_length
569
- bytes_in_frame = min (len (plaintext ), self .config .frame_length )
568
+ current_plaintext_length = len (plaintext )
569
+ is_final_frame = finalize and current_plaintext_length < self .config .frame_length
570
+ bytes_in_frame = min (current_plaintext_length , self .config .frame_length )
570
571
_LOGGER .debug (
571
- "Writing %s bytes into%s frame %s " ,
572
+ "Writing %d bytes into%s frame %d " ,
572
573
bytes_in_frame ,
573
574
" final" if is_final_frame else "" ,
574
575
self .sequence_number ,
@@ -719,7 +720,7 @@ def _read_header(self):
719
720
and header .frame_length > self .config .max_body_length
720
721
):
721
722
raise CustomMaximumValueExceeded (
722
- "Frame Size in header found larger than custom value: {found} > {custom}" .format (
723
+ "Frame Size in header found larger than custom value: {found:d } > {custom:d }" .format (
723
724
found = header .frame_length , custom = self .config .max_body_length
724
725
)
725
726
)
@@ -758,7 +759,7 @@ def _prep_non_framed(self):
758
759
759
760
if self .config .max_body_length is not None and self .body_length > self .config .max_body_length :
760
761
raise CustomMaximumValueExceeded (
761
- "Non-framed message content length found larger than custom value: {found} > {custom}" .format (
762
+ "Non-framed message content length found larger than custom value: {found:d } > {custom:d }" .format (
762
763
found = self .body_length , custom = self .config .max_body_length
763
764
)
764
765
)
@@ -792,7 +793,7 @@ def _read_bytes_from_non_framed_body(self, b):
792
793
_LOGGER .debug ("starting non-framed body read" )
793
794
# Always read the entire message for non-framed message bodies.
794
795
bytes_to_read = self .body_end - self .source_stream .tell ()
795
- _LOGGER .debug ("%s bytes requested; reading %s bytes" , b , bytes_to_read )
796
+ _LOGGER .debug ("%d bytes requested; reading %d bytes" , b , bytes_to_read )
796
797
ciphertext = self .source_stream .read (bytes_to_read )
797
798
798
799
if len (self .output_buffer ) + len (ciphertext ) < self .body_length :
@@ -821,13 +822,13 @@ def _read_bytes_from_framed_body(self, b):
821
822
"""
822
823
plaintext = b""
823
824
final_frame = False
824
- _LOGGER .debug ("collecting %s bytes" , b )
825
+ _LOGGER .debug ("collecting %d bytes" , b )
825
826
while len (plaintext ) < b and not final_frame :
826
827
_LOGGER .debug ("Reading frame" )
827
828
frame_data , final_frame = aws_encryption_sdk .internal .formatting .deserialize .deserialize_frame (
828
829
stream = self .source_stream , header = self ._header , verifier = self .verifier
829
830
)
830
- _LOGGER .debug ("Read complete for frame %s " , frame_data .sequence_number )
831
+ _LOGGER .debug ("Read complete for frame %d " , frame_data .sequence_number )
831
832
if frame_data .sequence_number != self .last_sequence_number + 1 :
832
833
raise SerializationError ("Malformed message: frames out of order" )
833
834
self .last_sequence_number += 1
@@ -846,7 +847,8 @@ def _read_bytes_from_framed_body(self, b):
846
847
encrypted_data = frame_data ,
847
848
associated_data = associated_data ,
848
849
)
849
- _LOGGER .debug ("bytes collected: %s" , len (plaintext ))
850
+ plaintext_length = len (plaintext )
851
+ _LOGGER .debug ("bytes collected: %d" , plaintext_length )
850
852
if final_frame :
851
853
_LOGGER .debug ("Reading footer" )
852
854
self .footer = aws_encryption_sdk .internal .formatting .deserialize .deserialize_footer (
0 commit comments