@@ -140,7 +140,7 @@ def deserialise_value(cls, value_type: type, value: Any, **kwargs) -> Any: # no
140140
141141 if value and value_type in (bytes , bytearray ) and hasattr (value , "value" ):
142142 value = value .value
143- if isinstance ( value_type , bytearray ) :
143+ if value_type is bytearray :
144144 value = bytearray (value )
145145
146146 if value_type in (str , bool , bytes , bytearray ):
@@ -160,18 +160,18 @@ def deserialise_value(cls, value_type: type, value: Any, **kwargs) -> Any: # no
160160
161161 origin_type = get_origin (value_type )
162162
163- if isinstance ( origin_type , list ) :
163+ if origin_type is list :
164164 item_type = get_args (value_type )[0 ]
165165 return [cls .deserialise_value (item_type , val , ** kwargs ) for val in value ]
166166
167- if isinstance ( origin_type , dict ) :
167+ if origin_type is dict :
168168 val_type = get_args (value_type )[1 ]
169169 return {key : cls .deserialise_value (val_type , val , ** kwargs ) for key , val in value .items ()}
170170
171- if isinstance ( origin_type , frozenset ) :
171+ if origin_type is frozenset :
172172 return frozenset (val for val in value )
173173
174- if isinstance ( origin_type , set ) :
174+ if origin_type is set :
175175 return set (value )
176176
177177 return value
0 commit comments