1515from dataclasses import dataclass
1616from io import BytesIO
1717from struct import pack , unpack
18+ from types import MappingProxyType
1819from typing import Literal , Self
1920
2021from smithy_core .aio .interfaces import AsyncByteStream
@@ -610,11 +611,11 @@ class _DecodeUtils:
610611 INT64_BYTE_FORMAT = "!q"
611612
612613 # uint byte size to unpack format
613- UINT_BYTE_FORMAT : dict [_ArraySize , str ] = {
614+ UINT_BYTE_FORMAT : Mapping [_ArraySize , str ] = MappingProxyType ( {
614615 1 : UINT8_BYTE_FORMAT ,
615616 2 : UINT16_BYTE_FORMAT ,
616617 4 : UINT32_BYTE_FORMAT ,
617- }
618+ })
618619
619620 @staticmethod
620621 def unpack_uint8 (data : BytesLike ) -> tuple [int , int ]:
@@ -749,7 +750,7 @@ class EventHeaderDecoder(Iterator[tuple[str, HEADER_VALUE]]):
749750
750751 # Maps header type to appropriate unpacking function
751752 # These unpacking functions return the value and the amount unpacked
752- _HEADER_TYPE_MAP : dict [int , Callable [[BytesLike ], tuple [HEADER_VALUE , int ]]] = {
753+ _HEADER_TYPE_MAP : Mapping [int , Callable [[BytesLike ], tuple [HEADER_VALUE , int ]]] = MappingProxyType ( {
753754 # Boolean headers have no data bytes following the type signifier, so they
754755 # can just return static values.
755756 0 : lambda b : (True , 0 ), # boolean_true
@@ -762,7 +763,7 @@ class EventHeaderDecoder(Iterator[tuple[str, HEADER_VALUE]]):
762763 7 : _DecodeUtils .unpack_utf8_string , # string
763764 8 : _DecodeUtils .unpack_timestamp , # timestamp
764765 9 : _DecodeUtils .unpack_uuid , # uuid
765- }
766+ })
766767
767768 def __init__ (self , header_bytes : BytesLike ) -> None :
768769 """Initialize an event header decoder.
0 commit comments