@@ -160,10 +160,6 @@ def convert_dict(
160
160
return {key_converter (key ): value_converter (value ) for key , value in mapping .items ()}
161
161
162
162
163
- def convert_enum (convert_func : ConvertFunctionType , enum : Enum ) -> Any :
164
- return convert_func (enum .value )
165
-
166
-
167
163
def convert_hex_string (item : str ) -> bytes :
168
164
if not isinstance (item , str ):
169
165
raise InvalidTypeError (str , type (item ))
@@ -236,11 +232,6 @@ def function_to_convert_one_item(
236
232
key_converter = function_to_convert_one_item (inner_types [0 ], json_parser )
237
233
value_converter = function_to_convert_one_item (inner_types [1 ], json_parser )
238
234
return lambda mapping : convert_dict (key_converter , value_converter , mapping ) # type: ignore[arg-type]
239
- elif is_type_Enum (f_type ):
240
- if not hasattr (f_type , "_streamable_proxy" ):
241
- raise UnsupportedType (f"Using Enum ({ f_type } ) in streamable requires a 'streamable_enum' wrapper." )
242
- convert_func = function_to_convert_one_item (f_type ._streamable_proxy , json_parser )
243
- return lambda enum : convert_enum (convert_func , enum ) # type: ignore[arg-type]
244
235
elif hasattr (f_type , "from_json_dict" ):
245
236
if json_parser is None :
246
237
json_parser = f_type .from_json_dict
@@ -290,11 +281,6 @@ def function_to_post_init_process_one_item(f_type: type[object]) -> ConvertFunct
290
281
key_converter = function_to_post_init_process_one_item (inner_types [0 ])
291
282
value_converter = function_to_post_init_process_one_item (inner_types [1 ])
292
283
return lambda mapping : convert_dict (key_converter , value_converter , mapping ) # type: ignore[arg-type]
293
- if is_type_Enum (f_type ):
294
- if not hasattr (f_type , "_streamable_proxy" ):
295
- raise UnsupportedType (f"Using Enum ({ f_type } ) in streamable requires a 'streamable_enum' wrapper." )
296
- process_inner_func = function_to_post_init_process_one_item (f_type ._streamable_proxy )
297
- return lambda item : convert_enum (f_type ._streamable_proxy , item ) # type: ignore[arg-type]
298
284
return lambda item : post_init_process_item (f_type , item )
299
285
300
286
@@ -553,7 +539,10 @@ def function_to_stream_one_item(f_type: type[Any]) -> StreamFunctionType:
553
539
elif is_type_Enum (f_type ):
554
540
if not hasattr (f_type , "_streamable_proxy" ):
555
541
raise UnsupportedType (f"Using Enum ({ f_type } ) in streamable requires a 'streamable_enum' wrapper." )
556
- return function_to_stream_one_item (f_type ._streamable_proxy )
542
+ return lambda item , f : function_to_stream_one_item (f_type ._streamable_proxy )(
543
+ f_type ._streamable_proxy (item .value ), # type: ignore[attr-defined]
544
+ f ,
545
+ )
557
546
elif f_type is str :
558
547
return stream_str
559
548
elif f_type is bool :
0 commit comments